ABSTRACT
Semantic subtyping enables simple, set-theoretical reasoning about types by interpreting a type as the set of its values. Previously, semantic subtyping has been studied primarily in the context of statically typed languages with structural typing. In this paper, we explore the applicability of semantic subtyping in the context of a dynamic language with nominal types. Instead of static type checking, dynamic languages rely on run-time checking of type tags associated with values, so we propose using the tags for semantic subtyping. We base our work on a fragment of the Julia language and present tag-based semantic subtyping for nominal types, tuples, and unions, where types are interpreted set-theoretically as sets of type tags. The proposed subtyping relation is shown to be decidable, and a corresponding analytic definition is provided. The implications of using semantic subtyping for multiple dispatch are also discussed.
- Eric Allen, Justin Hilburn, Scott Kilpatrick, Victor Luchangco, Sukyoung Ryu, David Chase, and Guy Steele. 2011. Type Checking Modular Multiple Dispatch with Parametric Polymorphism and Multiple Inheritance. SIGPLAN Not. 46, 10 (Oct. 2011), 973--992. Google ScholarDigital Library
- Davide Ancona and Andrea Corradi. 2016. Semantic Subtyping for Imperative Object-oriented Languages. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2016). ACM, New York, NY, USA, 568--587. Google ScholarDigital Library
- Julia Belyakova. 2018. Coq mechanization of MiniJl. https://github.com/julbinb/ftfjp-2019/tree/master/MechanizationGoogle Scholar
- Jeff Bezanson. 2015. Abstraction in technical computing.Google Scholar
- Jeff Bezanson, Alan Edelman, Stefan Karpinski, and Viral B Shah. 2017. Julia: A fresh approach to numerical computing. SIAM review 59, 1 (2017), 65--98.Google ScholarDigital Library
- Giuseppe Castagna, Giorgio Ghelli, and Giuseppe Longo. 1992. A Calculus for Overloaded Functions with Subtyping. In Proceedings of the 1992 ACM Conference on LISP and Functional Programming (LFP '92). ACM, New York, NY, USA, 182--192. Google ScholarDigital Library
- Craig Chambers. 1992. Object-Oriented Multi-Methods in Cecil. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP '92). Springer-Verlag, Berlin, Heidelberg, 33--56. http://dl.acm.org/citation.cfm?id=646150.679216 Google ScholarDigital Library
- Benjamin Chung, Francesco Zappa Nardelli, and Jan Vitek. 2019. Julia's efficient algorithm for subtyping unions and covariant tuples (Pearl). In 33rd European Conference on Object-Oriented Programming (ECOOP 2019). (To appear).Google Scholar
- Curtis Clifton, Gary T. Leavens, Craig Chambers, and Todd Millstein. 2000. MultiJava: Modular Open Classes and Symmetric Multiple Dispatch for Java. In Proceedings of the 15th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA '00). ACM, New York, NY, USA, 130--145. Google ScholarDigital Library
- Ornela Dardha, Daniele Gorla, and Daniele Varacca. 2013. Semantic Subtyping for Objects and Classes. In Formal Techniques for Distributed Systems, Dirk Beyer and Michele Boreale (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 66--82.Google Scholar
- Alain Frisch, Giuseppe Castagna, and Véronique Benzaken. 2008. Semantic Subtyping: Dealing Set-theoretically with Function, Union, Intersection, and Negation Types. J. ACM 55, 4, Article 19 (Sept. 2008), 64 pages. Google ScholarDigital Library
- Haruo Hosoya and Benjamin C. Pierce. 2003. XDuce: A Statically Typed XML Processing Language. ACM Trans. Internet Technol. 3, 2 (May 2003), 117--148. Google ScholarDigital Library
- Haruo Hosoya, Jérôme Vouillon, and Benjamin C. Pierce. 2005. Regular Expression Types for XML. ACM Trans. Program. Lang. Syst. 27, 1 (Jan. 2005), 46--90. Google ScholarDigital Library
- Gavin King. 2017. The Ceylon Language Specification, Version 1.3. https://ceylon-lang.org/documentation/1.3/spec/Google Scholar
- Gary T. Leavens and Todd D. Millstein. 1998. Multiple Dispatch As Dispatch on Tuples. In Proceedings of the 13th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA '98). ACM, New York, NY, USA, 374--387. Google ScholarDigital Library
- Per Martin-öf. 1994. Analytic and Synthetic Judgements in Type Theory. Springer Netherlands, Dordrecht, 87--99.Google Scholar
- Fabian Muehlboeck and Ross Tate. 2018. Empowering Union and Intersection Types with Integrated Subtyping. Proc. ACM Program. Lang. 2, OOPSLA, Article 112 (Oct. 2018), 29 pages. Google ScholarDigital Library
- Gyunghee Park, Jaemin Hong, Guy L. Steele Jr., and Sukyoung Ryu. 2019. Polymorphic Symmetric Multiple Dispatch with Variance. Proc. ACM Program. Lang. 3, POPL, Article 11 (Jan. 2019), 28 pages. Google ScholarDigital Library
- Benjamin C. Pierce. 2002. Types and Programming Languages (1st ed.). The MIT Press. Google ScholarDigital Library
- Francesco Zappa Nardelli, Julia Belyakova, Artem Pelenitsyn, Benjamin Chung, Jeff Bezanson, and Jan Vitek. 2018. Julia Subtyping: A Rational Reconstruction. Proc. ACM Program. Lang. 2, OOPSLA, Article 113 (Oct. 2018), 27 pages. Google ScholarDigital Library
Index Terms
- Decidable tag-based semantic subtyping for nominal types, tuples, and unions
Recommendations
Decidable subtyping for path dependent types
Path dependent types have long served as an expressive component of the Scala programming language. They allow for the modelling of both bounded polymorphism and a degree of nominal subtyping. Nominality in turn provides the ability to capture first ...
Semantic subtyping with an SMT solver
ICFP '10We study a first-order functional language with the novel combination of the ideas of refinement type (the subset of a type to satisfy a Boolean expression) and type-test (a Boolean expression testing whether a value belongs to a type). Our core ...
Polymorphic Functions with Set-Theoretic Types: Part 2: Local Type Inference and Type Reconstruction
POPL '15: Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesThis article is the second part of a two articles series about the definition of higher order polymorphic functions in a type system with recursive types and set-theoretic type connectives (unions, intersections, and negations).
In the first part, ...
Comments