Abstract:
Multivariant functions in Kea are a statically-typed form of the multi-methods of CLOS (Keene,
1989) but encapsulation is retained. Multivariants permit fine typing distinctions to be made,
allow despatching to be avoided in some cases, and may be used to avoid some restrictions of
the contravariance rule.
Once multivariant functions are introduced by example, the semantics of the despatch of
multivariants are provided, based on the generation of despatching variants. Three issues arise
with despatching: redundancy, ambiguity, and exhaustiveness of a (partially-ordered) set of
variants with respect to a function call. It is shown that the approach taken here is consistent
with separate compilation.