## Linearity and Laziness (1990)

Venue: | In Proc. 5-th ACM Conference on Functional Programming Languages and Computer |

Citations: | 17 - 1 self |

### BibTeX

@INPROCEEDINGS{Wakeling90linearityand,

author = {David Wakeling and Colin Runciman},

title = {Linearity and Laziness},

booktitle = {In Proc. 5-th ACM Conference on Functional Programming Languages and Computer},

year = {1990},

pages = {215--240},

publisher = {Springer-Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

A criticism often levelled at functional languages is that they do not cope elegantly or efficiently with problems involving changes of state. In a recent paper [26], Wadler has proposed a new approach to these problems. His proposal involves the use of a type system based on the linear logic of Girard [7]. This allows the programmer to specify the "natural" imperative operations without at the same time sacrificing the crucial property of referential transparency. In this paper we investigate the practicality of Wadler's approach, describing the design and implementation of a variant of Lazy ML [2]. A small example program shows how imperative operations can be used in a referentially transparent way, and at the same time it highlights some of the problems with the approach. Our implementation is based on a variant of the G-machine [15, 1]. We give some benchmark figures to compare the performance of our machine with the original one. The results are disappointing: the cost of maintai...

### Citations

1703 |
The Fractal Geometry of Nature
- Mandelbrot
- 1983
(Show Context)
Citation Context ...these problems with type-checking have not prevented us from writing several interesting NLML programs. One of these is described below. 4 An Example: Generating the Mandelbrot Set The Mandelbrot set =-=[19]-=- is a set of complex numbers governed by the iterative formula z / z 2 + k. If this formula converges for an initial z of (0,0) then the point k is within the set, otherwise it is not. Unfortunately, ... |

939 | A theory of type polymorphism in programming
- Milner
- 1978
(Show Context)
Citation Context ...d: !*a-?!*a; id x = x is translated into id = ((x:x :!X) :!X !!X) Type-checking is then performed in two stages. The first stage uses a simple variant of Milner's archetypal type-checking algorithm W =-=[20]-=- using information supplied in the type signatures. At this stage, a function is considered to be type-incorrect if it is ambiguous. For example, if its type signature is omitted, then id is ambiguous... |

537 |
S.: The Implementation of Functional Programming Languages
- Jones
- 1987
(Show Context)
Citation Context ...ng its result. 3.2 Type-checking In NLML type-checking takes place after the program has been translated into the nonlinear -calculus using techniques similar to those described in Peyton Jones' book =-=[21]-=-. During this translation, information from any type signatures in the program, along with information about the types of the primitive operations, is used to annotate the resulting terms. So, for exa... |

333 |
The mechanical evaluation of expressions
- Landin
- 1964
(Show Context)
Citation Context ...that his language still exhibits the same fundamental lack of flexibility that Lafont's does [12]. Holmstrom sketched an implementation of his language using a linear variant of Landin's SECD machine =-=[18]-=-. This machine performs direct interpretation of the program source code. It is of interest because it allows a restricted form of sharing, and thus requires garbage collection. However, there is stil... |

225 | Report on the programming language Haskell: A non-strict, purely functional language (Version 1.2
- Hudak
- 1992
(Show Context)
Citation Context ...considerably more precision, allowing non-destructive operations in contexts where destructive ones are permitted (but not vice versa). Guzm'an and Hudak [9] plan to implement an extension of Haskell =-=[14]-=- based on their ideas. Wadler has proposed a let!-expression based on the observation that it is perfectly safe to have more than one reference to a linear value temporarily, so long as only one refer... |

191 |
A new implementation technique for applicative languages. Software: Practice and Experience
- TURNER
- 1979
(Show Context)
Citation Context ...ge of this machine is that it does not require garbage collection. However, there are also two obvious disadvantages: the grain of reduction is very small (similar to that of the SK reduction machine =-=[24]-=-), and the results of computations are never shared because the machine was designed to implement a linear language without any sharing at all. This can be very inefficient. Holmstrom [11] has describ... |

133 | Linear types can change the world
- Wadler
- 1990
(Show Context)
Citation Context ...n Runciman University of York Abstract A criticism often levelled at functional languages is that they do not cope elegantly or efficiently with problems involving changes of state. In a recent paper =-=[26], Wadler h-=-as proposed a new approach to these problems. His proposal involves the use of a type system based on the linear logic of Girard [7]. This allows the programmer to specify the "natural" impe... |

124 |
The categorical abstract machine
- Cousineau, Curien, et al.
- 1987
(Show Context)
Citation Context ... the linear -calculus, and only a few "small" types (such as integers) are permitted to escape the linearity constraint. LIVE is implemented using a linear variant of the Categorical Abstrac=-=t Machine [4]-=- called the Linear Abstract Machine. The advantage of this machine is that it does not require garbage collection. However, there are also two obvious disadvantages: the grain of reduction is very sma... |

91 |
The linear abstract machine
- Lafont
- 1988
(Show Context)
Citation Context ...se types. One of the first decisions taken in the design of NLML was that providing linear versions of the basic types was not worthwhile. This decision was partly the result of reading Lafont's work =-=[16, 17]-=-, and partly the result of our unsuccessful attempts to write useful functions using linear integers. Conventional type variables are written as !*a and linear type variables are written as *a. Conven... |

89 | Is there a use for linear logic
- Wadler
- 1991
(Show Context)
Citation Context ...rounds of its complexity, its poor interaction with lazy evaluation, and its dubious theoretical foundation. Wadler is currently trying to bridge the gap between theory and practice; his latest paper =-=[25]-=- attempts to establish the connection between the theoretically-based work of Lafont and Holmstrom and the more practically-based work of Guzm'an and Hudak. A more detailed account of our own work can... |

85 |
A Lisp garbage-collector for virtual memory computer sys- tems
- Fenichel, Yochelson
- 1969
(Show Context)
Citation Context ...oyed by the NLML compiler. 5.4 Heap Organisation and Garbage Collection The nonlinear G-machine has two heaps: a conventional heap managed using the classic scheme suggested by Fenichel and Yochelson =-=[6]-=-, and a linear heap which is is divided into a number of free-lists, one for each possible linear graph node size. There is also a non-volatile storage area for graph nodes representing compile-time c... |

71 |
Single-threaded polymorphic lambda calculus
- Guzman, Hudak
- 1990
(Show Context)
Citation Context ...data dependencies are all that is required to ensure that the indexing operations are performed prior to the updates. No extra machinery, such as the sequential let! of [26] or the sequential let* of =-=[9]-=- is necessary. Although the most obvious place to store linear arrays would be in the linear heap, our implementation actually stores them in the conventional heap and garbage collects them because of... |

67 | A semantic model of reference counting and its abstraction
- Hudak
- 1987
(Show Context)
Citation Context ... acceptable efficiency. In the past, a number of solutions to this aggregate update problem have been proposed including run-time checks [10], syntactic restrictions [23], and abstract interpretation =-=[13, 3]-=-. In this section we shall give yet another solution by showing how the nonlinear type system can be used in the implementation of arrays. 6.1 Implementation The literature describes two implementatio... |

62 |
Compiling Lazy Functional Languages
- Johnsson
- 1987
(Show Context)
Citation Context ...erative operations can be used in a referentially transparent way, and at the same time it highlights some of the problems with the approach. Our implementation is based on a variant of the G-machine =-=[15, 1]-=-. We give some benchmark figures to compare the performance of our machine with the original one. The results are disappointing: the cost of maintaining linearity in terms of lost optimisations at com... |

56 |
Detecting global variables in denotational specifications. ACM transactions on programming languages and systems
- Schmidt
- 1985
(Show Context)
Citation Context ... both referential transparency and acceptable efficiency. In the past, a number of solutions to this aggregate update problem have been proposed including run-time checks [10], syntactic restrictions =-=[23]-=-, and abstract interpretation [13, 3]. In this section we shall give yet another solution by showing how the nonlinear type system can be used in the implementation of arrays. 6.1 Implementation The l... |

46 |
The spineless tagless g-machine
- Jones, Salkild, et al.
- 1989
(Show Context)
Citation Context ...ble for implementing languages like NLML. We particularly favour an approach based on a machine that can make better use of sharing information, such as the TIM [5] or the Spineless Tagless G-machine =-=[22]-=-. It has been suggested to us that it might be better to dispense with the run-time machinery for dealing with linear values. Instead, all values would be stored in a single garbage-collected heap. De... |

42 |
Compiling Lazy Functional Languages, Part II
- Augustsson
- 1987
(Show Context)
Citation Context ...erative operations can be used in a referentially transparent way, and at the same time it highlights some of the problems with the approach. Our implementation is based on a variant of the G-machine =-=[15, 1]-=-. We give some benchmark figures to compare the performance of our machine with the original one. The results are disappointing: the cost of maintaining linearity in terms of lost optimisations at com... |

39 |
Linear logic and lazy computation
- Girard, Lafont
- 1987
(Show Context)
Citation Context ...implementation of a small functional programming language based on the linear -calculus. However, instead of attempting to apply what he calls the "brutish" compilation scheme of his publish=-=ed papers [8, 16] to a-=-n ordinary functional language, he designs his own linear functional language, called LIVE. This language exposes the programmer to the full rigours of the linear -calculus, and only a few "small... |

31 |
Update analysis and the efficient implementation of functional aggregates
- Bloss
- 1989
(Show Context)
Citation Context ... acceptable efficiency. In the past, a number of solutions to this aggregate update problem have been proposed including run-time checks [10], syntactic restrictions [23], and abstract interpretation =-=[13, 3]-=-. In this section we shall give yet another solution by showing how the nonlinear type system can be used in the implementation of arrays. 6.1 Implementation The literature describes two implementatio... |

28 |
A simple, lazy abstract machine to execute supercombinators
- Tim
- 1987
(Show Context)
Citation Context ...to abstract machine architectures suitable for implementing languages like NLML. We particularly favour an approach based on a machine that can make better use of sharing information, such as the TIM =-=[5]-=- or the Spineless Tagless G-machine [22]. It has been suggested to us that it might be better to dispense with the run-time machinery for dealing with linear values. Instead, all values would be store... |

19 |
A linear functional language
- HolmstrÃ¶m
- 1988
(Show Context)
Citation Context ...ion machine [24]), and the results of computations are never shared because the machine was designed to implement a linear language without any sharing at all. This can be very inefficient. Holmstrom =-=[11]-=- has described another functional programming language based on the linear -calculus. In his language all functions and data types inherit the linearity constraint from the linear -calculus. However, ... |

12 |
Lazy ML user's manual
- Augustsson, Johnsson
- 1993
(Show Context)
Citation Context ...time sacrificing the crucial property of referential transparency. In this paper we investigate the practicality of Wadler's approach, describing the design and implementation of a variant of Lazy ML =-=[2]-=-. A small example program shows how imperative operations can be used in a referentially transparent way, and at the same time it highlights some of the problems with the approach. Our implementation ... |

10 |
catÃ©gories et machines
- Logiques
- 1988
(Show Context)
Citation Context ...se types. One of the first decisions taken in the design of NLML was that providing linear versions of the basic types was not worthwhile. This decision was partly the result of reading Lafont's work =-=[16, 17]-=-, and partly the result of our unsuccessful attempts to write useful functions using linear integers. Conventional type variables are written as !*a and linear type variables are written as *a. Conven... |

3 |
A simple and efficient way to handle large data structures in applicative languges
- Holmstrom
- 1983
(Show Context)
Citation Context ... be updated while maintaining both referential transparency and acceptable efficiency. In the past, a number of solutions to this aggregate update problem have been proposed including run-time checks =-=[10]-=-, syntactic restrictions [23], and abstract interpretation [13, 3]. In this section we shall give yet another solution by showing how the nonlinear type system can be used in the implementation of arr... |

3 |
Private communication
- Wadler
- 1991
(Show Context)
Citation Context ...ust not be possible for u (or any component of u) to evaluate to x (or any component of x). Wadler formalises these requirements [26], but he is still unsure of how they relate to any existing theory =-=[27]-=-. We have avoided this construction on the grounds of its complexity, its poor interaction with lazy evaluation, and its dubious theoretical foundation. Wadler is currently trying to bridge the gap be... |

1 |
Linearity and laziness. DPhil thesis
- Wakeling
- 1990
(Show Context)
Citation Context ... the theoretically-based work of Lafont and Holmstrom and the more practically-based work of Guzm'an and Hudak. A more detailed account of our own work can be found in the first author's DPhil thesis =-=[28]-=-. 8 Conclusions and Future Work In this paper we have described the design and implementation of a functional language based on Wadler's approach to problems involving changes of state. Our work has r... |