Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

[perl #53298] [BUG] inheritance not working?
# 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


Report this thread to moderator Post Follow-up to this message
Old Post
dakkar (via RT)
04-25-08 10:17 AM


Re: [perl #53298] [BUG] inheritance not working?
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



Report this thread to moderator Post Follow-up to this message
Old Post
Jonathan Worthington
05-01-08 01:38 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Perl 6 Compiler archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:58 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.