Frank Heckenbach wrote:
BTW, apart from the syntax, the topic reminds me of another thing. For some time, I've had the idea of extensible enum types (unlike with records, there's currently no alternative in GPC, except using integer constants, of course). Even if you have no "forks", that would be useful across modules (where you can't always declare the largest type first, and the other ones as subranges).
Something like this ?
TYPE Enum0 = (e0, e1, e2); Enum1 = (( Enum0) e3, e4)
So, if we have two variables:
VAR V0: Enum0; V1: Emum1;
the rules of compatibilty would allow the assignment
V0:=V1
but the compiler would have to do a (optional) range check to be sure that a actual value of V1 is within the range of Enum0 ?
I like the idea.
I don't know if any dialect has something like this. If not, and we'd make up something new, maybe we could use a common (or similar) syntax with extensible records ...
Frank suggested Record (), which has the right style and serves the purpose:
T = RECORD () x, y: INTEGER END; T0 = RECORD (T) z: REAL END; T1 = RECORD (T) w: LONGREAL END;
Regards,
Adriaan van Os