On 18 Apr 2004 at 1:26, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
Delphi rejects "Writeln ()" as well. AFAICS, the empty brackets are only allowed for parameter-less routines. Since Writeln can take parameters, that code should be rejected.
Does it allow user-defined optional parameters? If so, what about `()' then?
I am not sure what you are referring to here. Are you referring to things similar to "Writeln" which currently require compiler magic under GPC? If so, I guess they would be implemented by the overloading mechanism, and if one of the overloaded routines takes no parameters, then this whould be okay - for example, this is perfectly legal;
procedure baz; overload; begin end;
procedure baz (i : real); overload; begin end;
procedure baz (i : real; j : string); overload; begin end;
procedure baz (i, j : string); overload; begin end;
[.....] baz; baz (); baz (1.0); baz (5.5, 'Chief'); baz ('African', 'Chief');
If you were referring to something like "default parameters", then this is what the Delphi 7 help file says:
"You can omit parentheses when passing all and only the default parameters to a routine. For example, given the procedure procedure DoSomething(X: Real = 1.0; I: Integer = 0; S: string = ''); the following calls are equivalent. DoSomething(); DoSomething;"
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/