[self-interest] Finding out clones and prototypes

Jecel Assumpcao Jr jecel at merlintec.com
Tue Jul 13 02:26:09 UTC 2004


On Monday 12 July 2004 18:31, David Ungar wrote:
> Look at the creatorSlotHint stuff in object mirrors.
> It may do the sort of thing you want.
> It's how the environment can say "a point".

This is a reply to Oscar's second question - you can use this to decide 
if an object is "well known" or not. Normally anonymous objects are 
cloned from well known ones, but nothing forces this to be the case.

> Strictly speaking, there isn't supposed to be observable relationship
> between an object and what it was cloned from
> in Self.

In fact, even if access to implementation level (C++) "maps" were 
allowed, the system optimizes things by making objects with the same 
"shape" share maps, even if they got to be that way via very different 
paths instead of by one being a clone of the other (or both of the same 
object).

> On Jul 12, 2004, at 2:28 AM, oscar_lopez_p wrote:
> > Is there a fast way to get a reference to all the clones made from
> > an object?. Something like executing `aClass allInstances' in
> > Smalltalk.

Would a *very* slow way do? I evaluated

     enumerating all enumerate asList

and got a 262886 element list with a mirror for each object in the 
system (BareBones.snap). On that list's outliner, I evaluated

   | m <- reflect: 3 at 4 |
   copyFilteredBy: [ | :o | m keys = o keys ]

which resulted in a 1493 element list. I should also check that the 
values for all non assignable slots match, but this is enough in this 
particular case to be the equivalent of "Point allInstances".

-- Jecel



More information about the Self-interest mailing list