[fpc-devel] Local variable names and colision with attributes/properties names

Marcos Douglas md at delfire.net
Thu Sep 27 18:36:57 CEST 2012

On Thu, Sep 27, 2012 at 12:08 PM,  <michael.vancanneyt at wisa.be> wrote:
> On Thu, 27 Sep 2012, Marcos Douglas wrote:
>>> Yes, it's always possible. In practice, I haven't seen this happen a
>>> single
>>> time in the 10+ years that the compiler has had this feature. That
>>> doesn't
>>> mean that it's impossible, but it's another factor in the "good to have"
>>> versus "causes more harm than good" equation.
>> Well, happened on the own compiler.  ;-)
>> IMHO, these collisions happen a lot and because of this many
>> programmers use prefixes in local variables, see:
>> lNet, fpGUI, tiOPF2, Indy, and even Delphi (DateUtils unit eg.).
> Exactly.
> The compiler helps you by forcing you to use a prefix in objfpc mode in case
> you forgot.

The collisions exist because the compiler give us an error. If the
compiler respect the scope, the collisions would not exist.
However we can use "poor names" -- very difficult to happen a
collision -- to represent a variable like A, J, D... but I do not
think this is a good practice and you?

Marcos Douglas

Marcos Douglas

More information about the fpc-devel mailing list