LISP and Symbolic Computation, 9(2/3)153-179

A Semantics of Introspection in a Reflective Prototype-Based Language

Jacques Malenfant, D'epartement d'informatique et recherche op'erationnelle, Universit'e de Montr'eal, C.P. 6128, Succursale A, Montr'eal, Qu'ebec, Canada H3C 3J7
Christophe Dony, LIRMM, Universit'e de Montpellier, 161 rue Ada, 34392 Montpellier Cedex 5, France
Pierre Cointe, Ecole des Mines de Nantes, 4 rue Alfred Kastler, La Chantrerie, 44070 Nantes Cedex 03, France

Abstract: In Malenfant et al. [19], we have described a reflective model for a prototype-based language based on the lookup s' apply reflective introspection protocol. In this paper, we augment our previous protocol by converting it to handle continuations reified as first-class objects. First-class continuations provide much more control over the current computation; during the introspection phase fired by message sending, they make it possible not only to change the behavior of the program for that message but also for the entire future computation. In this paper, we provide this introspection protocol with a formal semantics. This result is obtained by exhibiting a mapping 1 from program configurations to priority rewrite systems (PRS) as well as a mapping from message expressions to ground first-order terms used to query the PRS. Other advantages of this approach are: to ensure the termination of the introspection using the smallest set of formally justified conditions and to provide a clear declarative account of this reflective protocol. The PRS also appears as a meta-level to the base language, independent of the implementation, but from which we derive fundamental clues to obtain an efficient language processor. By our new model, we finally highlight the link between reflection in object-oriented languages and the one originally proposed by 3-Lisp [24], although object-orientation provides reusability to reflection, making it easier to use.

Keywords: procedural reflection, object-oriented programming, reflective towers, priority rewrite systems, semantics

This article is not available online.
[picture of journal cover]

May 2003 - hosc@brics.dk