Why numbered primitives?

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Fri Jul 7 07:08:28 UTC 2000


Daniel Vainsencher wrote:

> I'm interested in the historical reasons, but also in why they should
> persist.

No reason other than someone having to do it. Heard that one before?

> It would be cool to do implementorsOf when reading a primitive.
> Seems to me <primitiveAdd> is better than <primitive: 1>.

When people asked for compile time evaluated expressions a la ##(expr), I
realized that that would solve this problem; with this we might directly
write eg.

<primitive: ##(Interpreter theUsefulPrimitiveName)>

defining:

theUsefulPrimitiveName

    ^1

(This is just one way to do it, it could surely be done more neatly.)

The same scheme would also help up a lot of Slang code, which now has to
contain a lot of explicitly coded constants and expressions. These could be
replaced in the same manner by compile-time expanded expressions.

I was about to say that ##() was easy to do, and volunteer to do it, until
someone pointed out that the compiled method header would need to store the
symbols somehow, or doing senders wouldn't help since the bytecodes would
still just contain a 1 in this case, for example. That part  I don't
volunteer to mess with.

> After all, we want to make more VM hackers, don't we?
> 
> Daniel
> 

Well, I would prefer if they all first passed the Squeak fundamentals
courses before starting to hack the VM. But maybe that's just me.

Henrik







More information about the Squeak-dev mailing list