MultiJava: Modular open classes and symmetric multiple dispatch for Java

Citation
C. Clifton et al., MultiJava: Modular open classes and symmetric multiple dispatch for Java, ACM SIGPL N, 35(10), 2000, pp. 130-145
Citations number
30
Categorie Soggetti
Computer Science & Engineering
Journal title
ACM SIGPLAN NOTICES
ISSN journal
15232867 → ACNP
Volume
35
Issue
10
Year of publication
2000
Pages
130 - 145
Database
ISI
SICI code
1523-2867(200010)35:10<130:MMOCAS>2.0.ZU;2-5
Abstract
We present MultiJava, a backward-compatible extension to Java supporting op en classes and symmetric multiple dispatch. Open classes allow one to add t o the set of methods that an existing class supports without creating disti nct subclasses or editing existing code. Unlike the "Visitor" design patter n, open classes do not require advance planning, and open classes preserve the ability to add new subclasses modularly and safely. Multiple dispatch o ffers several well-known advantages over the single dispatching of conventi onal object-oriented languages, including a simple solution to some kinds o f "binary method" problems. MultiJava's multiple dispatch retains Java's ex isting 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 ov erhead only where open classes or multiple dispatching are actually used.