R James Noble kjx at comp.vuw.ac.nz
Thu Oct 15 07:44:42 UTC 1992

[Dear Editor - 
I thought this would be tricker than it was - it's only a three-line
fix, but in a rather delicate part of the system. This mesasge
includes the code, so I suppose I've half-answered my own question.
However, I'd still like other's opinions -kjx]

This is a rather strange question, but it may have some general
interest. The background is that I'm writing an abstract program
visualisation system in Self: as part of this is I'm attempting to add
some level of "dynamic reflection" to Self - allowing a program to
observe its own computation.

Currently, I've been doing this with "encapsulators" that alter the
structure of an object so that it reports messages it receives to a set
of dependent views. This alteration is carried out as much as possible
without interfering with the execution of the program to be

However, in my latest plans for a redesign, I'm considering merging
the encapsulator objects (responsible for the dynamic reflection) in
with Self's standard mirror objects (responsible for static
reflection). This should make the encapsulators design cleaner, and
also start moving the encapsulator system towards being a complete
metasystem for Self (currently, encapsulators do not allow you to
modify the operation of an object, only to observe the object's

The only problem I can see is that this would involve adding mutable
state to mirrors, that state being maintained by Self code. But
currently the system allows many mirrors upon the same object - if I'm
using mirrors to hold reflexive state this would be a problem. So I
would have to canonicalise mirrors, for example by having one
preferred mirror for a object, and checking the result of the _Mirror
primitive against a table to return only the canonical mirror.

After a little reflection :-)

    ^ reflect: x = (| mirrorTable = set copy.  mir|
        mir: x _Mirror.
        mirrorTable at: mir IfAbsent: [mirrorTable add: mir. mir])

Can anyone see any problems with this approach? Just out of (self)
interest, why aren't mirrors canonical at the VM level? (speed?)


James Noble, Graduate Student, Computer Science Department
Victoria University, Box 600, Wellington 1, New Zealand
kjx at comp.vuw.ac.nz

More information about the Self-interest mailing list