[Lazarus] 'with' is evil, isn't it?

Alexander Klenin klenin at gmail.com
Wed Aug 3 13:17:29 CEST 2011


I also use 'with' extensively, despite the risks,
since with the right usage the readablity gains are considerable.

2011/8/3 Max Vlasov <max.vlasov at gmail.com>:
> 1. Introducing a check in the compiler setting (or a conditional define)
> that could force the developer to use self inside 'with' constructions.
...
> 2. Some switch (maybe on by default) that prevents from compiling if there
> are several duplicate names in the same 'with' context (including global,
> local, fields).

Error is IMHO too severe. I think a warning if the name inside of
'with' overrides a name from outer scope
would be an acceptable compromise.

Of course, a disambiguation facility would be even better,
but I am afraid FPC developers will resist this improvement :(

-- 
Alexander S. Klenin




More information about the Lazarus mailing list