Multi-methods in a statically-typed programming language
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.
Keywordsobject-oriented multi-methods static-typing polymorphism contravariance
Unable to display preview. Download preview PDF.
- Cook W, 1989. A proposal for making Eiffel type safe, in Cook S (Ed), ECOOP 89, Cambridge University Press, pp 57–70.Google Scholar
- Field A J, Harrison P G, 1988. Functional Programming, Addison-Wesley.Google Scholar
- Goldberg A, Robson D, 1983. Smalltalk 80: The Language and its Implementation, Addison-Wesley.Google Scholar
- Halbert D C, O'Brien P D, 1987. Using types and inheritance in object-oriented programming, IEEE Software, September 1987, pp71–79.Google Scholar
- Hamer J, Hosking J G, Mugridge W B, 1989. Knowledge-based systems for representing codes of practice, Report 48, Department of Computer Science, University of Auckland, New Zealand.Google Scholar
- Hamer J, 1990a. Expert Systems for codes of practice, PhD Thesis, Department of Computer Science, University of Auckland, New Zealand.Google Scholar
- Hamer J, 1990b. Class Language runtime system: detailed specification, BRANZ Contract 85-024, Technical Report No. 9, Department of Computer Science, University of Auckland, New Zealand.Google Scholar
- Hosking J G, Hamer J, Mugridge W B, 1990. Integrating functional and object-oriented programming, Procs. Pacific Tools 80 Conference, Sydney, Australia, November 1990.Google Scholar
- Keene S E, 1989. Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS, Addison-Wesley, 1989.Google Scholar
- Meyer B, 1988. Object-Oriented Software Construction, Prentice Hall.Google Scholar
- Mugridge W B, Hosking J G, Hamer J, 1990. Functional extensions to an object-oriented programming language, Report No. 49, Department of Computer Science, University of Auckland, New Zealand.Google Scholar
- Mugridge W B, Hamer J, Hosking J G, 1991a. The semantics of multivariant functions, in preparation.Google Scholar
- Mugridge W B, Hamer J, Hosking J G, 1991b. Type loss in statically-typed object-oriented proghramming languages, in preparation.Google Scholar