You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

theuserbl

Intermediate

  • "theuserbl" started this thread

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

1

Wednesday, February 23rd 2011, 6:11pm

Sense of VBArray?

Do anybody know, which advantages VBArray have?
http://code.google.com/p/jabacoframework…BA/VBArray.java

Jabaco code like

Jabaco Source

1
Dim b() As Double
is compiled to

Jabaco Source

1
Dim b As VBA#VBArrayDouble


With Dim it happens everytime. And in functions it can be prevented with the Jabaco key-word ByJava:

Jabaco Source

1
2
Public Sub main(ByJava args() As String)
End Sub


But currently I don't see any advatage, to use for example VBArrayDouble over instead of an real array of double.
http://code.google.com/p/jabacoframework…rrayDouble.java

I see only the disadvantage, that it is not possible to use arrays with more then one dimension.

Jabaco Source

1
2
3
Dim a As Integer  ' int a;
Dim b() As Integer ' VBArrayInteger b;
Dim c(,) As Single ' Don't Compile  :-(

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Wednesday, February 23rd 2011, 7:40pm

Yes, the same question occurred to me.

It might have been better to go for pure Java arrays.
But I'm not sure regarding the implications in terms of compatibility.

Greetings

A1880

theuserbl

Intermediate

  • "theuserbl" started this thread

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

3

Thursday, February 24th 2011, 7:25pm

Here is an additional funny thing.
In this case it have more to do with the BASIC syntax:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Dim SomeThing1(5) As Integer
Dim Both(3) As Integer

Public Sub CallIt()
  SomeThing1(0) = 7
  SomeThing1(1) = 6
  SomeThing1(2) = 3
  SomeThing1(3) = 45
  SomeThing1(4) = 34
  Both(0) = 23
  Both(1) = 47
  Both(2) = 63
End Sub

Public Function SomeThing2(a As Integer) As Integer
  Something2=a*2
End Function

Public Function Both(b As Integer) As Integer
  Both = b*b
End Function

Public Sub main(ByJava args() As String)
  CallIt()
  Debug.Print SomeThing1(3)
  Debug.Print SomeThing2(3)
  Debug.Print Both(1)
   MsgBox("only a window, to wait. So you can see the debug window")
End Sub


Can you tell - without running that program - which number Debug.Print Both(1) outputs? :)

theuserbl

Intermediate

  • "theuserbl" started this thread

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

4

Thursday, February 24th 2011, 7:43pm

Are "[" and "]" already used in BASIC?

Possible Jabaco could use it for Arrays.

So in Java:

Source code

1
2
3
4
5
6
int a[] = new int[4];
double b[][] = new int[45][23];

int a(int h) {
return h*7;
}


is in the current Jabaco (and in BASIC):

Jabaco Source

1
2
3
4
5
Dim a(4) As Integer
Dim b(45,23) As Double 'Currently not supported in Jabaco

Function a(h As Integer) As Integer
End Function


And it could be in Jabaco:

Jabaco Source

1
2
3
4
5
Dim a[4] As Integer
Dim b[45,23] As Double 'Currently not supported in Jabaco

Function a(h As Integer) As Integer
End Function


I think, then there it is more improbable, to misread the code.

This post has been edited 3 times, last edit by "theuserbl" (Feb 24th 2011, 7:52pm)


Rate this thread
WoltLab Burning Board