[Lazarus] 'with' is evil, isn't it?
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Fri Aug 5 14:04:37 CEST 2011
Sven Barth schrieb:
>> you can see the following example
>>
>> with new_patient: new, old_patient: old do begin
>> new.LastName := 'Smith';
[...]
> Not only the ":" look a bit strange (it remembers me a bit of the
> on-clause in except blocks though), but also - and more importantly -
> the order: first the variable or expression that is to be "shortened"
> and then the new identifier for it.
This IMO is due to LL(1), where optional parts deserve a characteristic
prefix, which can be combined easily with a separator token. Above
snippet would read much more strange as e.g.
with :new new_patient, :old old_patient do begin
It might look clearer as
with new_patient as new, old_patient as old do begin
but most probably the "as" was not already a recognized token in that
language.
DoDi
More information about the Lazarus
mailing list