I tried to replace tcl's tclproc.pir (a subclass of Sub that added
attributes via PIR) with a pmc version.

Here's my first attempt:

pmclass TclProc
    dynpmc
    extends Sub
    group   tcl_group
    hll     Tcl
    maps    Sub
{
    ATTR STRING       *PIR_source; /* the PIR level source */
    ATTR PMC          *namespace;  /* namespace of this sub */
    ATTR STRING       *HLL;        /* in our case, Tcl */
    ATTR STRING       *HLL_source;

    /* XXX should be able to combine these to be more perl6-y */
    ATTR PMC          *args;       /* declared arguments */
    ATTR PMC          *defaults;   /* defaults for args */
}

This builds just fine, but at run time, dies with:

set_attr_str() not implemented in class 'TclProc'

So, I go back to timer.pmc (where I grabbed the syntax from), up to
task.pmc... and I see there there's a 'set_attr_str()' there that
seems to be doing a LOT of heavy lifting to manage these attributes.

Is this right? Do we need to copy and modify this everywhere we want
to use ATTR? It seems like, if this wrangling is actually necessary,
that we should be automatically constructing set_attr_str() with the
pmc2c compiler.

-- 
Will "Coke" Coleda

Reply via email to