John L. Ries wrote:
On Sat, 17 Apr 2004, Eike Lange wrote:
What would you think about using braces instead? begin foo {}; end.
I don't think, we should support C-style routines.
Since braces are used for comments, I don't think they should be used for anything else.
That was his point. Think about it.
Prof A Olowofoyeku (The African Chief) wrote:
I do not use the empty brackets when coding myself. As I said, it is for compatibility. Having just spent about an hour dealing with this in some existing code that I was porting to GPC, I thought it would have been very nice indeed to have not had to do that. Delphi has had this for nearly 9 years, and it is not going to disappear from Delphi. As long as we want to support Delphi features, we might as well have it (assuming it is easy to implement - which, considering the C backend, I would imagine should not be too difficult).
Syntax is a frontend issue, so that doesn't mean anything (either way).
Waldek Hebisch wrote:
To compile your program one has to add a single line to gpc. However, then also the following "works":
program adelph2; var bar : integer; procedure foo; begin Writeln (bar ()); end; begin bar := 1; foo (); bar() := 2; foo (); end.
I hope that Delphi does not allow my program. Also with my patch Writeln (); is still rejected (builtin functions/procedures are handled differently then user defined ones). So I would estimate that proper support will take 30-150 lines of code.
And what about this:
var a: procedure;
[...]
a () := foo;
If the `()' is to make any sense, this should not be allowed, of course (since a must not be called here). I suppose Delphi doesn't allow this either.
If we want to do it "officially", it must be done properly. I suppose your 30-150 LOC are a good estimate ...
Currently I'm working on other issues. Someday I plan to rewrite the function calling mechanism a little (it's currently a bit messy WRT functional variables etc.; but since there are no urgent bugs in this area, it might not be too soon). Then I'll see if I can do it in such a way that a change like the above becomes easier to do (though I also really don't like it) ...
Frank