>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:

>> The "add" op would, in C code, do something like:
>> 
>> void add() {
>> P6Scaler *addend;
>> P6Scaler *adder;
>> 
>> addend = pop();  adder = pop();
>> push addend->vtable->add(addend, adder);
>> }
>> 
>> it would be up to the addend->vtable->add() to figure out how to do the 
>> actual addition, and what type to return.

DS> Yup. I think it'll be a little more complex than that in the call, 
DS> something like:

addend-> vtable->(add[typeof adder])(adder);

DS> The extra level of indirection may hurt in the general case, but I think 
DS> it's a win to call the "add an int scalar to me" function rather than have 
DS> a generic "add this scalar to me" function that figures out the type of the 
DS> scalar passed and then Does The Right Thing. I hope. (Yeah, I'm betting 
DS> that the extra indirect will be cheaper than the extra code. But I'm not 
DS> writing that in stone until we can do some benchmarking)

Is all that really necessary? Why not a non-vtbl function that knows how
to add numeric types?

I would have wanted to limit the vtbl to self manipulation functions.
Set, get, convert, etc. Cross object operations would/should be
outside the realm of the object. (It seems like trying to lift yourself
by the bootstraps.)

<chaim>
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to