MetaCart Sign in to MyCiteSeerX

Include Citations | Advanced Search | Help

Disambiguated Search | Include Citations | Advanced Search | Help

Parasitic Methods: An Implementation of Multi-Methods for Java (1997) [50 citations — 2 self]

by John Boyland ,  Giuseppe Castagna
Add To MetaCart

Abstract:

In an object-oriented programming language, method selection is (usually) done at run-time using the class of the receiver. Some object-oriented languages (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 definition of binary methods such as structural equality, set inclusion and matrix multiplication, just to name a few. Java as currently defined does not support multimethods. This paper defines 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). Programs using this extension can be translated automatically at the source level into programs that do not; they are modular, type-safe, and allow separate compilation.

Citations

156 Parameterized types for Java – Myers, Bank, et al. - 1997
129 A calculus for overloaded functions with subtyping – Castagna, Ghelli, et al. - 1995
94 Typechecking and modules for multi-methods – Chambers, Leavens - 1995
68 Static type checking of multimethods – Agrawal, DeMichiel, et al. - 1991
62 The Common Lisp Object System: An Overview – DeMichiel, Gabriel - 1987
52 Java is type safe - probably – Drossopoulou, Eisenbach - 1997
47 Object-Oriented Programming: A Unified Foundation – Castagna - 1997
22 Type-Safe Compilation of Covariant Specialization: A Practical Case – Boyland, Castagna - 1996
12 editors. Implementing an ObjectOriented Database System: The – Bancilhon, Delobel, et al. - 1992