[fpc-pascal] with statement using mulltiple objects

Giuliano Colla giuliano.colla at fastwebnet.it
Tue Sep 16 12:54:01 CEST 2014


Il 16/09/2014 12:26, Philippe ha scritto:
>
> could the compiler avoid "with" pitfalls?
>

The "with" construct can be very handy, but should be used with caution, 
like a lot of other constructs, declarations, etc. E.g. for symbols 
present with the same name in different units, depending on the order of 
the uses declaration the one or the other will be picked up.

The IDE codetools provide already a powerful checking tool: you stop 
with the cursor on a symbol, and it tells you which reference will be taken.
More than that would be an overkill: if you don't take the time to 
verify that your "with" does what you expect, you can't blame neither 
the construct nor the compiler.

Just my 5 cents

Giuliano






More information about the fpc-pascal mailing list