This paper addresses the issue of safely combining computational effects and multi-stage programming. We propose a type system, which exploits a notion of closed type, to check statically that an imperative multi-stage program does not cause run-time errors. Our approach is demonstrated formally for a core language called MiniML meta ref . This core language safely combines multi-stage constructs and ML-style references, and is a conservative extension of MiniML ref , a simple imperative subset of SML. In previous work, we introduced a closed type constructor , which was enough to ensure the safe execution of dynamically generated code in the pure fragment of MiniML meta ref .
Calcagno, Moggi, and Sheard developed a sound type system for a multi-stage calculus with references using closed types REF .
Closed Types for a Safe Imperative MetaML
UNDER CONSIDERATION FOR PUBLICATION IN J. FUNCTIONAL PROGRAMMING
Computer Science