Space-Efficient Gradual Typing in Coercion-Passing Style

08/07/2019
by   Yuya Tsuda, et al.
0

Herman et al. (2007, 2010) pointed out that the insertion of run-time checks into a gradually typed program could hamper tail-call optimization and, as a result, worsen the space complexity of the program. To address the problem, they proposed a space-efficient coercion calculus, which was subsequently improved by Garcia, et al. (2009) and Siek et al. (2015). The semantics of these calculi involves eager composition of run-time checks expressed by coercions to prevent the size of a term from growing. However, it relies also on a nonstandard reduction rule, which does not seem easy to implement. In fact, no compiler implementation of gradually typed languages fully supports the space-efficient semantics faithfully. In this paper, we study coercion-passing style, which Herman et al. have already mentioned, as a technique for straightforward space-efficient implementation of gradually typed languages. A program in coercion-passing style passes "the rest of run-time checks" around—just like continuation-passing style (CPS), in which "the rest of computation" has been passed around—and (unlike CPS) composes coercions eagerly. We give a formal coercion-passing translation from λS by Siek et al. to λS_1, which is a new calculus of first-class coercions tailored for coercion-passing style, and prove correctness of the translation. We also implement our coercion-passing style transformation for the Grift compiler developed by Kuhlenschmidt et al. and give a preliminary experimental result.

READ FULL TEXT
research
12/09/2017

Improved Space-efficient Linear Time Algorithms for Some Classical Graph Problems

This short note provides space-efficient linear time algorithms for comp...
research
02/18/2018

Efficient Gradual Typing

Gradual typing combines static and dynamic typing in the same program. O...
research
10/27/2020

Abstracting Gradual Typing Moving Forward: Precise and Space-Efficient (Technical Report)

Abstracting Gradual Typing (AGT) is a systematic approach to designing g...
research
09/12/2019

Towards Gradually Typed Capabilities in the Pi-Calculus

Gradual typing is an approach to integrating static and dynamic typing w...
research
11/17/2017

Eliminating the unit constant in the Lambek calculus with brackets

We present a translation of the Lambek calculus with brackets and the un...
research
01/26/2022

A Dependent Dependency Calculus (Extended Version)

Over twenty years ago, Abadi et al. established the Dependency Core Calc...
research
12/08/2020

Control Flow Obfuscation for FJ using Continuation Passing

Control flow obfuscation deters software reverse engineering attempts by...

Please sign up or login with your details

Forgot password? Click here to reset