Question OOABL, Calling methods with ABL functions.

Cecil

19+ years progress programming and still learning.
Why is it when calling methods from the class object that it's not entirely clear on how you can pass parameters to the called method.

I've included a very simple class object with multiple version of the same method with different input parameters. In my test code I can successfully call these methods except when I supply a parameter as an ABL function "DATETIME()" . If I pass DATETIME() as a parameter rather than a variable, I get an error:
** Incompatible data types in expression or assignment. (223)
Could not locate method 'test' with matching signature in class
'mulitmethods'. (14457)
*** .\ Could not understand line 15. (196)

So the solution is to pass the parameters as variable and not to use the DATETIME() function. But the same rule does not seem to apply to other ABL functions: INTEGER(), DECIMAL(), LOGICAL() & STRING(). Why would this be ? Is it expected behaviour or is it Bug??

Class Object mulitmethods.cls
Code:
CLASS class.awsomecode.object.mulitmethods:

    METHOD PUBLIC VOID test (INPUT in_Integer   AS INTEGER,
                             INPUT in_DateTime AS DATETIME):
    END METHOD.

    METHOD PUBLIC VOID test (INPUT in_Integer   AS INTEGER,
                             INPUT in_Character AS CHARACTER):
    END METHOD.

    METHOD PUBLIC VOID test (INPUT in_Integer  AS INTEGER,
                             INPUT in_Integer2 AS INTEGER):
    END METHOD.

    METHOD PUBLIC VOID test (INPUT in_Integer AS INTEGER,
                             INPUT in_Logical AS LOGICAL):
    END METHOD.

    METHOD PUBLIC VOID test (INPUT in_Integer AS INTEGER,
                             INPUT in_Logical AS DECIMAL):
    END METHOD.

END CLASS.

Test Code:
Code:
USING class.awsomecode.object.*.

DEFINE VARIABLE obMulitMethods   AS CLASS mulitmethods  NO-UNDO.

obMulitMethods = NEW mulitmethods().

DEFINE VARIABLE param_DateTime AS DATETIME        NO-UNDO.

/** This WORKS as expected  **/
obMulitMethods:test(INTEGER("1"),
                    param_DateTime
                    ).

/** This will FAIL! Why???  **/
obMulitMethods:test(INTEGER("1"),
                    DATETIME(NOW)   /** Passing parameter as DATETIME function **/
                    ).

obMulitMethods:test(1, STRING("RANDOM TEXT")).
obMulitMethods:test(1, 0).
obMulitMethods:test(1, DECIMAL('12312.223343')  ).
obMulitMethods:test(1, LOGICAL(true)  ).
 

KrisM

Member
This error is not related to your class object at all.
Try compiling this:

Code:
MESSAGE datetime(now) VIEW-AS ALERT-BOX INFO BUTTONS OK.
 

Cecil

19+ years progress programming and still learning.
This error is not related to your class object at all.
Try compiling this:

Code:
MESSAGE datetime(now) VIEW-AS ALERT-BOX INFO BUTTONS OK.
That's bizarre??
IMHO I'm going out on a limb, and say this is a bug. However because the DataTime() functions has been kicking around for years, Progress will turn around and say it's expected behaviour and then won't fix it just so they can state that there ABL is backward compatible. Blar Blar Blar.
 
Top