[ENH request] self class.

Michael van der Gulik squeakml at gulik.co.nz
Sun Oct 17 01:06:52 UTC 2004


lex at cc.gatech.edu wrote:
> Given that you can easily disable the optimization if you need to, I
> don't see the big fuss.  At best, it seems worth removing it if there is
> no performance gain.  If there is a performance gain, though, why not
> leave it in?

Okay, I'm in way over my head here and I'm arguing with giants.

I need to be able to capture the #class message. I'm using distributed, 
replicated objects - they aren't local. Craig Latta has done some fancy 
VM mangling to capture message sends. I'm doing it in a simpler way 
(i.e. the only way I know...):

I have a class, MessageCapture, subclassed from ProtoObject. I then 
override doesNotUnderstand: to capture messages. I went through a few 
images before it worked (hint... #become: is dangerous. Especially when 
applied to random objects). So far I can inspect and debug my 
MessageCaptured objects pretty well.

The problem is that a lot of the code in Squeak uses #class (e.g. in 
isKindOf:) to determine if an object is of a particular type. If you do 
[myReplicatedString class], you'd get MessageCapture instead of String 
as a response.

At the moment I'm doing quite well without modifying the VM in any way; 
it would be good if I could use stock images for as long as possible.

I don't see the big deal about speed improvements or degration less than 
a factor of 2. If speed is really a problem (and its not your choice of 
algorithm at fault), wouldn't it be better to make primitives, get a JIT 
working (on Intel for us poor people?), or do some Smalltalk->C compiling?

Mikevdg.





More information about the Squeak-dev mailing list