From: William Annis
Subject: Reflection
Date: 
Message-ID: <58pbuk$1iek@news.doit.wisc.edu>
	From time to time I see reverential references to "reflection"
in a language.  RScheme comes to mind.  What exactly does this mean?
What does it give me?

	(I just got SICP/2e.  The timing of this release is great for me.
I would never have expected to be able to get my own copy.  Hefty
price, though.)

--
William S. Annis                             Programmer 
Ofc: 608 262-6163 	      ·······@neurosim.wisc.edu
Department of Neurology             Neurosimulation Lab

From: Rainer Joswig
Subject: Re: Reflection
Date: 
Message-ID: <joswig-ya023180001312960113510001@news.lavielle.com>
In article <···········@news.doit.wisc.edu>, ·······@neurosim.wisc.edu wrote:

>         From time to time I see reverential references to "reflection"
> in a language.  RScheme comes to mind.  What exactly does this mean?
> What does it give me?

3Lisp and Common Lisp are other examples of languages with
reflective capabilities. The current buzzword for some
of these ideas is "Open Implementation". You may
also look for the phrase "Meta Object Protocol".

Basically it is about systems that have an explicit representation
of their inner workings and can make use of it.

3Lisp introduced the idea of an infinite tower of Lisp interpreters.
Usually an application will be executed by a Lisp interpreter
(in this case). But what if the Lisp interpreter itself is
written in Lisp? So the Lisp interpreter (l1) will be executed by a lower
level Lisp interpreter (l2). By programming in l2 you can change
the behaviour of l1. Also l2 will tell you everything you
need to know about the current state of l1. Now imagine that
you can also execute l2 by an Lisp interpreter: l3.
->  l4  ->  l5  -> ... -> ln
Here comes the idea of "reification". Your Lisp interpreter
allows you to look at its implementation.
What can you do with this power: Write debuggers, tracers, steppers,
alternative evaluation strategies, ... and most of
all you can impress your C++ friends.

Common Lisp has a Meta Object Protocol (MOP) for the Common Lisp
Object System (CLOS). CLOS is being defined in terms of CLOS.
Classes are instances of Meta Classes. Inheritance is being
determined by a Lisp function. What does the MOP give you?
Well, you can tailor the object system to your needs. It
enables optimizations otherwise only possible as kludges
(if at all). You can change the memory layout for
your CLOS objects if you have special needs (sparse
objects, persistent object system, DB integration, ...).
You also can implement whole new ways of object systems
with reusing the parts of CLOS you like. So CLOS
is an application of CLOS itself.

Rainer Joswig
From: Rainer Joswig
Subject: Re: Reflection
Date: 
Message-ID: <joswig-ya023180001312960119360001@news.lavielle.com>
In article <···········@news.doit.wisc.edu>, ·······@neurosim.wisc.edu wrote:

>         From time to time I see reverential references to "reflection"
> in a language.  RScheme comes to mind.  What exactly does this mean?
> What does it give me?

3Lisp and Common Lisp are other examples of languages with
reflective capabilities. The current buzzword for some
of these ideas is "Open Implementation". You may
also look for the phrase "Meta Object Protocol".

Basically it is about systems that have an explicit representation
of their inner workings and can make use of it.

3Lisp introduced the idea of an infinite tower of Lisp interpreters.
Usually an application will be executed by a Lisp interpreter
(in this case). But what if the Lisp interpreter itself is
written in Lisp? So the Lisp interpreter (l1) will be executed by a lower
level Lisp interpreter (l2). By programming in l2 you can change
the behaviour of l1. Also l2 will tell you everything you
need to know about the current state of l1. Now imagine that
you can also execute l2 by an Lisp interpreter: l3.
->  l4  ->  l5  -> ... -> ln
Here comes the idea of "reification". Your Lisp interpreter
allows you to look at its implementation.
What can you do with this power: Write debuggers, tracers, steppers,
alternative evaluation strategies, ... and most of
all you can impress your C++ friends.

