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

Marcos Douglas md at delfire.net
Thu Sep 27 18:46:58 CEST 2012


On Thu, Sep 27, 2012 at 12:26 PM, Graeme Geldenhuys
<graeme at geldenhuys.co.uk> wrote:
> On 2012-09-27 15:48, Marcos Douglas wrote:
>> problem, IMHO, is that I can't choose when we talk about local
>> variables.
>
> Just like there is a coding style (not language rule) that classes start
> with the "T" prefix, and class field variable start with a "F" prefix, I
> applied that same coding style to parameters and local variables.
>
> "L" prefix for local variable - though I prefer the lowercase 'l' for
> this for some add reason. The exception being counter variables like x,
> y, i, j etc.

Because "l" is more beautiful than "L" because is less "verbose". ;-)

> "A" prefix for parameter variables.
>
> Using this simple coding style makes things even more logical and less
> confusing, even though I use mode objfpc for 90% of my code.

I do the same:
https://github.com/mdbs99/Greyhound/blob/master/src/gh_db.pas

But I do not like inconsistencies: a) I can use unit names in
properties 2) I can use the same name in methods and procedures...
etc... but I can not use local variables with the same name as a
property(!)

Almost everything is Ok and beautiful -- well still lacks "namespace"
feature that you also agree with me -- but not this design using local
variables.

This "feature" have the origin in a bug in compiler. Well...
"If you have a fever, it is best to break the thermometer?"

Marcos Douglas

Marcos Douglas



More information about the fpc-devel mailing list