MultiJava: modular open classes and symmetric multiple dispatch for Java

  • Authors:
  • Curtis Clifton;Gary T. Leavens;Craig Chambers;Todd Millstein

  • Affiliations:
  • Department of Computer Science, Iowa State University, 226 Atanasoff Hall, Ames, IA;Department of Computer Science, Iowa State University, 226 Atanasoff Hall, Ames, IA;Department of Computer Science and Engineering, University of Washington, Box 352350, Seattle, WA;Department of Computer Science and Engineering, University of Washington, Box 352350, Seattle, WA

  • Venue:
  • OOPSLA '00 Proceedings of the 15th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
  • Year:
  • 2000

Quantified Score

Hi-index 0.01

Visualization

Abstract

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 n compilation scheme that operates modularly and incurs performance overhead only where open classes or multiple dispatching are actually used.