[Lazarus] 'with' is evil, isn't it?
Alexander Klenin
klenin at gmail.com
Wed Aug 3 14:00:37 CEST 2011
On Wed, Aug 3, 2011 at 22:34, Michael Van Canneyt
<michael at freepascal.org> wrote:
>
>> Of course, a disambiguation facility would be even better,
>> but I am afraid FPC developers will resist this improvement :(
>
> Frankly, I don't understand the discussion.
> I use 'with' all the time because it increases readability and reduces
> typing.
Agreed.
> I don't want to be punished with heaps of warnings simply because I use a
> language feature. Yes, I am aware that there are risks involved.
This is why I suggested to restrict warnings only to a cases
where actual ambiguity exists, which is actually quite rare.
Maybe even warning is too much, and it should be a hint.
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;
No chance of ambiguity at all.
--
Alexander S. Klenin
More information about the Lazarus
mailing list