Bug or a feature? No need to use OUTPUT option when calling

Posted by Mike Fechner on 15-Sep-2016 08:59

I would expect that the compiler wines on this call, because I am not using the OUTPUT option for the dtDateTime parameter. Is that expected behaviour? 

DEFINE VARIABLE dtDateTime AS DATETIME NO-UNDO.
DEFINE VARIABLE lOk        AS LOGICAL  NO-UNDO.

lOk = System.DateTime:TryParse("01.01.2016", dtDateTime) .

MESSAGE "lOk"        lOk        SKIP
        "dtDateTime" dtDateTime
    VIEW-AS ALERT-BOX.

Posted by Fernando Souza on 15-Sep-2016 09:07

See the "Parameter passing syntax" entry in the doc. The parameter mode for methods (and constructors) is optional unless there is overloading involved.

Posted by Laura Stern on 15-Sep-2016 09:09

Yes, that is expected.  With OO, since we know what the signature of the method is, the caller does not have to specify all the parameter modes.  If nothing is specified, we just make it match.  Personally, I think this is dubious behavior.  But this is in the mode of the AVM trying to be helpful :-)

All Replies

Posted by Fernando Souza on 15-Sep-2016 09:07

See the "Parameter passing syntax" entry in the doc. The parameter mode for methods (and constructors) is optional unless there is overloading involved.

Posted by Laura Stern on 15-Sep-2016 09:09

Yes, that is expected.  With OO, since we know what the signature of the method is, the caller does not have to specify all the parameter modes.  If nothing is specified, we just make it match.  Personally, I think this is dubious behavior.  But this is in the mode of the AVM trying to be helpful :-)

Posted by Mike Fechner on 15-Sep-2016 09:14

Thanks for the explanation !!!! Laura and Fernando !!!
 
Helpful by confusing us….
 
Must say this makes it very inconsistent with procedures and functions. L

Posted by Laura Stern on 15-Sep-2016 09:26

Yup.  Thus my comment on dubious behavior.  

Posted by cverbiest on 15-Sep-2016 09:27

Could  this be an option for the strict compiler ?

I consider "input" as optional, but "input-output" and "output" as mandatory.

Posted by Evan Bleicher on 15-Sep-2016 11:31

Others have encountered this behavior and also identified the current implementation as confusing.  We have already added to the "strict compiler" feature backlog a new strict compiler option which would require parameter modes for procedures, functions, constructors and methods.  

This thread is closed