[Lazarus] 'with' is evil, isn't it?
Marcos Douglas
md at delfire.net
Tue Aug 2 19:26:20 CEST 2011
On Tue, Aug 2, 2011 at 2:21 PM, Hans-Peter Diettrich
<DrDiettrich1 at aol.com> wrote:
> Marcos Douglas schrieb:
>
>> IMHO, 'with' should have an implicit pointer like 'self' (could be
>> 'this' or whatever).
>
> This<g> will fail with nested With's, or a With with multiple expressions.
>
> A nicer syntax would require only an "." for your "this.".
>
>> Eg:
>>
>> procedure TControlDescendant.Paint;
>> begin
>> with Canvas do
>> begin
>> this.Rectangle(0, 0, this.Width, this.Height);
>
> .Rectangle(0,0, .Width, .Height);
>>
>> end;
end;
OK, could be... but not prevents confusion of properties.
On Tue, Aug 2, 2011 at 1:56 PM, Mark Morgan Lloyd
<markMLl.lazarus at telemetry.co.uk> wrote:
> One I've floated elsewhere is to allow with to define an alias with the
> same notation as a constant:
>
> with tsm= TSming(caller^) do begin
> while tsm.Count <= writePos do
> tsm.Append('');
I like it, but FPC's team doesn't will, I think...
Alias already was proposed even to Units but did not approved.
Marcos Douglas
More information about the Lazarus
mailing list