Abstract
Calculi with intersection types have been used over the years to model various features, including: overloading, extensible records and, more recently, nested composition and return type overloading. Nevertheless no previous calculus supports all those features at once. In this paper we study expressive calculi with intersection types and a merge operator. Our first calculus supports an unrestricted merge operator, which is able to support all the features, and is proven to be type sound. However, the semantics is non-deterministic. In the second calculus we employ a previously proposed disjointness restriction, to make the semantics deterministic. Some forms of overloading are forbidden, but all other features are supported. The main challenge in the design is related to the semantics of applications and record projections. We propose an applicative subtyping relation that enables the inference of result types for applications and projections. Correspondingly, there is an applicative dispatching relation that is used for the dynamic semantics. The two calculi and their proofs are formalized in the Coq theorem prover.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Applicative Intersection Types (Artifact). Zenodo, August 2022. https://doi.org/10.5281/zenodo.7004695
Alpuim, J., Oliveira, B.C.d.S., Shi, Z.: Disjoint polymorphism. In: European Symposium on Programming. pp. 1–28. Springer (2017)
Barendregt, H., Coppo, M., Dezani-Ciancaglini, M.: A filter lambda model and the completeness of type assignment1. The journal of symbolic logic 48(4), 931–940 (1983)
Bi, X., Oliveira, B.C.D.S., Schrijvers, T.: The essence of nested composition. In: 32nd European Conference on Object-Oriented Programming (ECOOP 2018). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2018)
Bobrow, D.G., DeMichiel, L.G., Gabriel, R.P., Keene, S.E., Kiczales, G., Moon, D.A.: Common lisp object system specification. ACM SIGPLAN Not. 23(SI), 1–142 (1988)
Castagna, G., Ghelli, G., Longo, G.: A calculus for overloaded functions with subtyping. Information and Computation 117(1), 115–135 (1995)
Coppo, M., Dezani-Ciancaglini, M., Venneri, B.: Functional characters of solvable terms. Mathematical Logic Quarterly 27(2–6), 45–58 (1981)
Davies, R., Pfenning, F.: Intersection types and computational effects. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pp. 198–208 (2000)
Dunfield, J.: Elaborating intersection and union types. Journal of Functional Programming 24(2–3), 133–165 (2014)
Dunfield, J., Krishnaswami, N.: Bidirectional typing. ACM Computing Surveys (CSUR) 54(5), 1–38 (2021)
Ernst, E.: Family polymorphism. In: European Conference on Object-Oriented Programming. pp. 303–326. Springer (2001)
Fan, A., Huang, X., Xu, H., Sun, Y., Oliveira, B.C.D.S.: Direct foundations for compositional programming. In: 36th European Conference on Object-Oriented Programming, ECOOP 2022, 6–10 June 2022, Berlin, Germany. LIPIcs, vol. 222, pp. 18:1–18:28. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2022)
Frisch, A., Castagna, G., Benzaken, V.: Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types. Journal of the ACM (JACM) 55(4), 1–64 (2008)
Huang, X., Zhao, J., Oliveira, B.C.: Taming the merge operator. J. Funct. Programm. 31 (2021)
Kaes, S.: Parametric overloading in polymorphic programming languages. In: European Symposium on Programming. pp. 131–144. Springer (1988)
Marntirosian, K., Schrijvers, T., Oliveira, B.C.D.S., Karachalias, G.: Resolution as intersection subtyping via modus ponens. Proc. ACM Program. Lang. 4(OOPSLA) (2020)
Oliveira, B.C.D.S., Shi, Z., Alpuim, J.: Disjoint intersection types. In: Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, pp. 364–377 (2016)
Pierce, B.C.: Programming with intersection types and bounded polymorphism. Ph.D. thesis. Citeseer (1991)
Pottinger, G.: A type assignment for the strongly normalizable \(\lambda \)-terms. In: To HB Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, pp. 561–577 (1980)
Rémy, D.: Type checking records and variants in a natural extension of ML. In: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 77–88 (1989)
Reynolds, J.C.: Preliminary design of the programming language Forsythe (1988)
Reynolds, J.C.: The coherence of languages with intersection types. In: International Symposium on Theoretical Aspects of Computer Software. pp. 675–700. Springer (1991)
Reynolds, J.C.: Design of the programming language forsythe. In: O’Hearn, P.W., Tennent, R.D. (eds.) ALGOL-Like Languages, pp. 173–233. Springer, Boston (1997). https://doi.org/10.1007/978-1-4612-4118-8_9
Rioux, N., Huang, X., Oliveira, B.C.D.S.: Zdancewic: a bowtie for a beast. Technical report, MS-CIS-22-02, Department of Computer and Information Science, University of Pennsylvania (2022)
Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 60–76 (1989)
Wadler, P., et al.: The expression problem. Posted on the Java Genericity mailing list (1998)
Wand, M.: Type inference for record concatenation and multiple inheritance. Information and Computation 93(1), 1–15 (1991)
Xie, N., Oliveira, B.C.d.S.: Let arguments go first. In: European Symposium on Programming. pp. 272–299. Springer (2018)
Zhang, W., Sun, Y., Oliveira, B.C.: Compositional programming. ACM Trans. Program. Lang. Syst. (TOPLAS) 43(3), 1–61 (2021)
Acknowledgement
We thank the anonymous reviewers for their helpful comments and our colleagues of HKU Programming Languages Group for their discussions to understand this work better. We thank Chen Cui for his valuable feedback on the draft. This work has been sponsored by Hong Kong Research Grant Council projects number 17209519, 17209520 and 17209821.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Xue, X., Oliveira, B.C.d.S., Xie, N. (2022). Applicative Intersection Types. In: Sergey, I. (eds) Programming Languages and Systems. APLAS 2022. Lecture Notes in Computer Science, vol 13658. Springer, Cham. https://doi.org/10.1007/978-3-031-21037-2_8
Download citation
DOI: https://doi.org/10.1007/978-3-031-21037-2_8
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-21036-5
Online ISBN: 978-3-031-21037-2
eBook Packages: Computer ScienceComputer Science (R0)