Technical Program
  Invited Speakers
  Technical Papers
  Practitioner Reports
Educators' Symposium
Doctoral Symposium
Student Research Comp.
Turing Lecture
Social Events
Week at a Glance
Final Program (1.5M .pdf)

Find in Program


view, help

"Practical Predicate Dispatch"
Object-Oriented Programming, Systems, Languages and Applications
Home    Program    Housing & Transportation    Registration    Submissions    Wiki    Maps
  > Technical Program > Technical Papers > Languages

 : Thursday

Practical Predicate Dispatch

Ballroom A-B
Thursday, 10:30, 30 minutes


Todd Millstein, University of California, Los Angeles

Predicate dispatch is an object-oriented (OO) language mechanism for declaratively determining the method implementation to be invoked upon a message send. With predicate dispatch, each method implementation includes a predicate guard specifying the conditions under which the method should be invoked, and logical implication of predicates determines the method overriding relation. Predicate dispatch naturally unifies and generalizes disparate forms of dynamic dispatch, including traditional OO dispatch, multimethod dispatch, and functional-style pattern matching. Despite the promise of predicate dispatch, prior languages supporting predicate dispatch have had several deficiencies that limit its utility in practice.

We introduce JPred, a practical, backward-compatible extension to Java supporting predicate dispatch. While prior languages with predicate dispatch have been extensions to toy or non-mainstream languages, we show how predicate dispatch can be naturally added to a traditional OO language. While prior languages with predicate dispatch have required the whole program to be available for typechecking and compilation, JPred retains Java's encapsulation properties and modular typechecking and compilation strategies. While prior languages with predicate dispatch have devised special-purpose algorithms for reasoning about predicates, JPred employs general-purpose, off-the-shelf decision procedures. As a result, JPred's type system is more flexible, allowing several useful programming idioms that are spuriously rejected by those other languages. After describing the JPred language and type system, we present a case study illustrating the utility of JPred in a real-world application, including its use in the detection of several bugs.