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

Lukasz Sokol el.es.cr at gmail.com
Wed Aug 3 17:08:35 CEST 2011


On 03/08/2011 14:20, Michael Van Canneyt wrote:
> 

> 
> The On E : Exception do is a Borland hack, which I'm not entirely
> happy with either. They should have forced people to declare the E in
> the function variable block. But since we already have this one, I
> could live with the above. (albeit grudgingly - it puts the door open
> for many other more ugly things).
> 
> Michael.

Except that in the with construct the named alias will not be an
instance of variable, but rather a way of _naming_ it shorter, an _alias_;
I agree that making it a variable will create all sorts of problems
regarding memory management, lifetime management and so on; but
the named alias would only live in the block following the
with, and could be forced to be strong-typed too. Think plaintext substitution
before compilation... 
(and yes if some code tools (not CodeTools ;) or ide's have a problem with the
'with' as it is now, THEY should be fixed).

L.





More information about the Lazarus mailing list