[fpc-devel] FPC 3.0.0 class property default

Sven Barth pascaldragon at googlemail.com
Sat Oct 31 15:19:58 CET 2015


Am 31.10.2015 12:40 schrieb "Mark Morgan Lloyd" <
markMLl.fpc-devel at telemetry.co.uk>:
>
> Mark Morgan Lloyd wrote:
>>
>> Up to and including 2.6.4, this works:
>>
>>         TRoundRobin= CLASS(TObject)
>> .
>>                      PUBLIC
>>
>> .
>> (*$IFDEF HAS_TRUE YIELD *)
>>                        PROPERTY HasTrueYield: BOOLEAN DEFAULT TRUE;
>> (*$ELSE         *)
>>                        PROPERTY HasTrueYield: BOOLEAN DEFAULT FALSE;
>> (*$ENDIF        *)
>> .
>>                      END;
>>
>> However using 3.0.0 rc1 I get
>>
>> roundrobin.pas(80,55) Fatal: Syntax error, "READ" expected but
"identifier DEFAULT" found
>>
>> It looks as though this was coded for a facility that wasn't actually
used, but that the intention was to convert a compile-time conditional into
something that could be incorporated into an ordinary boolean expression.
>>
>> What is the correct syntax, and how far back is FPC compatible with it?
>
>
> Anybody got any thoughts on this please?

I answered already on 27th October. In case you missed it here's my answer
again:

A property must have at least a read or a write accessor if it isn't
inherited, so you need to add at least one of them. Since that is the
standard form for properties FPC supports this since the "default" keyword
for properties is supported.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151031/0fd00b74/attachment.html>


More information about the fpc-devel mailing list