On Tuesday 10 June 2008 07:50:41 Will Coleda wrote:

> 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.

The version in Exception is a lot simpler; that may be the way to go.

-- c

Reply via email to