Re: Union followed by Property does not compile !
Skybuck Flying <[email protected]> Sun, 14 Aug 2022 02:39:30 -0700 (PDT)
| Newsgroups | alt.comp.lang.borland-delphi |
|---|---|
| Message-ID | <[email protected]> |
The presented solution is inconsistent in two ways:
1. Property of union not possible.
2. Order of field and property violations "field before property" rule.
{
version 0.03 created on 14 august 2022 by Skybuck Flying:
Today I remember the rule which this union field is conflicting with.
The rule: "field before property"
Going to demonstrate it below
There are apperently two problems with this solution:
1. Property of union not possible ?!?
2. Inconsistent language design in respect to standard field + property relation
(order of appearance/declaration)
// ERROR "field definition not allowed after methods or properties" problem 2.
}
type
TDataExample3 = record
// mStandardField : integer; // OK
// normal/standard property
property StandardField : integer read mStandardField write mStandardField;
mStandardField : integer; // ERROR "field definition not allowed after methods or properties" problem 2.
// union property
// property UnionField : int64 read mData write mData; // not possible, problem 1
// union fields
case integer of // INCONSISTENT problem 2
0 : ( mData : int64 );
1 : ( mByte : packed array[0..7] of byte );
// property UnionField : int64 read mData write mData; // not possible, problem 1
end;
Bye,
Skybuck.