Stanislav has asked for the wisdom of the Perl Monks concerning the following question:

Hi all I installed parrot in this way:
$ svn co https://svn.perl.org/parrot/trunk parrot $ cd parrot $ perl Configure.pl; make $ cd languages/perl6/; make perl6
Then I took an example of class from wiki http://en.wikipedia.org/wiki/Perl_6. Here is code:
#!/home/stas/perl/parrot/languages/perl6/perl6 class Point is rw { has $.x; has $.y; }
When I try to execute this script I get:
Attempt to inherit from non-existent parent class current instr.: 'die' pc 12249 (src/gen_builtins.pir:7489) called from Sub 'trait_auxiliary:is' pc 15862 (src/gen_builtins.pir:99 +27) called from Sub '_block13' pc 122 (EVAL_12:47) called from Sub 'parrot;PCT;HLLCompiler;evalpmc' pc 804 (src/PCT/HLLCo +mpiler.pir:468) called from Sub 'parrot;PCT;HLLCompiler;compile' pc 434 (src/PCT/HLLCo +mpiler.pir:303) called from Sub 'parrot;PCT;HLLCompiler;eval' pc 836 (src/PCT/HLLCompi +ler.pir:493) called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1201 (src/PCT/HL +LCompiler.pir:667) called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1380 (src/PCT +/HLLCompiler.pir:756) called from Sub 'parrot;Perl6;Compiler;main' pc 16140 (perl6.pir:168)
Where is problem? May be it's not implemented yet... Thanks

Replies are listed 'Best First'.
Re: Perl 6 class
by moritz (Cardinal) on Nov 18, 2008 at 15:34 UTC
    It seems that the is rw trait on a class is interpreted as is $classname (which means inheritance), and actually I'm not sure if the is rw trait on a class is even in the specs (Update: it's an example in the spec, but I'm not sure what it means).

    Try it without the first is rw instead. The ones on the attributes should be fine.

      Thanks moritz for the reply. I've already tried without 'is rw' and it works, and also I saw a spec. But, the question is why I see the same example in spec:
      Class traits are set using is: class MyStruct is rw {...}
      and also see the same construction in wiki and it isn't work. You wrote:
      (Update: it's an example in the spec, but I'm not sure what it means)
      I think it means (from the spec):
      If you declare the class as rw, then all the class's attributes default to rw, much like a C struct.
        Stanislav,
        I am not sure moritz's answer explained things completely. If you understood great. If not (for those following along at home), here is more of the story. Unlike perl 5, perl 6 will not be specification by implementation. It has an independent specification and any implementation that passes the perl 6 test suite will be consider perl 6. While the perl 6 specification is still changing (very slowly - more fine tuning at this point), there are a number of implementations that are in various stages of completion. The Rakudo (perl 6 on parrot) implementation is not yet meeting the spec in this regard. That's the simple answer.

        See Getting Involved with Perl 6 - an Update for more information.

        Cheers - L~R

        I've opened a ticket (perl 60636) for that, but I don't think it's high priority at the moment so it might take some time to get fixed (though patches are always welcome, and Patrick, Jonathan, Masak and I always try to review and apply them quickly).