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

Michael Van Canneyt michael at freepascal.org
Wed Aug 3 15:20:20 CEST 2011



On Wed, 3 Aug 2011, Graeme Geldenhuys wrote:

> On 08/03/2011 02:00 PM, Alexander Klenin wrote:
>> Anyway, my preferred solution would be to allow aliases in 'with' statement,
>> which would improve readability even further while sacrificing only a
>> few characters:
>>
>> with a := MyCompomentList[0] do begin
>>   Rectangle(0, 0, a.Width, a.Height);
>> end;
>
>
> A simple solution to something which I don't think is a problem either.
> [I fully agree with Michael van Canneyt here]

I agree the above is indeed an acceptable solution.

But I do think it is a corner case, because it goes against pascal philosophy 
which says that all identifiers must be declared prior to being used.

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.




More information about the Lazarus mailing list