[fpc-pascal] a proposal about "with" syntax
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Mar 17 15:29:31 CET 2013
On 17 Mar 2013, at 15:02, Luca Olivetti wrote:
> Al 17/03/13 13:54, En/na Marco van de Voort ha escrit:
>> In our previous episode, Sven Barth said:
>>>>
>>>> Texas Instruments' Pascal had an extension of the with statement, IIRC
>>>> it used = instead of AS
>>>>
>>>> With a=VeryLongNameForARecord, b=AnotherRecordWithAVeryLongName do ...
>>>
>>> Now THAT is really unpascalish... either ":=" or the already suggested
>>> "as"...
>>
>> Since it is a pseudo variable declaration, I would assume VAR syntax and
>> just use ":" ?
>
> That would be consistent with "On E:Exception do writeln(E.message)".
No, because "On E: Exception" says that "E" is of the type "Exception", just like in a variable declaration the expression after the colon also identifies the type. Here it's not about defining the type, but about making a symbol equivalent to repeating a non-type expression. So "=" from symbolic constant declarations would probably be closest. I think ":=" is less good, because ":=" implies that a copy or an assignment is made rather than an equivalence is defined, and hence changes to that copy could be assumed lost afterwards in case of records or objects, which would not be the case.
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130317/9eb3be2e/attachment.html>
More information about the fpc-pascal
mailing list