Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread overload on methods
Mon, Mar 16 2020 10:48 AMPermanent Link

erickengelke

Avatar

Good work on all the improvements.

One challenge I ran into is using external classes.  

In version 2 we used to be able to say:
Externfn = function( x : variant ) of object;

And then the JavaScript could pass an array or some other value as the x variant.  But you are more strict now.  That’s fine, but I think we now need ‘overload’ so we can declare all the possible parameter lists:

Externfn = function( x : variant ) of object;
Externfn2 = function( x : array of variant ) of object;


Function then( x : Externfn );
Function then( x : ExternFn2 ); overload;

EWB doesn;’t appear to have the overload capability yet, as far as I can tell.

Keep up the great work.
EWB Programming Books and Component Library
http://www.erickengelke.com
Mon, Mar 16 2020 5:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Erick,

<< Good work on all the improvements. >>

Thanks !

<< In version 2 we used to be able to say:
Externfn = function( x : variant ) of object;

And then the JavaScript could pass an array or some other value as the x variant.  But you are more strict now.   >>

You should still be able to pass whatever as the parameter.  Perhaps the issue you're seeing is in how the event (method) types are resolved for assignment purposes (event property = method) ?

<< EWB doesn;’t appear to have the overload capability yet, as far as I can tell. >>

EWB has always been able to overload methods/functions/procedures.  You don't need the overload keyword because the EWB compiler can figure out which routines are the same and which are different by their parameter lists:

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=Methods

under "Overloaded methods":

"Other variants of Object Pascal require that you use the overload keyword to indicate that a method is overloaded. Elevate Web Builder does not use the overloaded keyword because it is unnecessary. The compiler knows if two methods have the same declaration, and will issue an error if they do. The compiler also knows how to find the proper method declaration, or whether one exists at all, by how the method is called. Finally, if an overloaded method has one or more declared versions that aren't actually called, the compiler knows this and will not emit the method during compilation."

Tim Young
Elevate Software
www.elevatesoft.com
Image