[lazarus] Name Confilct in fpc
Michael Van Canneyt
michael.vancanneyt at wisa.be
Mon Feb 28 03:49:05 EST 2000
On Mon, 28 Feb 2000, Peter Dyson wrote:
> I have been playing with lazarus trying to get the mwCustomEdit .92a to
> compile.
> This has lots of optimizations as far as font and other resource caches
> which will
> probably go a long way to solving the speed, but while doing the
> compile/comment
> out/create new methods cycle, I came across this name conflict I cannot
> resolve.
>
> Here is a code snippet which shows the problem,
> Along with the errors generated.
> It would seem the compiler has some scoping issues.
> Is this design or a 'feature'? :)
>
> The code should describe the problem clearly.
>
> {
>
> $Author: peter $
> $Revision: 1.1 $
> $Log: hello.pp,v $
> Revision 1.1 2000/02/28 02:04:58 peter
> Initial revision
>
> }
> unit hello;
>
> {$mode objfpc} file://tried delphi mode too
> interface
>
> uses SysUtils;
>
>
> type
> TSomeObject = class(TObject)
> private
> s, t, v: string;
> public
> //note made sure this is not same calling convention as Insert
> procedure Insert(Dummy, Dummy1: String);
> procedure NestProc;
> end;
>
> implementation
>
> procedure TSomeObject.Insert(Dummy, Dummy1: String);
> begin
> writeln('Hello World Again this is yet another test');
> end;
>
> procedure TSomeObject.NestProc;
>
> procedure Nested;
> begin
> s := 'A bit of text';
> t := ' new';
> Insert(t, s, 5); // won't compile
> //error "hello.pp" 41 Wrong amount of parameters specified
Exact, since the Insert() method of Nested is assumed.
> end;
>
> begin
> s := 'A bit of text';
> t := ' new';
> SysUtils.Insert(t, s, 5); // won't compile
> //error "hello.pp 48 Identifier not found INSERT
Of course this won't compile, since the insert is located in system,
and not in sysutils...
I think you would find the same problems in Delphi.
The number of times I've use Insert(), Copy() and Assign() inside
a form method, and got a complaint, is close to infinity.
Michael.
More information about the Lazarus
mailing list