skip to main content

A path to DOT: formalizing fully path-dependent types

Published:10 October 2019Publication History
Skip Abstract Section

Abstract

The Dependent Object Types (DOT) calculus aims to formalize the Scala programming language with a focus on path-dependent types — types such as x.a1an.T that depend on the runtime value of a path x.a1an to an object. Unfortunately, existing formulations of DOT can model only types of the form x.A which depend on variables rather than general paths. This restriction makes it impossible to model nested module dependencies. Nesting small components inside larger ones is a necessary ingredient of a modular, scalable language. DOT’s variable restriction thus undermines its ability to fully formalize a variety of programming-language features including Scala’s module system, family polymorphism, and covariant specialization.

This paper presents the pDOT calculus, which generalizes DOT to support types that depend on paths of arbitrary length, as well as singleton types to track path equality. We show that naive approaches to add paths to DOT make it inherently unsound, and present necessary conditions for such a calculus to be sound. We discuss the key changes necessary to adapt the techniques of the DOT soundness proofs so that they can be applied to pDOT. Our paper comes with a Coq-mechanized type-safety proof of pDOT. With support for paths of arbitrary length, pDOT can realize DOT’s full potential for formalizing Scala-like calculi.

Skip Supplemental Material Section

Supplemental Material

a145-rapoport

Presentation at OOPSLA '19

