Code Comments
Programming Forum and web based access to our favorite programming groups.# New Ticket Created by dakkar # Please include the string: [perl #53298] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=53298 > parrot r27159, built on Linux, both x86-32 and x86-64 Running the attached program produces: > 5 > Null PMC access in morph() > current instr.: '!TYPECHECKEDASSIGN' pc 6754 (src/gen_builtins.pir:4728) > called from Sub 'parrot;Bar;set' pc 255 (EVAL_13:94) > called from Sub '_block10' pc 156 (EVAL_13:49) > called from Sub 'parrot;PCT::HLLCompiler;eval' pc 785 (src/PCT/HLLCompiler .pir:458) > called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1067 (src/PCT/HLLCo mpiler.pir:587) > called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1246 (src/PCT/HL LCompiler.pir:676) > called from Sub 'parrot;Perl6::Compiler;main' pc 8860 (perl6.pir:183) 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. -- Dakkar - <Mobilis in mobile> GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88 "Every group has a couple of experts. And every group has at least one idiot. Thus are balance and harmony (and discord) maintained. It's sometimes hard to remember this in the bulk of the flamewars that all of the hassle and pain is generally caused by one or two highly-motivated, caustic twits." -- Chuq Von Rospach, about Usenet
Post Follow-up to this messageHi,
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
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.