[fpc-pascal] a proposal about "with" syntax

Xiangrong Fang xrfang at gmail.com
Mon Mar 18 04:16:01 CET 2013


OK, I see. However I feel "=>" a very "un-pascal" thing, remind me of PHP.
:-)   I guess "as" would also complicate the parser?

2013/3/18 Paul Ishenin <paul.ishenin at gmail.com>

> 18.03.13, 9:27, Xiangrong Fang пишет:
>
>  I am sorry I didn't follow this thread although I am the "OP" :-).   If
>> I understand correct, I would suggest NOT introduce the "absolute"
>> keyword, instead, make it ALWAYS absolute. i.e.:
>>
>> with a = SomeObject, b = SomeRecord do begin
>>    ... ...
>> end;
>>
>> Both a and b are "reference" to the object or record, IMO there seems no
>> need to do assignment in the with syntax. Thus, I suggest use = instead
>> of :=
>>
>
> '=' can't be used because it can be a part of expression. There is no big
> difference between
> with (a = SomeObject) do
> and
> with a = SomeObject do
>
> After more thinking I see that ':=' as well as absolute keyword are also
> bad because they will complicate the parser (although it is possible to use
> them). Parser will need to read the first token and check if it is an
> identifier, read second token and compare with ':=' (or 'absolute') and if
> it is not ':=' (or 'absolute') return to expression parse.
>
> At the same time we will not complicate the parser if we place alias
> identifier after the with expression like:
>
> with expression1, expression2 => alias2, expression3, expression4 =>
> alias4 do
>
> begin
>
> end;
>
> Where '=>' is some token which can't be used in expressions.
>
> Best regards,
> Paul Ishenin
>
>
> ______________________________**_________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130318/76f72b56/attachment.html>


More information about the fpc-pascal mailing list