Large compiler refactoring

Peter Simpson

Expert
Licensed User
Longtime User
Excellent news @Erel , thank you...
 

Daestrum

Expert
Licensed User
Longtime User
Optional as needed on definition, not needed on call?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Optional as needed on definition, not needed on call?
Yes.

naughty question: will CallSub and CallSubDelayed also be able to call Subs that have optional parameters?
No. Optional parameters are set during compilation so dynamic calls must include all parameters.
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
does this also means that it will be possible to call "Initialize" on a generic "Object" by using CallSub without knowing it's actual Class?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
At last we can get rid of the unused "job name" parameter (it was important before the Wait For feature was implemented):
B4X:
Dim j As HttpJob
j.Initialize 'instead of j.Initialize("", Me)
j.Download(url)

B4X:
Public Sub Initialize (Name As String = "", TargetModule As Object = Me)
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
B4X:
Public Sub Initialize (Name As String = "", TargetModule As Object = Me)
so "Me" will be evaluated at run-time, not at compile time, like the "Name" parameter
"Me" will be set to the calling object not the object containing the Initialize sub.
is it a special case or it will be applied to all parameters?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The default values are set during compilation, not runtime.


"Me" will be set to the calling object not the object containing the Initialize sub.
True.

is it a special case or it will be applied to all parameters?
It is not a special case, though I assume that most default values will be of constant values.
 
Top