[Gambas-user] Gambas3 byref behavior
Jussi Lahtinen
jussi.lahtinen at ...626...
Wed Feb 25 20:41:37 CET 2009
Hi
I could be wrong, but.
I think that byref command should behave like this:
a = 0
TestFunction(a)
Print a
Public Function TestFunction(Byref x as Integer)
Inc x
End
Result:
1
And if you like to pass byref argument byval instead for some reason,
you should do this:
a = 0
TestFunction(Byval a)
Print a
Public Function TestFunction(Byref x as Integer)
Inc x
End
Result:
0
There are reasons why one design function to take parameters byref,
and so, it should be default behavior.
Need to pass byref argument byval is rare exception (I think).
Maybe there are some technical restrictions why this is as it is.
And maybe this is not good enough reason to change syntax anymore...
What do you think?
Jussi
More information about the User
mailing list