Am Mittwoch, 1. November 2006 10:57 schrieb Nicholas Clark: > When serialising data structures, is parrot going to need to serialise any > anonymous or otherwise run time generated classes?
Yep, and it does so already. > If so, isn't this mechanism going to be capable of achieving "compile time" > class generation? Indeed. There's a hackish implementation[1] for achieving compile-time class (and object) creation: $ cat t/pmc/sub_42.pir .sub make_obj :immediate, :anon .local pmc cl, o cl = newclass "Foo" addattribute cl, 'x' o = new 'Foo' $P0 = new String $P0 = "ok 1\n" setattribute o, 'x', $P0 .return (o) .end .sub main :main .const .Sub o = "make_obj" $P0 = getattribute o, 'x' print $P0 .end $ ./parrot -o s42.pbc t/pmc/sub_42.pir $ ./parrot -t s42.pbc 23 set P1, PC8 ... 26 getattribute P0, P1, "x" ... P1=Object(Foo)= ... 30 print P0 P0=String=PMC(0xb61440 Str:"ok 1\n") ok 1 32 end (trace edited for clarity) But attaching the namespace to the class still suffers from the mentioned problem, only earlier so. > Nicholas Clark leo [1] the return result of the :immediate (if any) replaces the subroutine object.