Abstract
In Malenfant et al. [19], we have described a reflective model for a prototype-based language based on thelookup o 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 Δ 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.
Similar content being viewed by others
References
A.W. Appel.Compiling with Continuations. Cambridge University Press, 1992.
J.M.C. Baeten, J.A. Bergstra, and J.W. Klop. Term Rewriting Systems with Priorities. InRewriting Techniques and Appl., number 256 in LNCS, pages 83–94. Springer-Verlag, 1987.
P. Cointe. Metaclasses are First Class: the ObjVLisp Model.Proc. of OOPSLA'87, ACM Sigplan Notices, 22(12):156–167, December 1987.
O. Danvy and K. Malmkjaer. Intensions and Extensions in a Reflective Tower. InProc. of the 1988 ACM Symp. on Lisp and Functional Prog., pages 327–341, 1988.
N. Dershowitz and J.-P. Jouannaud. Rewrite Systems. InHandbook of Theoretical Computer Science, chapter 6, pages 244–320. Elsevier Science Publishers, 1990.
J. des Rivières. The Secret Tower of CLOS. InInformal Proc. of the First Workshop on Reflection and Metalevel Architectures in OOP, OOPSLA/ECOOP'90, October 1990.
J. des Rivières and B. C. Smith. The implementation of procedurally reflective languages. InProc. of the 1984 ACM Symp. on Lisp and Functional Prog., pages 331–347, August 1984.
C. Dony, J. Malenfant, and P. Cointe. Prototype-Based Languages: From a New Taxonomy to Constructive Proposals and Their Validation.Proc. of OOPSLA'92, ACM Sigplan Notices, 27(10):201–217, October 1992.
J. Ferber. Computational Reflection in Class Based Object-Oriented Languages.Proc. of OOPSLA'89, ACM Sigplan Notices, 24(10):317–326, October 1989.
B. Foote and R. E. Johnson. Reflective Facilities in Smalltalk-80.Proc. of OOPSLA'89, ACM Sigplan Notices, 24(10):327–335, October 1989.
U. Hölzle, B.-W. Chang, C. Chambers, and D. Ungar. The Self Manual, version 1.0. distributed with the Self software release, from Stanford University, July 1990.
IEEE, New-York.IEEE Standard for the Scheme Programming Language, IEEE Std 1178–1990 edition, 1991.
S. Jefferson and D.P. Friedman. “A Simple Reflective Interpreter,”Proceedings of the International Workshop on Reflection and Meta-Level Architecture, pp. 24–35 (November 1992), the extended version also appears in this volume.
G. Kiczales. Making Reflection Safe for Real-World Users. InInformal Proc. of the First Workshop on Reflection and Metalevel Architectures in OOP, OOPSLA/ECOOP'90, October 1990.
G. Kiczales, J. Des Rivières, and D. Bobrow.The Art of the Metaobject Protocol. MIT Press, 1991.
J. Lamping, G. Kiczales, L. Rodriguez, and E. Ruf. An Architecture for an Open Compiler. In [28], pages 95–106.
P. Maes. Concepts and Experiments in Computational Reflection.Proc. of OOPSLA'87, ACM Sigplan Notices, 22(12):147–155, December 1987.
J. Malenfant, P. Cointe, and C. Dony. Reflection in Prototype-Based Object-Oriented Programming Languages. InInformal Proc. of the Second Workshop on Reflection and Metalevel Architectures in OOP, OOPSLA'91, October 1991.
J. Malenfant, C. Dony, and P. Cointe. Behavioral Reflection in a Prototype-Based Language. In [28], pages 143–153.
A. Mendhekar and D.P. Friedman. Towards a Theory of Reflective Programming Languages. InInformal Proc. of the Third Workshop on Reflection and Metalevel Architectures in Object-Oriented Programming, OOPSLA'93, October 1993.
C.K. Mohan. Priority Rewriting: Semantics, Confluence, and Conditionals. InRewriting Techniques and Applications, number 355 in LNCS, pages 278–291. Springer-Verlag, 1989.
R. Muller. M-LISP: A Representation-Independent Dialect of LISP with Reduction Semantics.ACM TOPLAS, 14(4):589–615, October 1992.
C. Queinnec and P. Cointe. An Open-Ended Data Representation Model forEU_Lisp. InProc. of the 1988 ACM Symp. on Lisp and Functional Prog., pages 298–308. June 1988.
B.C. Smith. Reflection and Semantics in Lisp. InProc. of the 14th Annual ACM Symposium on Principles of Programming Languages, pages 23–35, January 1984.
D. Ungar and R. Smith. Self: The Power of Simplicity.Proc. of OOPSLA'87, ACM Sigplan Notices, 22(12):227–242, December 1987.
M. Wand and D. P. Friedman. The Mystery of the Tower Revealed: A Nonreflective Description of the Reflective Tower.Lisp and Symbolic Computation, 1(1):11–37, 1988.
T. Watanabe and A. Yonezawa. Reflection in an Object-Oriented Concurrent Language.Proc. of OOPSLA'88, ACM Sigplan Notices, 23(11):306–315, November 1988.
A. Yonezawa and B. Smith, editors.Proc. of the International Workshop on New Models for Software Architecture '92, Reflection and Meta-Level Architecture. RISE (Japan), ACM Sigplan, JSSST, IPSJ, November 1992.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Malenfant, J., Dony, C. & Cointe, P. A semantics of introspection in a reflective prototype-based language. Lisp and Symbolic Computation 9, 153–179 (1996). https://doi.org/10.1007/BF01806111
Issue Date:
DOI: https://doi.org/10.1007/BF01806111