[lazarus] Name Confilct in fpc
Michael Van Canneyt
michael.vancanneyt at wisa.be
Tue Feb 29 07:56:48 EST 2000
On Tue, 29 Feb 2000, Marc Weustink wrote:
> + From: michael@[195.207.84.152] [mailto:michael@[195.207.84.152]]On
> +
> + > The other thing I found after this which Delphi will happily handle
> + > but which fpc throws up on.....
> + >
> + > type
> + > TSomeObject = class(TObject)
> + > private
> + > FSomeVar: TSomeType;
> + > ........
> + > public
> + > procedure DontWork(Dummy: String; SomeVar: TSomeType);
> + > procedure ......
> + > published
> + > property SomeVar: TSomeType Read FSomeVar;
> + > end;
> + >
> + > The Fix is easy...
> + >
> + > procedure DontWork(Dummy: String; aSomeVar: TSomeType);
> +
> + This is done deliberately. We feel that having the same name in a
> + parameter of a method and a property name is very bad coding and
> + should not be allowed. This is, of course, debatable since you could
> + e.g. argue that the procedure starts a new scope, and that within
> + this scope you can redefine any symbol etc etc etc...
>
> Thats one of the pascal language features. I think it is not up to the
> compiler to decide what is a bad coding practice. What do think of:
The compiler doesn't decide anything. The compiler programmers do :-)
Seriously; one of the reasons we ask that you use the @ when assigning
procedural variables, is that we think that is more clear and exact.
This decision is of similar nature. There aren't any specifications
for it; since it isn't ISO pascal, so it's pretty much up to us to
decide what should and what should not be allowed.
Anyway, the discussion is largely academic, since for compatibility
reasons, we'll have to implement it under the {$mode Delphi} directive.
Michael.
>
> procedure X;
> var
> I: integer;
> procedure X;
> var
> I: integer;
> procedure X;
> var
> I: integer;
> begin
> // ... do something ...
> end;
> begin
> // ... do something ...
> X;
> end;
> begin
> // ... do something ...
> X;
> end;
>
> + Probably we'll make some compatibility switch, but don't count
> + on it for the near future.
>
> Hmmm....
>
> Marc
>
> _________________________________________________________________
> To unsubscribe: mail lazarus-request at miraclec.com with
> "unsubscribe" as the Subject
> archives at http://www.miraclec.com/list_archives/lazarus
>
More information about the Lazarus
mailing list