Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-10

FPC 3.0.0 class property default

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

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?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Ondrej Pokorny
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 26 lines
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?

IMO
* PROPERTY HasTrueYield DEFAULT TRUE; ** ***
Ondrej

Reply by email

Ondrej Pokorny
to Ondrej Pokorny
Ondrej Pokorny wrote
* PROPERTY HasTrueYield DEFAULT TRUE; ** *

But then there has tobe a property to override.

What do you use
PROPERTY HasTrueYield: BOOLEAN DEFAULT TRUE;
for?

In 2.6.4 you cannot read this property. Is it useful for RTTI?

Ondrej

Reply by email

Sven Barth
to Mark Morgan Lloyd: Up to and including 2.6.4, this works: TRoundRobin= CLASS(TObject) .. PUBLIC .. (*$IFDEF…

Am 27.10.2015 12:30 schrieb "Mark Morgan Lloyd" <

: What is the correct syntax, and how far back is FPC compatible with it?

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

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd: Up to and including 2.6.4, this works: TRoundRobin= CLASS(TObject) .. PUBLIC .. (*$IFDEF…
Mark Morgan Lloyd wrote 25 lines
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?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Sven Barth
to Mark Morgan Lloyd

Am 31.10.2015 12:40 schrieb "Mark Morgan Lloyd" <

Show quoted text 22 lines
: 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.

Show quoted text 5 lines
> > 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

Reply by email