Wish Unlimited number of arguments when using CallSub/CallSubDelayed

MarkusR

Well-Known Member
Licensed User
Longtime User
How does the VB6/VB.NET compiler support optional parameters, and can that ability be implemented in B4X?
for Test2 Sub see #19
VB6
Private Sub Form_Load()

Test "a", "b", "Hello", d:=123
Test2 "s", 1, Null, 3, 4, 4, 5

End Sub

Sub Test(a As String, b As String, Optional c As String = "dasdasd", Optional d As Long)

Debug.Print c

End Sub

Sub Test2(ParamArray a() As Variant)

Debug.Print a(0)

End Sub
 

JohnC

Expert
Licensed User
Longtime User
for Test2 Sub see #19
VB6
My question was really directed to Erel and asking him if it would be possible to modify the B4X IDE/Compiler to implement optional parameters just like Microsoft's VB6/VB.NET IDE/Compiler does so B4X will have all of the abilities that LucaMs listed in his first post.
 

LucaMs

Expert
Licensed User
Longtime User
My question was really directed to Erel and asking him if it would be possible to modify the B4X IDE/Compiler to implement optional parameters just like Microsoft's VB6/VB.NET IDE/Compiler does so B4X will have all of the abilities that LucaMs listed in his first post.
Thanks but, even if I agree, optional parameters are useful (sometimes), I refer to the possibility of using CallSub and CallSubDelayed with an unlimited number of arguments, which is not the same thing.

I think that this thread could be considered closed ;)
 

agraham

Expert
Licensed User
Longtime User
In languages in which support variable length parameter lists the compiler massages them into an array of Objects that is passed to the method so the actual method always has a fixed number of parameters in its declaration, the last of which is an Object array.
 
Top