Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-07

Yet another problem concerning Qualifiers

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anton Tichawa

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

IMHO, this is not the correct behaviour. Note: I still use 1.0.10.

Thank you,

Anton.

Reply by email

Marcel Martin
to Anton Tichawa
Anton Tichawa wrote 27 lines
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

And without the "test."?

mm http://www.ellipsa.net/ ( suppress no.sp.am. )

Reply by email

Ron Weidner
to Marcel Martin
--- Marcel Martin wrote 30 lines
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.

Ron_W

__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail

Reply by email

Unknown author
to Ron Weidner
Ron Weidner wrote 52 lines
--- Marcel Martin 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. 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? :-)

Michael.

Reply by email

Anton Tichawa
to Unknown author
Show quoted text 72 lines
On Fri, 9 Jul 2004, Ron Weidner wrote: >--- Marcel Martin 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;
Show quoted text 14 lines
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'.

Reply by email