The linear logic of J.-Y. Girard suggests a new type system for functional languages, one which supports operations that \change the world". Values belonging to a linear type must be used exactly once: like the world, they cannot be duplicated or destroyed. Such values require no reference counting or garbage collection , and safely admit destructive array update. Linear types extend Schmidt's notion of single threading; provide an alternative to Hudak and Bloss' update analysis; and ooer a practical complement to Lafont and Holmstrr om's elegant linear languages. An old canard against functional languages is that they cannot change the world: they do not \naturally" cope with changes of state, such as altering a location in memory, changing a pixel on a display, or sensing when a key is pressed. As a prototypical example of this, consider the world as an array. An array (of type Arr) is a mapping from indices (of type Ix) to values (of type Val). For instance, the world might be a mapping of variable names to values, or le names to contents. At any time, we can do one of two things to the world: nd the value associated with an index, or update an index to be associated with a new value. Of course it is possible to model this functionally; we just use the two operations A program that interacts with the world might have the form main : Args ! Arr ! Arr; where the rst parameter is the list of arguments that make up the command line, the second parameter is the old world, and the result is the new world. An example of a program is main les a = update \stdout" (concat lookup i a j i les]) a:
[1]
D. A. Turner,et al.
Miranda: A Non-Strict Functional language with Polymorphic Types
,
1985,
FPCA.
[2]
Philip Wadler,et al.
Deforestation: Transforming Programs to Eliminate Trees
,
1990,
Theor. Comput. Sci..
[3]
John C. Reynolds,et al.
Three Approaches to Type Structure
,
1985,
TAPSOFT, Vol.1.
[4]
Jean-Yves Girard,et al.
The System F of Variable Types, Fifteen Years Later
,
1986,
Theor. Comput. Sci..
[5]
Patrick Lincoln,et al.
Linear logic
,
1992,
SIGA.
[6]
John C. Reynolds,et al.
Types, Abstraction and Parametric Polymorphism
,
1983,
IFIP Congress.
[7]
Paul Hudak.
A semantic model of reference counting and its abstraction (detailed summary)
,
1986,
LFP '86.
[8]
Robin Milner,et al.
A Theory of Type Polymorphism in Programming
,
1978,
J. Comput. Syst. Sci..
[9]
Robin Milner,et al.
Principal type-schemes for functional programs
,
1982,
POPL '82.
[10]
David A. Schmidt.
Detecting global variables in denotational specifications
,
1985,
TOPL.
[11]
John Darlington,et al.
A system which automatically improves programs
,
1973,
Acta Informatica.
[12]
J. Girard,et al.
Proofs and types
,
1989
.
[13]
Paul Hudak,et al.
An Optimising Compiler for a Modern Functional Language
,
1989,
Comput. J..
[14]
John C. Reynolds,et al.
Towards a theory of type structure
,
1974,
Symposium on Programming.
[15]
R. Hindley.
The Principal Type-Scheme of an Object in Combinatory Logic
,
1969
.
[16]
Yves Lafont,et al.
The Linear Abstract Machine
,
1988,
Theor. Comput. Sci..