I'm trying to figure out the best way of knowing which features are
implemented. Looking through the tests in languages/perl6/t/ is a bit
disappointing as some things I know have been implemented aren't there
(e.g., types on sub signatures). Should I be looking elsewhere?
So for right now, I'm looking at this:
sub foo(Int $x) {
say $x
}
foo(4);
That works just fine, so I know we have types on signatures. But now
this fails:
# remove the 'Int' and this works
sub fact (Int $n) {
if 0 == $n {
return 1;
}
else {
return $n * fact($n - 1);
}
}
say fact(5);
The failure is at runtime, not compile time (full output below), but
I'm not sure how to proceed since I don't know if this is supposed to
work yet. Do I consult tests? Follow the Rakudo blog? Religiously
read this list? (the latter's not much of an option because I love to
take breaks from email from time to time).
Cheers,
Ovid
Null PMC access in type()
current instr.: 'fact' pc 334 (EVAL_15:127)
called from Sub '_block11' pc 34 (EVAL_15:17)
called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806
(src/PCT/HLLCompiler.pir:481)
called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1088
(src/PCT/HLLCompiler.pir:610)
called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1267
(src/PCT/HLLCompiler.pir:699)
called from Sub 'parrot;Perl6::Compiler;main' pc 12318 (perl6.pir:174)
perl6(27829) malloc: *** Deallocation of a pointer not malloced:
0x31c1750; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug
perl6(27829) malloc: *** Deallocation of a pointer not malloced:
0x6bb04b; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6