ArticlePDF Available

Extending Record typing to type parametric modules with sharing

Authors:

Abstract

We extend term unification techniques used to type extensible records in order to solve the two main typing problems for modules in Standard ML: matching and sharing. We obtain a type system for modules based only on well known unification problems, modulo some equational theories we define. Our formalization is sim- ple and has the elegance of polymorphic type disciplines based on unification. It can be seen as a synthesis of previous work on module and record typing.
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
inria-00074768, version 1 - 24 May 2006
... .; n =' n (dropping the initial fg). Realization environments 1 and 2 can be appended, written 1 This declaration gives rise to the view G G= : X :hs body ; ' body i, where s body is the tree f ; NatNumg and ' body = newfmg:let 0 = app(get F ( ; Interv); ( =I)) in (m; NatNum= 0 ) and X represents the parameter signature of G. Here app(get F ( ; Interv); =I) stands for a functor application. ...
... Moreover, combReas(E) is the view strid 1 =' 1 ; . . .; strid n =' n ; funid= 1 ...
Article
Full-text available
Standard ML has a module system that allows one to define parametric modules, called /urictots. Functors are "first-order," meaning that runetots themselves cannot be passed as parameters or returned as results of functor apphcations. This paper presents a semantics for a higher-order module system which generalizes the module system of Standard ML. The higher-order functors described here are implemented in the current version of Standard ML of New Jersey and have proved useful in programming practice.
... The present paper also puts forward a new way to account for type sharing, distinct from the heavy graph-based formalism of the Definition [11,17,25] and from Aponte's record-based module algebra [1]. Previous approaches to sharing focus on structure generativity and sharing between structures; as a consequence, they require stamps over structures and consistency conditions between structures having the same stamp. ...
Article
Full-text available
This paper presents a variant of the SML module system that introduces a strict distinction between abstract types and manifest types (types whose definitions are part of the module specification), while retaining most of the expressive power of the SML module system. The resulting module system provides much better support for separate compila- tion.
... The simplified module language TypModL used in this paper is derived from the ModL calculus introduced by Tofte et al. to study the related notions of structure sharing and generativity (Harper et al., 1987; Tofte, 1988; Tofte, 1992; Aponte, 1993 ). TypModL features generative and non-generative type declarations, structures , and first-order functors. ...
Article
Full-text available
This paper presents a purely syntactic account of type generativity and sharing --- two key mechanisms in the Standard ML module system --- and shows its equivalence with the traditional stamp-based description of these mechanisms. This syntactic description recasts the Standard ML module system in a more abstract, type-theoretic framework.
Article
We describe extensions of the Hindley-Milner type system to support higher-order poly-morphism and rst-class structures with polymorphic components. The combination of these features results in àcore language' that rivals the expressiveness of the Standard ML module system in some respects and exceeds it in others.
Article
Region Inference is a program analysis which infers lifetimes of values. It is targeted at a runtime model in which the store consists of a stack of regions and memory management predominantly consists of pushing and popping regions, rather than performing garbage collection. Region Inference has previously been specified by a set of inference rules which formalize when regions may be allocated and deallocated. This article presents an algorithm which implements the specification. We prove that the algorithm is sound with respect to the region inference rules and that it always terminates even though the region inference rules permit polymorphic recursion in regions. The algorithm is the result of several years of experiments with region inference algorithms in the ML Kit, a compiler from Standard ML to assembly language. We report on practical experience with the algorithm and give hints on how to implement it.
Article
Full-text available
The programming language Standard ML is an amalgam of two, largely orthogonal, languages. The Core language expresses details of algorithms and data structures. The Modules language expresses the modular architecture of a software system. Both languages are statically typed, with their static and dynamic semantics specified by a formal definition. Over the past decade, Standard ML Modules has been the source of inspiration for much research into the type-theoretic foundations of modules languages. Despite these efforts, a proper type-theoretic understanding of its static semantics has remained elusive. In this thesis, we use Type Theory as a guideline to reformulate the unconventional static semantics of Modules, providing a basis for useful extensions to the Modules language. Our starting point is a stylised presentation of the existing static semantics of Modules, parameterised by an arbitrary Core language. We claim that the type-theoretic concepts underlying Modules are type parameterisation, type quantification and subtyping. We substantiate this claim by giving a provably equivalent semantics with an alternative, more type-theoretic presentation. In particular, we show that the notion of type generativity corresponds to existential quantification over types. In contrast to previous accounts, our analysis does not involve first-order dependent types. Our first extension generalises Modules to higher-order, allowing modules to take parameterised modules as arguments, and return them as results. We go beyond previous proposals for higher-order Modules by supporting a notion of type generativity. We give a sound and complete algorithm for type-checking higher-order Modules. Our second extension permits modules to be treated as first-class citizens of an ML-like Core language, greatly extending the range of computations on modules. Each extension arises from a natural generalisation of our type-theoretic semantics. This thesis also addresses two pragmatic concerns. First, we propose a simple approach to the separate compilation of Modules, which is adequate in practice but has theoretical limitations. We suggest a modified syntax and semantics that alleviates these limitations. Second, we study the type inference problem posed by uniting our extensions to higher-order and first-class modules with an implicitly-typed, ML-like Core language. We present a hybrid type inference algorithm that integrates the classical algorithm for ML with the type-checking algorithm for Modules.
Article
Three languages with polymorphic type disciplines are discussed, namely the λ-calculus with Milner's polymorphic type discipline; a language with imperative features (polymorphic references); and a skeletal module language with structures, signatures and functors. In each of the two first cases we show that the type inference system is consistent with an operational dynamic semantics. On the module level, polymorphic types correspond to signatures. There is a notion of principal signature. So-called signature checking is the module level equivalent of type checking. In particular, there exists an algorithm which either fails or produces a principal signature.
Article
We describe an extension of ML with records where inheritance is given by ML generic poly-morphism. All common operations on records but concatenation are supported, in particular the free extension of records. Other operations such as renaming of elds are added. The solu-tion relies on an extension of ML, where the language of types is sorted and considered modulo equations, and on a record extension of types. The solution is simple and modular and the type inference algorithm is eecient in practice.
Conference Paper
The problem of strong typing is considered for a model of object-oriented programming systems. These systems permit values which are records of other values, and in which fields inside these records are retrieved by name. A type system is proposed that permits classification of these kinds of values and programs by the type of their result, as is usual in strongly-typed programming languages. The type system has two important properties: it admits multiple inheritance, and it has a syntactically complete type inference system.
Typage d'un syst~me de modules paramdtriques avec partage: une application de l'unification dans les thdories dquationnelles. Th&se de doctorat
  • Maria Virginia Aponte