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

Michael Fuchs freepascal at ypa-software.de
Wed Aug 3 16:09:09 CEST 2011


Am 03.08.2011 15:53, schrieb Mark Morgan Lloyd:
> with const a = MyCompomentList[0] do begin
> Rectangle(0, 0, a.Width, a.Height);
> end;

What is wrong with the existing solution, declaring a variable a and use it?

var
   a: TComponent;

  ...

a := MyCompomentList[0];
Rectangle(0, 0, a.Width, a.Height);


And I agree: switching the with off in compiler settings would a nice 
feature.

Michael




More information about the Lazarus mailing list