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

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Aug 2 22:31:55 CEST 2011


Marcos Douglas schrieb:
> 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.

No chance. The syntax doesn't allow for
   <identifier> <identifier> "." ...

DoDi





More information about the Lazarus mailing list