Introducing Stateful Objects in a Transformation Calculus

Jacques Garrigue. In Proc. of the JSSST Workshop on Object-Oriented Computing. Hakone, 1993.

Abstract. When representing objects in a strongly typed functional language, two problems appear. One is to express inheritance, the other is to represent states. A lot of work has already been done on the first, through extensions of the typing system, but interest in the second is more recent. We limit ourselves here to this last problem of state representation.

To do this we use transformation calculus, an extension of selective lambda-calculus, itself an extension of lambda calculus allowing selection of arguments through labels. One can see this last one as a generalization of currying, the standard way of expressing multi-argument function in lambda calculus, to keyword-marked arguments. These two calculi include the lambda calculus as a sub-calculus, and we show that transformation calculus and selective lambda-calculus, as untyped calculi, are in some way isomorphic.

However, transformation calculus is meant to express state transformations, by using labels as identifiers. As such it proposes a basis for a functional representation of stateful objects. This is done by separating each object in methods, viewed as transformations, and a labeled state. Each object having its own label, a method modifying its state is just a transformation modifying the value attached to this label.

By such a representation, we can obtain powerful types, where side-effects are made evident, in perfect homogeneity with functional types. In this perspective, our goal here is more to use stateful objects as a representation for non-functional parts of a program, than to introduce object-orientation in functional programming.


You can get the postcript version of this paper wooc93-obj-trans-a4.ps.gz. (75375 bytes).

JG 93.11.24