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

Sven Barth pascaldragon at googlemail.com
Sun Mar 17 18:17:18 CET 2013


On 17.03.2013 15:29, Jonas Maebe wrote:
>
> 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.

As I just wrote in another mail: what about "absolute". It might read 
strange at first with a more complicated expression on the right hand 
side, but it would express the concept of "this refers to the same".

Regards,
Sven




More information about the fpc-pascal mailing list