Hi,

dakkar (via RT) wrote:
If I uncomment the $u.boo after the re-assignment to $u, I get a "Null
PMC access in get_string()"

It looks like inheritance is not working as I'd expect.

To make it "work", I have to move the 'set' method into Foo, and
remove all references to Bar.
Thanks for reporting. Initialization of attributes in parent classes hadn't been implemented; I've done that today. However, the code wasn't quite right. For attributes in parent classes, you must write them as an auto-vivification closure of the parent.

$u=Bar.new(Foo{ :x(12) });

Which is implemented now. So now your example with that fix and the one line uncommented gives:

5
12
9

As a bonus, if you try and do it the way you originally did, you will now get a more helpful error message too.

This was done in a few patches, but r27268 is the final one that actually gets your example running.

Thanks,

Jonathan

Reply via email to