[comp.object] Reflection In Object-Oriented Systems

eberard@ajpo.sei.cmu.edu (Edward Berard) (10/12/89)

I have been researching the concept of "reflection" in object-oriented
systems, e.g.:

	- The series of papers in the OOPSLA '89 proceedings:

		- "Metaclass Compatibility" by Nicolas Graube

		- "Computational Reflection in Class Bases Object
		  Oriented Languages" by Jacques Ferber

		- "Reflective Facilities in Smalltalk-80" by Brian
		  Foote and Ralph Johnson

	- Pattie Maes oft cited article "Concepts and Experiments in
	  Computational Reflection" in the OOPSLA '87 proceedings

	- Nicolas Graube's article in the ECOOP '88 proceedings:
	  "Reflexive Architecture: From ObjVLisp to CLOS"

I am interested in accomplishing the following:

	1. Developing a definition for reflection which reflects the
	   _concept_, not a particular _implementation_ of reflection.

		a. I would like a fairly informal, intuitive
		   definition of the concept, preferably not tied to
		   any particular programming language

		b. I would also like a pointer to a _generally_
		   _accepted_ (if such a thing exists) formal
		   (mathematical) definition of reflection.

	2. Developing a taxonomy of reflection. Specifically, there
	   are types of reflection which are conceptually different
	   from each other, and one, or more, _conceptual_ models for
	   each of these different types of reflection. Of course,
	   taxonomy implies nomenclature, definition, and
	   classification.

	3. Developing a rationale for considering reflection. While I
	   will admit that the problem is intellectually intriguing, I
	   am looking for "practical" reasons for considering
	   reflection, e.g., why would your "typical object-oriented
	   software engineer" be interested in reflection?

I was in the process of formulating my own set of answers to the
above, when I remembered something someone said to me at OOPSLA '89:
"We just had a Birds of a Feather session on reflection, and there
still seems to be a great deal of confusion on just what reflection
is."

What are your thoughts on the matter?

				-- Ed Berard
				   Phone: (301) 353-9652
				   FAX:   (301) 353-9272

twl@brunix (Ted "Theodore" (W) Leung) (10/13/89)

In article <599@ajpo.sei.cmu.edu> eberard@ajpo.sei.cmu.edu (Edward Berard) writes:
>I have been researching the concept of "reflection" in object-oriented
>systems, e.g.:
>	- The series of papers in the OOPSLA '89 proceedings:
I haven't had a chance to look these over yet, but I will as soon as
my copy of the proceedings arrives...
>
>I am interested in accomplishing the following:
>	2. Developing a taxonomy of reflection. 

I'd be interested to hear about your classification of reflection types

>	3. Developing a rationale for considering reflection. 
At this point, I think that reflection has some applications to
building debugging tools and monitoring tools, in addition to the
applications mentions in Maes' paper.  You might also look at the
paper by Watanabe and Yonezawa in the OOPSLA '88 proceedings.  They
give some other examples.  At this point, I think that one of the most
distressing problems is that reflective systems are just very slow,
because of the overhead involved in maintaining a causal connection
between the meta system and the object system.  I think that one of
the places where reflection will prove to be most useful is the area
of self-adapting software.

--------------------------------------------------------------------
Internet/CSnet: twl@cs.brown.edu 	| Ted Leung
BITNET: twl@BROWNCS.BITNET		| Box 1910, Brown University
UUCP: uunet!brunix!twl			| Providence, RI 02912

ttwang@polyslo.CalPoly.EDU (Thomas Wang) (10/13/89)

What are reflections?

 -Thomas Wang ("This is a fantastic comedy that Ataru and his wife Lum, an
                invader from space, cause excitement involving their neighbors."
                  - from a badly translated Urusei Yatsura poster)

                                                     ttwang@polyslo.calpoly.edu

rh@mitre.org (Rich Hilliard) (10/14/89)

In article <599@ajpo.sei.cmu.edu> eberard@ajpo.sei.cmu.edu (Edward Berard) writes:

>   I have been researching the concept of "reflection" in object-oriented
>   systems...
>
>   I am interested in accomplishing the following:
>
>	   1. Developing a definition for reflection which reflects the
>	      _concept_, not a particular _implementation_ of reflection.

You want to take a look at the early papers by Brian Smith,
particularly his doctoral thesis at MIT, "Reflection and Semantics in
a Procedural Language" (1982).  Also check out Richard Weyhrauch's
"Prolegomena [I love that word!] to a Theory of Mechanized Formal
Reasoning" (Artificial Intelligence 13 (1,2) 1980).  Both happen to be
working in Lisp but that is not particularly important to what they
have to say.


