Affiliation:
1. University of Colorado at Boulder, Boulder, CO, USA
2. University of Edinburgh, Edinburgh, United Kingdom
Abstract
How to integrate static and dynamic types? Recent work focuses on casts to mediate between the two. However, adding casts may degrade tail calls into a non-tail calls, increasing space consumption from constant to linear in the depth of calls.
We present a new solution to this old problem, based on the notion of a threesome. A cast is specified by a source and a target type--a twosome. Any twosome factors into a downcast from the source to an intermediate type, followed by an upcast from the intermediate to the target---a threesome. Any chain of threesomes collapses to a single threesome, calculated by taking the greatest lower bound of the intermediate types. We augment this solution with blame labels to map any failure of a threesome back to the offending twosome in the source program.
Herman, Tomb, and Flanagan (2007) solve the space problem by representing casts with the coercion calculus of Henglein (1994). While they provide a theoretical limit on the space overhead, there remains the practical question of how best to implement coercion reduction. The threesomes presented in this paper provide a streamlined data structure and algorithm for representing and normalizing coercions. Furthermore, threesomes provide a typed-based explanation of coercion reduction.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
18 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Gradualizing the Calculus of Inductive Constructions;ACM Transactions on Programming Languages and Systems;2022-04-06
2. Gradually structured data;Proceedings of the ACM on Programming Languages;2021-10-20
3. Blame and coercion: Together again for the first time;Journal of Functional Programming;2021
4. Parameterized cast calculi and reusable meta-theory for gradually typed lambda calculi;Journal of Functional Programming;2021
5. Space-Efficient Latent Contracts;Lecture Notes in Computer Science;2019