[fpc-devel] (class) helper questions

Sven Barth pascaldragon at googlemail.com
Mon Mar 14 21:07:46 CET 2011


On 09.03.2011 02:17, Paul Ishenin wrote:
>> 4. The syntax that was introduced by Borland is not very pascalish in my
>> opinion. So I'd like to change the syntax for mode ObjFPC a bit (sadly
>> this won't simplify the parser anymore because of the Delphi
>> compatibility).
>>
>> Delphi syntax:
>>
>> TypeIdentifier = class|record helper(ParentHelper) for ExtendedType
>>
>> Proposed FPC syntax:
>>
>> TypeIdentifier = helper(ParentHelper) for class|record ExtendedType
>>
>> What do you think? Maybe also the "class|record" part can be left out,
>> because this part is not saved in the objectdef and can be determined by
>> the compiler automatically.
>
> I always think that if there is no need to create an incompatibility -
> better to not create it. But my ideas often does not get support of
> other FPC developers.

I have tought about this topic a bit more. On the one hand I still want 
a cleaner syntax for this, but on the other hand I also understand that 
others want to have the ability to use "objfpc" code in Delphi with as 
less ifdefs as possible (or the other way round).

So what about the following compromise:
I will add my proposed syntax, but the Delphi compatible one can be 
activated with a mode switch (which will be enabled by default in mode 
Delphi).
And if you really insist very hard to have mode ObjFPC compatible with 
mode Delphi, I can also live with the switch meaning "enable non 
compatible syntax" and being disabled by default.

I plan to do something similar when RTTI attributes are implemented 
(either by me or someone else) as well, so the modeswitch will have its 
use there, too.

Regards,
Sven



More information about the fpc-devel mailing list