On 18 Apr 2004 at 17:55, Waldek Hebisch wrote:
Prof A Olowofoyeku (The African Chief) wrote:
Works fine here, except that this (valid in Delphi) is still rejected: procedure foo (); begin end;
I see. I have updated the patch to accept the following:
program delfp; type pt = procedure (); ft = function () : integer; var a : pt; b : procedure (); c : ft; d : function () : integer;
function fi : integer; begin fi := 0 end; function fid () : integer; begin fid := 0 end; procedure p ; begin end; procedure pd (); begin end;
begin a := p; a := pd; b := p; b := pd; c := fi; c := fid; d := fi; d := fid; writeln('OK') end .
This compiles ok under Delphi, and prints 'OK'.
However, I do not know if the following is accepted by Delphi:
program delf101; procedure pi (i : integer); forward; procedure pi (); begin end; begin end .
It is not accepted. Delphi thinks you are trying to overload 'pi' without doing it properly. This is the error: "E:\temp\delf101.pas(3) Error: Previous declaration of 'pi' was not marked with the 'overload' directive E:\temp\delf101.pas(8) E:\temp\delf101.pas(2) Error: Unsatisfied forward or external declaration: 'pi'"
Now, this is accepted: program delf102; procedure pi (i : integer); overload; begin end; procedure pi (); overload; begin end; begin end.
PS: with respect to implementing the overloading of routines, ITSM that an easy way to do this is to implicitly generate a different asmname for each one, and then call the correct one (via its asmname or "name" attribute), depending on the parameters passed (or perhaps I am just displaying my ignorance about compiler writing here ...).
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/