In Tcl, I've tried to add an attribute to a TclProc PMC (a thin
wrapper around .Sub) in my sandbox.
First, I have to override several methods in TclProc (copying them from
=item C<PMC* get_attr(INTVAL idx)>
=item C<PMC* get_attr_str(STRING *name)>
=item C<void set_attr(INTVAL idx, PMC *val)>
=item C<void set_attr_str(STRING *name, PMC *val)>
to avoid errors like:
set_attr_str() not implemented in class 'TclProc'
Once these are implemented, code like:
setattribute $P1, 'source', $P9
generates the exception:
Can't set non-core object attribs
If I try to add the attribute before setting, it's worse:
$P8 = getclass "TclProc"
addattribute $P8, 'source'
src/objects.c:1452: failed assertion `(class)->pmc_ext'
--
Will "Coke" Coleda
wi...@coleda.com
I'm not sure how I'm to access these via PIR: I get the same
src/objects.c:1452: failed assertion `(class)->pmc_ext'
error after applying this patch.
I'm going to go down the path of trying to implement TclProc as a
ParrotClass in PIR.
Thanks for the reply.