TR-2010-01

Engineering Higher-Order Modules in SML/NJ

George Kuan; David MacQueen. 29 January, 2010.
Communicated by Dave MacQueen.

Abstract

SML/NJ and other Standard ML variants extend the ML module system with higher-order functors, elevating the module language to a full functional language. In this paper, we describe the implementation of the higher-order module system in SML/NJ, which is unique in providing "true" higher-order behavior at the static level. This second generation implementation of higher-order modules in SML/NJ is based on three key techniques: unique internal variables (entity variables) for naming static entities, a factorization of the static information in both basic modules and functors into signatures and realizations, and a static lambda calculus we call the entity calculus with static "effects" to represent the type-level mapping performed by a functor. This system implements MacQueen-Tofte's re-elaboration semantics without having to re-elaborate functor bodies or appeal to fragile stamp properties.

Original Document

The original document is available in PDF (uploaded 29 January, 2010 by Dave MacQueen).