[mercury-users] Type inheritance?
bmd at cs.kuleuven.ac.be
Wed Sep 24 16:26:40 AEST 1997
> :- type ut = foo + bar.
> You could use (for example) ++ instead of + and impose the restriction
> that the constructors in foo and bar are disjoint. Even more flexible
> is that the constructors are "compatible", so c(t1) and c(t2) are allowed
> in foo and bar, respectively, iff t1 = t2. Basically, ut is the result
Looks like some of the decisions taken in HAL to me - I should have a
look at NUDE.
> might also want to avoid unions of integers and lists, for example
HAL allows that.
> The implementation of your carefully designed 234 tree data type can
> be affected by some far off declaration which includes it in union
There is probably no need for this long-range effect. It is the module that
defines and uses the union type that is going to pay a price, not the
More information about the users