[fpc-devel] (class) helper questions
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Mar 20 12:23:34 CET 2011
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.
Jonas
More information about the fpc-devel
mailing list