References

  1. Nada Amin, Samuel Grütter, Martin Odersky, Tiark Rompf, and Sandro Stucki. 2016. The Essence of Dependent Object Types. In A List of Successes That Can Change the World - Essays Dedicated to Philip Wadler on the Occasion of His 60th Birthday. 249–272.Google ScholarGoogle Scholar
  2. Nada Amin, Adriaan Moors, and Martin Odersky. 2012. Dependent Object Types. In International Workshop on Foundations of Object-Oriented Languages (FOOL 2012).Google ScholarGoogle Scholar
  3. Nada Amin and Tiark Rompf. 2017. Type soundness proofs with definitional interpreters. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017. 666–679.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Nada Amin, Tiark Rompf, and Martin Odersky. 2014. Foundations of path-dependent types. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2014, part of SPLASH 2014, Portland, OR, USA, October 20-24, 2014. 233–249.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Nada Amin and Ross Tate. 2016. Java and Scala’s type systems are unsound: the existential crisis of null pointers. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, part of SPLASH 2016, Amsterdam, The Netherlands, October 30 - November 4, 2016. 838–848.Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Kim B. Bruce, Martin Odersky, and Philip Wadler. 1998. A Statically Safe Alternative to Virtual Types. In ECOOP’98 -Object-Oriented Programming, 12th European Conference. 523–549.Google ScholarGoogle Scholar
  7. Dave Clarke, Sophia Drossopoulou, James Noble, and Tobias Wrigstad. 2007. Tribe: a simple virtual class calculus. In Proceedings of the 6th International Conference on Aspect-Oriented Software Development, AOSD 2007, Vancouver, British Columbia, Canada, March 12-16, 2007. 121–134.Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Vincent Cremet, François Garillot, Sergueï Lenglet, and Martin Odersky. 2006. A Core Calculus for Scala Type Checking. In Mathematical Foundations of Computer Science, 31st International Symposium, Slovakia.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Scala Documentation. 2018. Paths. Retrieved February 26, 2019 from https://www.scala- lang.org/files/archive/spec/2.11/03-types.html#pathsGoogle ScholarGoogle Scholar
  10. Derek Dreyer, Karl Crary, and Robert Harper. 2003. A type system for higher-order modules. In Conference Record of POPL 2003: The 30th SIGPLAN-SIGACT Symposium on Principles of Programming Languages, New Orleans, Louisisana, USA, January 15-17, 2003. 236–249.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Erik Ernst. 1999. gbeta – a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. Ph.D. Dissertation. Department of Computer Science, University of Aarhus, Århus, Denmark.Google ScholarGoogle Scholar
  12. Erik Ernst. 2001. Family Polymorphism. In ECOOP 2001 - Object-Oriented Programming, 15th European Conference, Budapest, Hungary, June 18-22, 2001, Proceedings. 303–326.Google ScholarGoogle Scholar
  13. Erik Ernst, Klaus Ostermann, and William R. Cook. 2006. A virtual class calculus. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2006, Charleston, South Carolina, USA, January 11-13, 2006. 270–282.Google ScholarGoogle Scholar
  14. Robert Harper and Mark Lillibridge. 1994. A Type-Theoretic Approach to Higher-Order Modules with Sharing. In Conference Record of POPL’94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Portland, Oregon, USA, January 17-21, 1994. 123–137.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Jaemin Hong, Jihyeok Park, and Sukyoung Ryu. 2018. Path Dependent Types with Path-equality. In Proceedings of the 9th ACM SIGPLAN International Symposium on Scala (Scala 2018). ACM, 35–39.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Jason Hu and Ondrej Lhoták. 2019. Undecidability of D <: and Its Decidable Fragments. CoRR abs/1908.05294 (2019). http://arxiv.org/abs/1908.05294Google ScholarGoogle Scholar
  17. Ifaz Kabir and Ondřej Lhoták. 2018. κDOT: scaling DOT with mutation and constructors. In Proceedings of the 9th ACM SIGPLAN International Symposium on Scala. ACM, 40–50.Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Xavier Leroy. 1994. Manifest Types, Modules, and Separate Compilation. In Conference Record of POPL’94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Portland, Oregon, USA, January 17-21, 1994. 109–122.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Ole Lehrmann Madsen and Birger Møller-Pedersen. 1989. Virtual Classes: A Powerful Mechanism in Object-Oriented Programming. In Conference on Object-Oriented Programming: Systems, Languages, and Applications (OOPSLA’89), New Orleans, Louisiana, USA, October 1-6, 1989, Proceedings. 397–406.Google ScholarGoogle Scholar
  20. Adriaan Moors, Frank Piessens, and Martin Odersky. 2008. Safe type-level abstraction in Scala. In International Workshop on Foundations of Object-Oriented Languages (FOOL 2008).Google ScholarGoogle Scholar
  21. Martin Odersky, Vincent Cremet, Christine Röckl, and Matthias Zenger. 2003. A Nominal Theory of Objects with Dependent Types. In ECOOP 2003 - Object-Oriented Programming, 17th European Conference, Darmstadt, Germany, July 21-25, 2003, Proceedings. 201–224.Google ScholarGoogle ScholarCross RefCross Ref
  22. Martin Odersky and Matthias Zenger. 2005. Scalable component abstractions. In Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2005, October 16-20, 2005, San Diego, CA, USA. 41–57.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Benjamin C. Pierce. 1992. Bounded Quantification is Undecidable. In Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Albuquerque, New Mexico, USA, January 19-22, 1992. 305–315.Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Marianna Rapoport, Ifaz Kabir, Paul He, and Ondřej Lhoták. 2017. A simple soundness proof for dependent object types. PACMPL 1, OOPSLA (2017), 46:1–46:27.Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Marianna Rapoport and Ondrej Lhoták. 2019. A Path To DOT: Formalizing Fully Path-Dependent Types. CoRR abs/1904.07298 (2019). http://arxiv.org/abs/1904.07298Google ScholarGoogle Scholar
  26. Tiark Rompf and Nada Amin. 2016. Type soundness for dependent object types (DOT). In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, part of SPLASH 2016, Amsterdam, The Netherlands, October 30 - November 4, 2016. 624–641.Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Andreas Rossberg. 2018. 1ML — Core and modules united. Journal of Functional Programming 28 (2018), e22.Google ScholarGoogle ScholarCross RefCross Ref
  28. Andreas Rossberg and Derek Dreyer. 2013. Mixin’ Up the ML Module System. ACM Trans. Program. Lang. Syst. 35, 1 (2013), 2:1–2:84.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Andreas Rossberg, Claudio V. Russo, and Derek Dreyer. 2014. F-ing modules. J. Funct. Program. 24, 5 (2014), 529–607.Google ScholarGoogle Scholar
  30. Christopher A. Stone and Robert Harper. 2006. Extensional equivalence and singleton types. ACM Trans. Comput. Log. 7, 4 (2006), 676–722.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Fei Wang and Tiark Rompf. 2017. Towards Strong Normalization for Dependent Object Types (DOT). In 31st European Conference on Object-Oriented Programming, ECOOP 2017, June 19-23, 2017, Barcelona, Spain. 27:1–27:25.Google ScholarGoogle Scholar
  32. Andrew K. Wright and Matthias Felleisen. 1994. A Syntactic Approach to Type Soundness. Inf. Comput. 115, 1 (1994), 38–94.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A path to DOT: formalizing fully path-dependent types

      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!