Typing unmarshalling without marshalling types
Grégoire Henry, Michel Mauny, Emmanuel Chailloux et al. · ACM SIGPLAN International Conference on Functional Programming (ICFP) · 2012
Unmarshalling primitives in statically typed language require, in order to preserve type safety, to dynamically verify the compatibility between the incoming values and the statically expected type. In the context of programming languages based on parametric polymorphism and uniform data representation, we propose a relation of compatibility between (unmarshalled) memory graphs and types. It is defined as constraints over nodes of the memory graph. Then, we propose an algorithm to check the compatibility between a memory graph and a type. It is described as a constraint solver based on a rewriting system. We have shown that the proposed algorithm is sound and semi-complete in presence of algebraic data types, mutable data, polymorphic sharing, cycles, and functional values, however, in its general form, it may not terminate. We have implemented a prototype tailored for the OCaml compiler [17] that always terminates and still seems sufficiently complete in practice.
Cited by 5 works. doi:10.1145/2364527.2364569
Authors
References
- Lecture Notes in Computer Science 1205
- Polymorphic type schemes and recursive definitions
- Runtime tags aren't necessary
- Contracts for higher-order functions
- The design and implementation of typed scheme
- Advanced Topics in Types and Programming Languages
- Intensional polymorphism in type-erasure semantics
- Tag-free garbage collection using explicit type parameters
- Dynamic typing in polymorphic languages
- Dynamics in ML