On Wednesday 11 April 2007 05:40, Alek Storm wrote:

> On 4/11/07, Allison Randal <[EMAIL PROTECTED]> wrote:

> > Actually, setting :vtable without setting :method makes a great deal of
> > sense, if you want to override a low-level vtable operation without
> > adding a named method to the class.

> Just use the :anon flag.  It was designed for this.  Vtable methods are
> methods, and they're called as methods from C.

Both options seem slightly wrong to me.

Vtable methods are methods, yes, so they should receive the invocant 
automagically.  I don't believe they do this currently:

.sub 'set_integer_native' :vtable :method
    .param int size

    .local pmc size_pmc
    size_pmc = getattribute self, 'size'
    size_pmc = size
.end

(runs fine)

.sub 'set_integer_native' :vtable
    .param int size

    .local pmc size_pmc
    size_pmc = getattribute self, 'size'
    size_pmc = size
.end

error:imcc:The opcode 'getattribute_p_ic_sc' (getattribute<3>) was not found. 
Check the type and number of the arguments

Allison's right about method visibility outside of the vtable, and 
throwing :anon on there seems a little hacky.

However, requiring :method to make vtable methods actually work if you use 
self inside fails Allison's visibility problem.

-- c

Reply via email to