On Thu, 27 Sep 2012, Marcos Douglas wrote:
On Thu, Sep 27, 2012 at 11:01 AM, Jonas Maebe <[email protected]> wrote:
On 27 Sep 2012, at 15:51, Marcos Douglas wrote:
What is the advantages to the compiler return the error bellow?
ERROR: unit1.pas(31,3) Error: Duplicate identifier "FooVar"
Why the compiler do not respect the scope, ie, the local variable
should have the preference, I'm not right?
Yes, but the human brain is very good at confusing such things, and it's
very easy to accidentally assign something to a local variable instead of to
a field.
Only Pascal uses that way?
No, the brain works that way.
The FPC team decided to protect you from accidental mistakes by forbidding
this special case in $mode objfpc.
For me, it has become second nature never ever to have a variable with the
same name as a property, even in Delphi.
Michael.
_______________________________________________
fpc-devel maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel