I have a unit that has a class that is a descendant of button and in the class i declare a procedure with a default parameter like this
PUBLIC { public declarations }
PROCEDURE INIT (CONST ATABLENAME,ACOLNAME:ShortString;CONST WANT_TO_TOGGLE:BOOLEAN;
CONST UPDATE_TYPE:BOOLEAN = FALSE);
however it seems to compile and work ok if i have this
PROCEDURE TUPDATE_BOOL_COL_BTN.INIT( CONST ATABLENAME, ACOLNAME: SHORTSTRING;CONST WANT_TO_TOGGLE: BOOLEAN; CONST UPDATE_TYPE:BOOLEAN{ = FALSE}) ;
the value seems to be correct default value of false. i am wondering why it tolerates this inconsistent procedure declaration though. is this intentional? wouldn't it be better to have compiler catch this error?
PROCEDURE TUPDATE_BOOL_COL_BTN.INIT( CONST ATABLENAME, ACOLNAME: SHORTSTRING;
CONST WANT_TO_TOGGLE: BOOLEAN{; CONST UPDATE_TYPE:BOOLEAN = FALSE}) ;
the above code gives the errors
BUTTONS_2023.PAS(179,32) Error: function header doesn't match any method of this class "INIT(const ShortString;const ShortString;const Boolean);"
BUTTONS_2023.PAS(55,15) Error: Found declaration: INIT(const ShortString;const ShortString;const Boolean;const Boolean=`FALSE`);
BUTTONS_2023.PAS(185,16) Error: Identifier not found "UPDATE_TYPE"
so it will complain if the parameter is missing but not if it is a mismatch with class declaration