Does #class deserve to be a very-special shortcut bytecodeanymore?
Stephen Pair
spair at advantive.com
Sun Jan 6 02:22:41 UTC 2002
ducasse wrote:
> Since I saw the animorphic way of doing that, I'm really
> thinking that I want to try. Moving all the reflective stuff
> into mirror.
>
> I never wrote a primitive (yet). But for the instVarAt: the
> primitive right now works on the receiver and with mirror all
> the reflection will be on arguments.
>
> I would like to know if this means that I have to change the
> primitives like
> instVarAt: and recompile eveyrthing. May be I can try to add
> some primitives to have the system still running plus having
> mirrors. What is your experience?
>
> Stef
It's pretty straightforward to add a new primitive that works like an
existing one, but does it's work on an argument instead of the receiver.
In fact, a while ago someone (I think Tim) noted that you can actually
use existing primitives, but just compile them into a method with an
extra argument. You wouldn't need to re-compile everything, just change
the users of the old methods to use the mirror based protocol instead.
The problem I have with doing such things is that it breaks
encapsulation...ultimately, what would be good is to use a mirror based
scheme, but allow the object itself to govern what can and cannot be
done through the mirror, and to even override the default behaviors of a
mirror when reflecting on it.
- Stephen
More information about the Squeak-dev
mailing list
|