Common Lisp has a Meta Object Protocol (MOP) for the Common Lisp
Object System (CLOS). CLOS is being defined in terms of CLOS.
Classes are instances of Meta Classes. Inheritance is being
determined by a Lisp function. What does the MOP give you?
Well, you can tailor the object system to your needs. It
enables optimizations otherwise only possible as kludges
(if at all). You can change the memory layout for
your CLOS objects if you have special needs (sparse
objects, persistent object system, DB integration, ...).
You also can implement whole new ways of object systems
with reusing the parts of CLOS you like. So CLOS
is an application of CLOS itself.

> 
>         (I just got SICP/2e.  The timing of this release is great for me.
> I would never have expected to be able to get my own copy.  Hefty
> price, though.)

SICP/2e is cool. You may also like to look at the new book "Lisp in Small
Pieces" from Christian Queinnec, which is about implementing
Lisp (Scheme in this case). It is a bit expensive, though - but a
great book.

Email me, if you need an ISBN number for "Lisp in Small
Pieces".

Rainer Joswig
From: Steve Austin
Subject: Re: Reflection
Date: 
Message-ID: <58qiop$98a@coranto.ucs.mun.ca>
·······@brain (William Annis) wrote:

>	From time to time I see reverential references to "reflection"
>in a language.  RScheme comes to mind.  What exactly does this mean?
>What does it give me?

I'm totally unqualified to answer this, but as no one else has...

I think the term is used to refer to a system's capacity to extend
itself at runtime, to generate and execute new code on-the-fly, and to
modify its existing code - the self-modifying code concept being
discussed in another thread. 

Paul Wilson has some good notes on this concept at:
   ftp.cs.utexas.edu/pub/garbage/schnotes/meta.txt
He is not in any way to blame for my garbled explanation.

>	(I just got SICP/2e.  The timing of this release is great for me.
>I would never have expected to be able to get my own copy.  Hefty
>price, though.)

My copy is winging its way to me from the MIT Bookstore as I write.

  -- steve

 
From: Michael Haynie
Subject: Re: Reflection
Date: 
Message-ID: <mbhaynie-ya023180001412962203590001@pgh.nauticom.net>
In article <··········@coranto.ucs.mun.ca>, ·······@terra.nlnet.nf.ca
(Steve Austin) wrote:

> ·······@brain (William Annis) wrote:
> 
> >       From time to time I see reverential references to "reflection"
> >in a language.  RScheme comes to mind.  What exactly does this mean?
> >What does it give me?
> 
> I'm totally unqualified to answer this, but as no one else has...
> 
> I think the term is used to refer to a system's capacity to extend
> itself at runtime, to generate and execute new code on-the-fly, and to
> modify its existing code - the self-modifying code concept being
> discussed in another thread. 
> 
> Paul Wilson has some good notes on this concept at:
>    ftp.cs.utexas.edu/pub/garbage/schnotes/meta.txt
> He is not in any way to blame for my garbled explanation.
> 
> >       (I just got SICP/2e.  The timing of this release is great for me.
> >I would never have expected to be able to get my own copy.  Hefty
> >price, though.)
> 
> My copy is winging its way to me from the MIT Bookstore as I write.
> 
>   -- steve
> 
>  
Um, I hate to quibble, but reflection as applied to intelligent systems
(say, people) means a kind of self-examination.  This *may* result in
self-modification.  

Reflection in programming languages refers to the ability of the language
to examine it's own structures.  Scheme makes a big deal of having all
sorts of odd structures (like stack closures) be "first class" objects. 
First class objects can be stored and accessed like symbols and numbers. 
Thus, reflective systems can give information about their current state
without resorting to user constructed information.

As far as utility, reflection aids greatly in the construction of
development systems, program analysis tools and the like.  The more you
want to know about the operation of a system, the more useful reflection
is.  It also allows the user to solve problems in novel ways (at least ones
that are novel to procedural systems).

SICP has much to say on this topic.

-- 
cul8r

Michael & Bobbi Haynie