[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why Aren't Mirrors Canonical

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.

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