Disjoint intersection types

被引:0
作者
Oliveira B.C.D.S. [1 ]
Shi Z. [1 ]
Alpuim J. [1 ]
机构
[1] University of Hong Kong, Hong Kong
来源
ACM SIGPLAN Notices | 2016年 / 51卷 / 09期
关键词
Intersection Types; Type System;
D O I
10.1145/2951913.2951945
中图分类号
学科分类号
摘要
Dunfield showed that a simply typed core calculus with intersection types and a merge operator is able to capture various programming language features. While his calculus is type-safe, it is not coherent: different derivations for the same expression can elaborate to expressions that evaluate to different values. The lack of coherence is an important disadvantage for adoption of his core calculus in implementations of programming languages, as the semantics of the programming language becomes implementation-dependent. This paper presents λ-i: A coherent and type-safe calculus with a form of intersection types and a merge operator. Coherence is achieved by ensuring that intersection types are disjoint and programs are sufficiently annotated to avoid type ambiguity. We propose a definition of disjointness where two types A and B are disjoint only if certain set of types are common supertypes of A and B. We investigate three different variants of λ-i, with three variants of disjointness. In the simplest variant, which does not allow ĝŠ Currency sign types, two types are disjoint if they do not share any common supertypes at all. The other two variants introduce ĝŠ Currency sign types and refine the notion of disjointness to allow two types to be disjoint when the only the set of common supertypes are top-like. The difference between the two variants with ĝŠ Currency sign types is on the definition of top-like types, which has an impact on which types are allowed on intersections. We present a type system that prevents intersection types that are not disjoint, as well as an algorithmic specifications to determine whether two types are disjoint for all three variants. © 2016 ACM.
引用
收藏
页码:364 / 377
页数:13
相关论文
共 31 条
[1]  
Amin N., Moors A., Odersky M., Dependent object types, 19th International Workshop on Foundations of Object-Oriented Languages, (2012)
[2]  
Amin N., Rompf T., Odersky M., Foundations of path-dependent types, Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications, (2014)
[3]  
Aydemir B.E., Chargueraud A., Pierce B.C., Pollack R., Weirich S., Proceeding of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL) . ACM, pp. 3-15, (2008)
[4]  
Benzaken V., Castagna G., Frisch A., CDuce: An XML-centric general-purpose language, Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, ICFP ?03, (2003)
[5]  
Cardelli L., A semantics of multiple inheritance, Information and Computation, 76, pp. 138-164, (1988)
[6]  
Castagna G., Ghelli G., Longo G., A calculus for overloaded functions with subtyping, Proceedings of the 1992 ACM Conference on LISP and Functional Programming, LFP ?92, 1992
[7]  
Castagna G., Nguyen K., Xu Z., Im H., Lenglet S., Padovani L., Polymorphic functions with set-Theoretic types: Part 1: Syntax, semantics, and evaluation, Proceedings of the 41st ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, POPL ?14, (2014)
[8]  
Compagnoni A.B., Pierce B.C., Higher-order intersection types and multiple inheritance, Mathematical Structures in Computer Science, (1996)
[9]  
Coppo M., Dezani-Ciancaglini M., Venneri B., Functional characters of solvable terms, Mathematical Logic Quarterly, 27, 2-6, pp. 45-58, (1981)
[10]  
Curienl P.-L., Ghelli G., Coherence of subsumption, CAAP?90: 15th Colloquium on Trees in Algebra and Programming, Copenhagen, Denmark, (1990)