Affiliation:
1. University of California, Los Angeles, Los Angeles, CA
Abstract
Predicate dispatch
is an object-oriented (OO) language mechanism for 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 several common forms of dynamic dispatch, including traditional OO dispatch, multimethod dispatch, and functional-style pattern matching. Unfortunately, prior languages supporting predicate dispatch have had several deficiencies that limit the practical utility of this language feature.
We describe JPred, a backward-compatible extension to Java supporting predicate dispatch. While prior languages with predicate dispatch have been extensions to toy or nonmainstream 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 modular typechecking and compilation strategies. While prior languages with predicate dispatch have included 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 informally, we present an extension to Featherweight Java that formalizes the language and its modular type system, which we have proven sound. Finally, we discuss two case studies that illustrate the practical utility of JPred, including its use in the detection of several errors.
Funder
Division of Computing and Communication Foundations
Publisher
Association for Computing Machinery (ACM)
Reference64 articles.
1. Static type checking of multi-methods
2. Arnold K. Gosling J. and Holmes D. 2005. The Java Programming Language 4th ed. Prentice Hall. Arnold K. Gosling J. and Holmes D. 2005. The Java Programming Language 4th ed. Prentice Hall.
Cited by
11 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Modularity and optimization in synergy;Proceedings of the 15th International Conference on Modularity;2016-03-14
2. Trace-based debugging for advanced-dispatching programming languages;Proceedings of the 10th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems;2015-07-04
3. Reusing metadata across components, applications, and languages;Science of Computer Programming;2015-02
4. AspectBreeze: integrating trustworthiness aspects into graph grammar supported architecture description language;Proceedings of the 6th Asia-Pacific Symposium on Internetware on Internetware - INTERNETWARE 2014;2014
5. Abstraction over implementation structure with symmetrically encapsulated multimethods;Science of Computer Programming;2013-07