[lazarus] Name Confilct in fpc
Marc Weustink
Marc.Weustink at cuperus.nl
Tue Feb 29 04:45:52 EST 2000
+ 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:
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
More information about the Lazarus
mailing list