Abstract
In previous work, we presented rules for defining overloaded functions that ensure type safety under symmetric multiple dispatch in an object-oriented language with multiple inheritance, and we showed how to check these rules without requiring the entire type hierarchy to be known, thus supporting modularity and extensibility. In this work, we extend these rules to a language that supports parametric polymorphism on both classes and functions.
In a multiple-inheritance language in which any type may be extended by types in other modules, some overloaded functions that might seem valid are correctly rejected by our rules. We explain how these functions can be permitted in a language that additionally supports an exclusion relation among types, allowing programmers to declare "nominal exclusions" and also implicitly imposing exclusion among different instances of each polymorphic type. We give rules for computing the exclusion relation, deriving many type exclusions from declared and implicit ones.
We also show how to check our rules for ensuring the safety of overloaded functions. In particular, we reduce the problem of handling parametric polymorphism to one of determining subtyping relationships among universal and existential types. Our system has been implemented as part of the open-source Fortress compiler.
- Eric Allen, David Chase, Joe Hallett, Victor Luchangco, Jan-Willem Maessen, Sukyoung Ryu, Guy L. Steele Jr., and Sam Tobin-Hochstadt. The Fortress Language Specification Version 1.0, March 2008.Google Scholar
- Eric Allen, J. J. Hallett, Victor Luchangco, Sukyoung Ryu, and Guy L. Steele Jr. Modular multiple dispatch with multiple inheritance. In SAC '07, 2007. Google Scholar
Digital Library
- François Bourdoncle and Stephan Merz. Type checking higher-order polymorphic multi-methods. In POPL '97, 1997. Google Scholar
Digital Library
- Giuseppe Castagna, Giorgio Ghelli, and Giuseppe Longo. A calculus for overloaded functions with subtyping. Information and Computation, 117(1):115--135, 1995. Google Scholar
Digital Library
- Curtis Clifton, Todd Millstein, Gary T. Leavens, and Craig Chambers. MultiJava: Design rationale, compiler implementation, and applications. ACM TOPLAS, 28(3), 2006. Google Scholar
Digital Library
- Derek Dreyer, Robert Harper, and Manuel M. T. Chakravarty. Modular type classes. In POPL '07, 2007. Google Scholar
Digital Library
- James Gosling, Bill Joy, Guy Steele, and Gilad Bracha. The Java Language Specification, Third Edition. Addison-Wesley Longman, Amsterdam, 3 edition, June 2005. Google Scholar
Digital Library
- Andrew J. Kennedy and Benjamin C. Pierce. On decidability of nominal subtyping with variance, September 2006. FOOL-WOOD '07.Google Scholar
- Keunwoo Lee and Craig Chambers. Parameterized modules for classes and extensible functions. In ECOOP '06, 2006. Google Scholar
Digital Library
- Vassily Litvinov. Constraint-based polymorphism in Cecil: Towards a practical and static type system. In OOPSLA '98, 1998. Google Scholar
Digital Library
- Todd Millstein and Craig Chambers. Modular statically typed multimethods. Information and Computation, 175(1):76--118, 2002.Google Scholar
Cross Ref
- Todd David Millstein. Reconciling software extensibility with modular program reasoning. PhD thesis, University of Washington, 2003.Google Scholar
Digital Library
- Martin Odersky. The Scala Language Specification, Version 2.7. EPFL Lausanne, Switzerland, 2009.Google Scholar
- Jeremy G. Siek. A language for generic programming. PhD thesis, Indiana University, Indianapolis, IN, USA, 2005. Google Scholar
Digital Library
- Vincent Simonet and François Pottier. A constraint-based approach to guarded algebraic data types. ACM Trans. Program. Lang. Syst., 29(1):1, 2007. Google Scholar
Digital Library
- Daniel Smith and Robert Cartwright. Java type inference is broken: can we fix it? In OOPSLA '08, 2008. Google Scholar
Digital Library
- P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In POPL '89, 1989. Google Scholar
Digital Library
- Stefan Wehr, Ralf Lommel, and Peter Thiemann. JavaGI: Generalized interfaces for Java. In ECOOP 2007, 2007. Google Scholar
Digital Library
Index Terms
Type checking modular multiple dispatch with parametric polymorphism and multiple inheritance
Recommendations
Type checking modular multiple dispatch with parametric polymorphism and multiple inheritance
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsIn previous work, we presented rules for defining overloaded functions that ensure type safety under symmetric multiple dispatch in an object-oriented language with multiple inheritance, and we showed how to check these rules without requiring the ...
Extending Dylan's type system for better type inference and error detection
ILC '10: Proceedings of the 2010 international conference on LispWhereas dynamic typing enables rapid prototyping and easy experimentation, static typing provides early error detection and better compile time optimization. Gradual typing [26] provides the best of both worlds. This paper shows how to define and ...
COQ mechanization of featherweight fortress with multiple dispatch and multiple inheritance
CPP'11: Proceedings of the First international conference on Certified Programs and ProofsIn object-oriented languages, overloaded methods with multiple dispatch extend the functionality of existing classes, and multiple inheritance allows a class to reuse code in multiple classes. However, both multiple dispatch and multiple inheritance ...







Comments