[EMAIL PROTECTED] wrote:

On Fri, 9 Jul 2004, Ron Weidner wrote:



--- Marcel Martin <[EMAIL PROTECTED]> wrote:


Anton Tichawa a ?crit :


Hello List!

Compiling the unit

===

unit test;

interface

procedure test.do_test;

implementation

procedure test.do_test;
begin
end;

end.

===

results in compiler errors:

test.pas(5,15) Error: overloaded identifier TEST


isn't a function


test.pas(5,15) Fatal: Syntax error, ; expected but


. found


The following compiled for me...

unit test;

interface

procedure do_test();

implementation

procedure do_test();
begin
end;

begin
end.

I think you only need to fully qualify methods
(functions or procedures) when they are part of an
object.



This is correct. One should never repeat the unit name in a declaration of an identifier.

I see. Still, the implementation of a class method requires prepending the container's name, while the implementation of a module's procedure disallows it. So, when creating pascal code for an arbitrary procedure, I have to write:

if false then begin
end else if inherits(my_container, cmodule) then begin my_text.add_string('procedure ' + my_procedure.fname);
end else if inherits(my_container, cclass) then begin my_text.add_string('procedure ' + my_container.fname + '.' + my_procedure.fname);
end;


Delphi also chokes on the original code, albeit with a
different error:

Copyright (c) 1983,2002 Borland Software Corporation
test.pp(5) Error: Identifier redeclared: 'test'
test.pp(9) Error: Identifier redeclared: 'test'
test.pp(14)
test.pp(5) Error: Unsatisfied forward or external declaration: '.1'

The last line is particularly interesting, I've never encountered that
before. A bug in the Delphi compiler? :-)



*smile* they somehow seem to accept and remember the forward declaration in line 5. But then, even before storing it's name, they reject it, thus leaving the declaration with a skeleton name '.1'.




_______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to