At 12:25 AM 9/27/2001 +0200, Samuele Pedroni wrote:
>Another question.
>
> >
> > We're going to call type a lot.
>Why? in which kind of code?
>it seems to me that the point of having an object-based VM is in
>order to avoid calling type a lot. What I'm missing?

Yeah, but this isn't a purely object based VM.

>Are you referring to the double dispatch code for arith ops or ...

Yup. Dispatch will look like:

    result = pmc1->vtable[ADD + pmc2->vtable[TYPE](pmc2, NUM)](pmc1, pmc2);

to get the right numeric addition vtable entry.

Most of the vtable functions have multiple entries, and the one we call is 
determined by the type of the second argument. A sort of short-circuit 
multi-method dispatch.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to