Maurice Lombardi wrote:
... snip ...
The only problem I see is the restriction by pascal to only one case variant in a record. I suppose C has no restriction on the number of union inside a struct. This can be solved only by some extra types.
Is this really so? There is the requirement that fixed components precede variant components, but AFAIK there is no limitation on nesting.
Isn't the following legal?
TYPE x = RECORD a : integer; CASE b : char OF 'B': (b1 : fubar); 'C': CASE c1 : char OF 'c': (c2 : foo); END; (* CASE c1 *) 'D': CASE d1 : char OF 'd': (d2 : bar); END; (* CASE d1 *) END; (* CASE b *) (* e : integer; WOULD BE ILLEGAL here *) END; (* RECORD x *)
The names have to be distinct, and the compiler must be able to infer a fixed offset for any component name.