Linear and shared objects in concurrent programming

Abstract

Tese de mestrado, Engenharia Informática (Engenharia de Software), Universidade de Lisboa, Faculdade de Ciências, 2010Although mainstream object-oriented languages, like Java, are currently able to detect and prevent many programming errors by static type-checking, common usage-related errors are not captured and signaled to programmers. In general, no (formal) support is available in these languages for ensuring that an object is used according to the protocol which the programmer had in mind when describing the behavior of a class. The file reader protocol is a simple but clarifying example: first a file must be opened, then it can be read multiple times (though not beyond the end-of-file), and finally it must be closed. As client code is not checked for protocol conformance, trying to read the file without first opening it, or when it is closed, are simple disregards caught only by runtime exceptions, assuming the language is equipped with built-in support to handle errors and exceptional events. The MOOL programming language presented in this work is an attempt to formalize object usage and access. It consists in a simple class-based object-oriented language that includes standard primitives found in most object-oriented language formalisms. Additionally, the language offers constructs that can be attached at class definitions for specifying (1) the available methods based on an object state, and (2) how methods may be called in that state – by a single client, in which case we say that the object has a linear status, or without restrictions, in which case we say it has a shared one. We refer to this abstract view that defines an object state and status the class usage type. We formalize the language syntax, the operational semantics, and a type system that enforces by static typing that methods are called only when available, and by a single client if so specified in the class usage type. We illustrate the language capabilities by encoding in MOOL the protocols of two well-known examples: the file reader and the auction system. We have built a prototype compiler to implement our ideas, and its architecture is also described. Finally, we anticipate some of the related topics which we are interested in pursuing in future work

    Similar works