>		   A. I would like a fairly informal, intuitive
>		      definition of the concept, preferably not tied to
>		      any particular programming language

Here's my intuitive, first order definition:

A "reflective system" contains a model of itself which it may access
(inspect) and manipulate to change its subsequent behavior.

* They call it reflection because that model is in some sense an
accurate depiction of itself (like a mirror, right?).

* The fact that the system, by manipulating the model, can modify
itself requires a "causal connection" between that model and the
system.

>		   b. I would also like a pointer to a _generally_
>		      _accepted_ (if such a thing exists) formal
>		      (mathematical) definition of reflection.

I too, would like to know of work on formal definitions, I posted a
query to comp.theory to just this effect, yesterday (see below), but
there aren't any "generally accepted" definitions.  One of the points
Smith and Maes and others make is that reflection is "theory-relative"
you can obviously only reflect on, inspect, and manipulate things that
you can refer to.

[My interest in this is that I want to use reflection as an approach to
specification.  My hypothesis is that if you adopt some form of
reflection as a first principle, you can define other descriptive
mechanisms in terms of it in such a way that those definitions can be
reasoned about.  The goal is a readily extensible, thus
understandable, specification language whose constructs or features
are all readily "provable".  But I can talk about this some other time.]


>	   2. Developing a taxonomy of reflection. Specifically, there
>	      are types of reflection which are conceptually different
>	      from each other, and one, or more, _conceptual_ models for
>	      each of these different types of reflection. Of course,
>	      taxonomy implies nomenclature, definition, and
>	      classification.

At a minimum, any such taxonomy will have to consider:

1. What can you reflect on?  [already you see distinctions in the
literature like computational (procedural, ...) vs. conceptual
(declarative) reflection, etc.]

2. When do you reflect? 

3. What modifications will the model allow?

When can the modifications take effect?


PREVIOUS POSTING to comp.theory:

Path: linus!rh
From: rh@mitre.org (Rich Hilliard)
Newsgroups: comp.theory
Subject: Formalization of the notion 'reflection'
Message-ID: <RH.89Oct12101331@linus.mitre.org>
Date: 12 Oct 89 14:13:31 GMT
Sender: rh@linus.UUCP
Distribution: comp.theory
Organization: Mitre Corporation, Bedford, MA.
Lines: 33



The notion of reflection, of a system's ability to inspect a model of
itself and possibly modify that model to cause a change to its
subsequent behavior, goes back to the work of people like Richard
Weyhrauch and Brian Smith.  Lately, you see "meta-programming"
facilities in object-oriented and logic programming languages (e.g.,
CLOS).

I would be interested to know of any work that attempts to formalize
some notion of reflective system, what are the essential properties of
a system to be reflective, etc.



Rich Hilliard
The MITRE Corporation  - Mail Stop A156
Bedford, MA  01730

(617) 71-7760

Internet: rh@mbunix.mitre.org
UUCP:  {decvax, philabs}!linus!rh
--

Rich Hilliard
The MITRE Corporation  - Mail Stop A156
Bedford, MA  01730

(617) 271-7760

Internet: rh@mbunix.mitre.org
UUCP:  {decvax, philabs}!linus!rh

jeff@aiai.ed.ac.uk (Jeff Dalton) (10/25/89)

In article <RH.89Oct13142047@linus.mitre.org> rh@mitre.org (Rich Hilliard) writes:
>>	   1. Developing a definition for reflection which reflects the
>>	      _concept_, not a particular _implementation_ of reflection.
>
>You want to take a look at the early papers by Brian Smith,
>particularly his doctoral thesis at MIT, "Reflection and Semantics in
>a Procedural Language" (1982). 

If you're interested in Brian Smith's work and want to see a very
clear presentation of how reflection can be accomplished in Lisp,
you should look at

   Alan Bawden.  Reification without Evaluation.  Proceedings
   of the 1988 ACM Conference on Lisp and Functional Programming.

From the abstract;

   Constructin gself-referential systems, such as Brian Smith's
   3-Lisp language, is actually more straightforward than you
   think.  ...  In particular, it is not necessary to redesign
   quotation, take a stand on the relative merits of evaluation
   vs. normalization, or treat continuations as meta-level
   objects. 

Run, don't walk; do not pass Go; etc.

Jeff Dalton,                      JANET: J.Dalton@uk.ac.ed             
AI Applications Institute,        ARPA:  J.Dalton%uk.ac.ed@nsfnet-relay.ac.uk
Edinburgh University.             UUCP:  ...!ukc!ed.ac.uk!J.Dalton