Presentation Title: Implementation of Multiple Dispatch for Java
Committee:
- Dr. Baumgartner(chair)
- Dr. Brygg Ullmer
- Dr. Doris Carver
Date: December 10, 2008
Time: 2:00 PM
Location: Room 256,Coates Hall
Abstract:
We propose adding support for multiple dispatch to the standard Java programming language. On method invocation, multiple dispatch allows the run-time types of all the parameters of the method to participate in the method selection, as opposed to single dispatch in which only the run-time type of the receiver participates in method selection. This technique is useful when a method has to be dispatched on multiple parameters or if a new traversal is to be added to a data structure without modifying the existing code. The use of multimethods in these cases makes the code less error prone and it proves to be more efficient and more flexible than the visitor design pattern in solving the expression problem.
We discuss why this approach is more elegant in providing a solution to the Expression Problem. We discuss the design decisions that were made at every phase of the compiler, which includes discussions about the keywords that are to be added to the lexical analyzer, type-checking for ambiguity and incompleteness errors, and code generation. Our approach differs from existing approaches in that it allows type-safe dispatch on interface types by performing a package-wide type check. We describe our implementation of multiple dispatch in lexical analyzer, parser, and semantic analyzer for methods involving class types. This approach is evaluated by comparing it against existing approaches by using an example
All are invited.