[self-interest] Re: Mirrors

Jecel Assumpcao Jr jecel at lsi.usp.br
Mon Jun 14 05:23:06 UTC 1999


Fedi at siscor.bibnal.edu.ar wrote:
> 
>                object _MirrorContentsAt: 'x'
> 
> I would like to know if this works the way I think, that is, that the
> primitive does a slot lookup through the parent slot (to find the slot
> 'x') and then returns the mirror on 'x', or if it fails.

No, this will only return a mirror on the contents of the slot
names 'x' in the receiver object itself. There are methods to
invoke a lookup, but you will probably get what you want with:

                object _Perform: 'x'

If 'x' in either the object itself or one of its ancestors is a
data slot, you will get the its content directly (not a mirror).
If it is a method slot, then the code will be executed which may
not be what you want.

The argument for the '_Perform:' primitive must be a cannonical
string (the equivalent of Smalltalk's Symbol). Literal strings
are always cannonical, but if you got the string as an argument
for a method or something you might want to ensure that it is
cannonical with something like this:

            object _Perform: str canonicalize

Of course, it is best to avoid using primitives directly like
this.

-- Jecel



------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/self-interest
http://www.egroups.com - Simplifying group communications






More information about the Self-interest mailing list