next up previous contents
Next: Pattern matching Up: Concrete differences Previous: Tuples   Contents

Unions

Union are more closely related to ML's datatypes then to C's unions. The basic difference is that Gont compiler remembers which member is currently stored in union.

Unions are defined as:

        union exp {
                int Const;
                string Var;
                *[exp, exp] Add;
                *[exp, exp] Sub;
                *[exp, exp] Mul;
                *[exp, exp] Div;
        }

This union can be later on used for processing symbolic expressions. You can access union components only using pattern matching (there is no `.' notation).

[[Unions? Nope... not yet]]



Micha³ Moskal 2001-11-29