• Contents
  • Abstract Chapter 2
  • Abstract Chapter 3
  • Abstract Chapter 4
  • Abstract Chapter 5

  • Abstract Chapter 6

  • Summary
  • Samenvatting

  • Object Structures

    Objects in the object-oriented programming paradigm consist of a state and a number of methods. Objects interact by calling methods. The method of an object A, when applied, updates the state of A and may reply to its caller. Although the interaction between two objects is local, it has a global effect: all objects that had A in scope before the interaction, now should have A with a changed state in scope. In this chapter we present a small framework in a pure, strongly typed, functional language in which we can define objects of arbitrary state and objects that consist of objects of arbitrary state. The objects in these structures can interact locally. Because we work in a functional framework, we need to define this local interaction between any two objects in an arbitrary object structure on a global level. This meaning is defined by an interpretation function on the global object structure level. We show that it is not possible to define a well-typed interpretation function in a standard polymorphic Milner/Mycroft type system, but instead need to strengthen the type system with type classes and constructor classes. The importance of this class of structures is illustrated by two applications of the framework: we obtain a model of composable, communicating, state based processes, and show how to build composable graphical user interfaces with local state.