skip to main content
research-article

Getting F-bounded polymorphism into shape

Published:09 June 2014Publication History
Skip Abstract Section

Abstract

We present a way to restrict recursive inheritance without sacrificing the benefits of F-bounded polymorphism. In particular, we distinguish two new concepts, materials and shapes, and demonstrate through a survey of 13.5 million lines of open-source generic-Java code that these two concepts never actually overlap in practice. With this Material-Shape Separation, we prove that even naïve type-checking algorithms are sound and complete, some of which address problems that were unsolvable even under the existing proposals for restricting inheritance. We illustrate how the simplicity of our design reflects the design intuitions employed by programmers and potentially enables new features coming into demand for upcoming programming languages.

References

  1. Franz Baader and Wayne Snyder. Unification theory. Handbook of Automated Reasoning, 1:445--532, 2001.Google ScholarGoogle ScholarCross RefCross Ref
  2. Kim B Bruce, Martin Odersky, and Philip Wadler. A statically safe alternative to virtual types. In ECOOP, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. The Ceylon language specification, version 1.0. ceylon-lang.org/documentation/1.0/spec/, November 2013.Google ScholarGoogle Scholar
  4. Peter S. Canning, William R. Cook, Walter L. Hill, Walter G. Olthoff, and John C. Mitchell. F-bounded polymorphism for object-oriented programming. In FPCA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Erik Ernst. Family polymorphism. In ECOOP, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. James Gosling, Bill Joy, Guy Steele, and Gilad Bracha. The Java#8482; Language Specification. Addison-Wesley Professional, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Benjamin Greenman, Fabian Muehlboeck, and Ross Tate. Getting F-bounded polymorphism into shape. Technical report, Cornell University, March 2014.Google ScholarGoogle Scholar
  8. Anders Hejlsberg, Scott Wiltamuth, and Peter Golde. C# Language Specification. Addison-Wesley Longman Publishing Co., Inc., 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Shan Shan Huang, David Zook, and Yannis Smaragdakis. cJ: Enhancing Java with safe type conditions. In AOSD, 2007.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Atsushi Igarashi and Benjamin C. Pierce. Foundations for virtual types. In ECOOP, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Andrew J. Kennedy and Benjamin C. Pierce. On decidability of nominal subtyping with variance. In FOOL, 2007.Google ScholarGoogle Scholar
  12. Bent Bruun Kristensen, Ole Lehrmann Madsen, Birger Møller-Pedersen, and Kristen Nygaard. Abstraction mechanisms in the BETA programming language. In POPL, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Ole Lehrmann Madsen and Birger Møller-Pedersen. Virtual classes - a powerful mechanism in object-oriented programming. In OOPSLA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Robin Milner, Lockwood Morris, and Malcolm Newey. A Logic for Computable Functions with Reflexive and Polymorphic Types. Department of Computer Science, University of Edinburgh, 1975.Google ScholarGoogle Scholar
  15. Martin Odersky. The Scala language specification, version 2.9, March 2014.Google ScholarGoogle Scholar
  16. Martin Odersky and Matthias Zenger. Scalable component abstractions. In OOPSLA, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Benjamin C. Pierce and Martin Steffen. Higher-order subtyping. Theoretical Computer Science, 176(1--2):235--282, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Daniel Smith and Robert Cartwright. Java type inference is broken: Can we fix it? In OOPSLA, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Ross Tate. Mixed-site variance. In FOOL, 2013.Google ScholarGoogle Scholar
  20. Ross Tate, Alan Leung, and Sorin Lerner. Taming wildcards in Java's type system. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Ewan Tempero, Craig Anslow, Jens Dietrich, Ted Han, Jing Li, Markus Lumpe, Hayden Melton, and James Noble. Qualitas Corpus: A curated collection of Java code for empirical studies. In APSEC, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Ricardo Terra, Luis Fernando Miranda, Marco Tulio Valente, and Roberto S. Bigonha. Qualitas.class Corpus: A compiled version of the Qualitas Corpus. Software Engineering Notes, 38(5):1--4, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Kresten Krab Thorup. Genericity in Java with virtual types. In ECOOP, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  24. Kresten Krab Thorup and Mads Torgersen. Unifying genericity - combining the benefits of virtual types and parameterized classes. In ECOOP, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Mads Torgersen. Virtual types are statically safe. In FOOL, 1998.Google ScholarGoogle Scholar
  26. Mads Torgersen, Christian Plesner Hansen, Erik Ernst, Peter von der Ahé, Gilad Bracha, and Neal M. Gafter. Adding wildcards to the Java programming language. In SAC, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Mirko Viroli. On the recursive generation of parametric types. Technical Report DEIS-LIA-00-002, University of Bologna, Italy, September 2000.Google ScholarGoogle Scholar
  28. Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad-hoc. In POPL, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Stefan Wehr, Ralf Lämmel, and Peter Thiemann. JavaGI: Generalized interfaces for Java. In ECOOP, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Getting F-bounded polymorphism into shape

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!