Clifton, Curtis, Leavens, Gary T., Chambers, Craig and Millstein, Todd (2000) MultiJava: Modular Open Classes and Symmetric Multiple Dispatch for Java. Technical Report TR00-06a, Department of Computer Science, Iowa State University.
MultiJava: Modular Open Classes and Symmetric Multiple Dispatch for Java
Curtis Clifton, Gary T. Leavens, Craig Chambers, and Todd Millstein
We present MultiJava, a backward-compatible extension to Java
supporting open classes and symmetric multiple dispatch. Open classes
allow one to add to the set of methods that an existing class supports
without creating distinct subclasses or editing existing code. Unlike
the "Visitor" design pattern, open classes do not require
advance planning, and open classes preserve the ability to add new
subclasses modularly and safely. Multiple dispatch offers several
well-known advantages over the single dispatching of conventional
object-oriented languages, including a simple solution to some kinds
of "binary method" problems. MultiJava's multiple dispatch
retains Java's existing class-based encapsulation properties. We
adapt previous theoretical work to allow compilation units to be
statically typechecked modularly and safely, ruling out any link-time
or run-time type errors. We also present a novel compilation scheme
that operates modularly and incurs performance overhead only where
open classes or multiple dispatching are actually used.
Keywords: Open classes, open objects, extensible classes, extensible
external methods, external methods, multimethods, generic functions,
object-oriented programming languages, single dispatch, multiple
dispatch, encapsulation, modularity, static typechecking, subtyping,
inheritance, Java language, MultiJava language, separate compilation.
1999 CR Categories:
D.1.5 [Programming Techniques] Object-oriented programming;
D.3.2 [Programming Languages] Language Classifications ---
D.3.3 [Programming Languages] Language Constructs and Features ---
abstract data types, classes and objects,
control structures, inheritance, modules, packages, patterns,
procedures, functions, and subroutines;
D.3.4 [Programming Languages] Processors --- compilers;
D.3.m [Programming Languages] Miscellaneous ---
open classes, multimethods, generic functions.
Copyright (c) ACM, 2000. To appear in OOPSLA 2000.
Permission to make digital or hard copies of this work for personal or
classroom use is granted without fee provided that copies are not made
or distributed for profit or commercial advantage and that copies bear
this notice and the full citation on the first page. To copy
otherwise, or republish, to post on servers or to redistribute to
lists, requires prior specific permission and/or a fee.
Contact site administrator at: email@example.com