ABSTRACT
A promising approach for type-safe generic codes in the object-oriented paradigm is variant parametric type, which allows covariant and contravariant subtyping on fields where appropriate. Previous approaches formalise variant type as a special case of the existential type system. In this paper, we present a new framework based on flow analysis and modular type checking to provide a simple but accurate model for capturing generic types. Our scheme stands to benefit from past (and future) advances in flow analysis and subtyping constraints. Furthermore, it fully supports casting for variant types with a special reflection mechanism, called cast capture, to handle objects with unknown types. We have built a constraint-based type checker and have proven its soundness. We have also successfully annotated a suite of Java libraries and client code with our flow-based variant type system.
- Ole Agesen. The cartesian product algorithm: Simple and precise type inference of parametric polymorphism. In ECOOP '95: Proceedings of the 9th European Conference on Object-Oriented Programming, pages 2-26, London, UK, 1995. Springer-Verlag.]] Google Scholar
Digital Library
- IC-Parc at Imperial College. ECLiPSe Constraint Logic Programming. http://www.icparc.ic.ac.uk/eclipse/.]]Google Scholar
- Gilad Bracha, Martin Odersky, David Stoutamire, and Philip Wadler. Making the future safe for the past: adding genericity to the Java programming language. In OOPSLA '98: Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 183--200, New York, NY, USA, 1998. ACM Press.]] Google Scholar
Digital Library
- Martin Buchi and Wolfgang Weck. Compound types for Java. In OOPSLA '98: Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 362--373, New York, NY, USA, 1998. ACM Press.]] Google Scholar
Digital Library
- Peter S. Canning, William R. Cook,Walter L. Hill, Walter G. Olthoff, and John C. Mitchell. F-Bounded polymorphism for object-oriented programming. In Conference on Functional Programming Languages and Computer Architecture, pages 273--280, 1989.]] Google Scholar
Digital Library
- Luca Cardelli. Notes about Fω<:. 1994. Available at http://research.microsoft.com/Users/luca/Notes/FwSub.ps.]]Google Scholar
- Luca Cardelli and Peter Wegner. On understanding types, data abstraction, and polymorphism. ACM Comput. Surv., 17(4):471--522, 1985.]] Google Scholar
Digital Library
- Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N.Wegman, and F. Kenneth Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst., 13(4):451--490, 1991.]] Google Scholar
Digital Library
- Adriana Compagnoni Dominic Duggan. Subtyping for object type constructors. In Foundations of Object-Oriented Languages (FOOL 1999), 1999.]]Google Scholar
- Alan Donovan, Adam Kiezun, Matthew S. Tschantz, and Michael D. Ernst. Converting Java programs to use generic libraries. In OOPSLA '04: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 15--34, New York, NY, USA, 2004. ACM Press.]] Google Scholar
Digital Library
- Dominic Duggan. Modular type-based reverse engineering of parameterized types in Java code. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA '99), pages 97--113, 1999.]] Google Scholar
Digital Library
- Burak Emir, Andrew J. Kennedy, Claudio Russo, and Dachuan Yu. Variance and generalized constraints for C# generics. In Proceedings of the 20th European Conference on Object-Oriented Programming (ECOOP), July 2006.]] Google Scholar
Digital Library
- Thom Fruhwirth and et al. Constraint Handling Rules. http://www.cs.kuleuven.ac.be/~dtai/projects/CHR/.]]Google Scholar
- Robert Fuhrer, Frank Tip, Adam Kiezun, Julian Dolby, and Markus Keller. Efficiently refactoring Java applications to use generic libraries. In ECOOP '05: Proceedings of the 19th European Conference on Object-Oriented Programming, July 2005.]] Google Scholar
Digital Library
- Fritz Henglein and Jakob Rehof. The complexity of subtype entailment for simple types. In Proceedings of 12th Symposium on Logic in Computer Science (LICS '97), pages 352--361, June 1997.]] Google Scholar
Digital Library
- Fritz Henglein and Jakob Rehof. Constraint automata and the complexity of recursive subtype entailment for simple type. In Automata, Languages and Programming, 25th International Colloquium, ICALP'98, pages 616--627, 1998.]] Google Scholar
Digital Library
- Atsushi Igarashi and Mirko Viroli. On variance-based subtyping for parametric types. In ECOOP '02: Proceedings of the 16th European Conference on Object-Oriented Programming, pages 441--469, 2002.]] Google Scholar
Digital Library
- Atsushi Igarashi and Mirko Viroli. Variant parametric types: A flexible subtyping scheme for generics. ACM Trans. Program. Lang. Syst., 2006.]] Google Scholar
Digital Library
- Andrew Kennedy and Don Syme. Design and implementation of generics for the .NET common language runtime. In Proceedings of the 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 1--12, 2001.]] Google Scholar
Digital Library
- Karl Mazurak and Steve Zdancewic. Type inference for Java 5: Wildcards, F-Bounds, and Undecidability. 2006. A note available at http://www.cis.upenn.edu/~stevez/note.html.]]Google Scholar
- John C. Mitchell and Gordon D. Plotkin. Abstract types have existential type. ACM Trans. Program. Lang. Syst., 10(3):470--502, 1988.]] Google Scholar
Digital Library
- Bengt Nordstrom, Kent Petersson, and Jan M. Smith. Programming in Martin-Lof's Type Theory. Oxford University Press, 1990.]] Google Scholar
Digital Library
- Martin Odersky, Christoph Zenger, and Matthias Zenger. Colored local type inference. In The 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 41--53, 2001.]] Google Scholar
Digital Library
- Martin Odersky and Matthias Zenger. Scalable component abstractions. In Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2005, pages 41--57, 2005.]] Google Scholar
Digital Library
- Jens Palsberg and Patrick O'Keefe. A type system equivalent to flow analysis. In 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 367--378, 1995.]] Google Scholar
Digital Library
- Jens Palsberg and Christina Pavlopoulou. From polyvariant flow information to intersection and union types. In The 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 197--208, 1998.]] Google Scholar
Digital Library
- Simon Peyton-Jones and et al. Glasgow Haskell Compiler. http://www.haskell.org/ghc.]]Google Scholar
- Benjamin C. Pierce. Bounded quantification is undecidable. Information and Computation, 112(1):131--165, July 1994.]] Google Scholar
Digital Library
- Benjamin C. Pierce. Types and Programming Languages. The MIT Press, 2002.]] Google Scholar
Digital Library
- Benjamin C. Pierce and David N. Turner. Local type inference. In Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 252--265, 1998.]] Google Scholar
Digital Library
- John Plevyak and Andrew A. Chien. Precise concrete type inference for object-oriented languages. In OOPSLA, pages 324--340, 1994.]] Google Scholar
Digital Library
- François Pottier. Simplifying subtyping constraints. In Proceedings of the 1996 ACM SIGPLAN International Conference on Functional Programming (ICFP '96), pages 122--133, 1996.]] Google Scholar
Digital Library
- Martin Steffen. Polarized Higher-Order Subtyping. PhD thesis, Universitat Erlangen-Nurnberg, 1997.]]Google Scholar
- Zhendong Su, Alexander Aiken, Joachim Niehren, Tim Priesnitz, and Ralf Treinen. The first-order theory of subtyping constraints. In The 29th SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 203--216, 2002.]] Google Scholar
Digital Library
- Kresten Krab Thorup and Mads Torgersen. Unifying genericity - combining the benefits of virtual types and parameterized classes. In ECOOP'99 - Object-Oriented Programming, 13th European Conference, pages 186--204, 1999.]] Google Scholar
Digital Library
- Mads Torgersen, Erik Ernst, and Christian Plesner Hansen. Wild FJ. In Foundations of Object-Oriented Languages (FOOL 2005), Long Beach, CA, January 2005.]]Google Scholar
- Mads Torgersen, Erik Ernst, Christian Plesner Hansen, Peter von der Ahé, Gilad Bracha, and Neal M. Gafter. Adding Wildcards to the Java programming language. Journal of Object Technology, 3(11):97--116, 2004.]]Google Scholar
Cross Ref
- Valery Trifonov and Scott F. Smith. Subtyping constrained types. In Static Analysis, Third International Symposium, SAS'96, pages 349--365, 1996.]] Google Scholar
Digital Library
- Mirko Viroli and Antonio Natali. Parametric polymorphism in java: an approach to translation based on reflective features. In Proceedings of the 2000 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2000), pages 146--165, 2000.]] Google Scholar
Digital Library
- Daniel von Dincklage and Amer Diwan. Converting Java classes to use generics. In Proceedings of the 19th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 1--14, 2004.]] Google Scholar
Digital Library
- Tiejun Wang and Scott F. Smith. Precise constraint-based type inference for java. In ECOOP '01: Proceedings of the 15th European Conference on Object-Oriented Programming, pages 99--117, 2001.]] Google Scholar
Digital Library
Index Terms
A flow-based approach for variant parametric types
Recommendations
A flow-based approach for variant parametric types
Proceedings of the 2006 OOPSLA ConferenceA promising approach for type-safe generic codes in the object-oriented paradigm is variant parametric type, which allows covariant and contravariant subtyping on fields where appropriate. Previous approaches formalise variant type as a special case of ...
Variant parametric types: A flexible subtyping scheme for generics
We develop the mechanism of variant parametric types as a means to enhance synergy between parametric and inclusion polymorphism in object-oriented programming languages. Variant parametric types are used to control both the subtyping between different ...
Understanding access restriction of variant parametric types and Java wildcards
SAC '05: Proceedings of the 2005 ACM symposium on Applied computingVariant parametric types [8] have been introduced to provide a flexible subtyping mechanism for generic types, and are recently being developed into Java wildcards [15], shipped worldwide with the JDK 1.5 release. The two approaches, which are strictly ...







Comments