[fpc-devel] (class) helper questions

Sven Barth pascaldragon at googlemail.com
Sun Mar 20 12:31:21 CET 2011


On 20.03.2011 12:23, Jonas Maebe wrote:
>
> On 16 Mar 2011, at 09:30, Sven Barth wrote:
>
>> Am 15.03.2011 19:18, schrieb Alexander Klenin:
>>> IMHO the syntax difference is so small it does not worth all the complications.
>>> However, as a compromise I can suggest inplementing it as:
>>>
>>> TypeIdentifier = [class|record] helper(ParentHelper) for ExtendedType
>>>
>>> i.e. make "class|record" keyword optional in objfpc mode, but do NOT
>>> allow it after "for". This way, objfpc syntax will be
>>> backwards-compatible with Delphi.
>>
>> That idea isn't that bad... (of course Jonas' point of increasing the parser's complexity still holds ^^)
>
> There's also another problem: I don't know whether Delphi currently does this, but in principle if both a class and a record with the same name are in scope (in case of nested types, or simply from different units), depending on whether you use "class helper" or "record helper" one or the other type could be picked by the compiler. Alternatively, it could always choose the first matched type and if it's not respectively a class or a record, the compiler could give an error.
>
> So I think it is really best to stick to the Delphi syntax, and the Delphi syntax only.

I have already decided not to proceed with my idea, but thank you for 
the next point against it. :)

Regards,
Sven



More information about the fpc-devel mailing list