Sciweavers

OOPSLA
1997
Springer

Parasitic Methods: An Implementation of Multi-Methods for Java

14 years 3 months ago
Parasitic Methods: An Implementation of Multi-Methods for Java
In an object-oriented programming language, method selection is (usually) done at run-time using the class of the receiver. Some object-orientedlanguages(such as CLOS) have multi-methods which comprise several methods selected on the basis of the run-time classes of all the parameters, not just the receiver. Multi-methods permit intuitive and typesafe de nition of binary methods such as structural equality, set inclusion and matrix multiplication, just to name a few. Java as currently de ned does not support multimethods. This paper de nes a simple extension to Java that enables the writing of \encapsulated" multi-methods through the use of parasitic methods, methods that \attach" themselves to other methods. Encapsulated multi-methods avoid some of the modularity problems that arise with fully general multi-methods. Furthermore, this extension yields for free both covariant and contravariant specialization of methods (besides Java's current invariant specialization). P...
John Boyland, Giuseppe Castagna
Added 08 Aug 2010
Updated 08 Aug 2010
Type Conference
Year 1997
Where OOPSLA
Authors John Boyland, Giuseppe Castagna
Comments (0)