Am Montag, 9. Oktober 2006 05:12 schrieb chromatic: > I'm experimenting with better forms of OO in PIR. I want to add a > get_parents() method on the Class PMC. Normally, I'd do something like the > attached patch, but the attached example file I use for testing shows that > it doesn't work for me.
You were probably looking for the C<get_mro> opcode. Your get_parents() is only returning the immediate parent(s) of that _class_ but not the full chain, which is in C<vtable->mro>. See also: perldoc src/ops/pmc.ops > I dug around a bit and couldn't find a reason for why it shouldn't work. You are calling it on a ParrotObject, which ought to delegate the call to it's class. But as said, you'd get only 'Child' in your case. > Note that I can't even call name() on a Class PMC either. Hm. As a method? You can't call any vtable function with method syntax. See also: http://perlcabal.org/~lt/toreview/Cfunc.pod But there is: inline op typeof (out STR, invar PMC) { $1 = VTABLE_name(interpreter, $2); goto NEXT(); } i.e. the C<typeof> opcode is the interface to the class name. > -- c leo