[perl #57230] Class variables with 'my' don't work in rakudo
On Wed Jul 23 14:56:05 2008, masak wrote: Using 'has' works in rakudo: $ perl6 -e 'class A { has $.x; method foo { say $.x } }; my A $a .= new; $a.foo' Object But using 'my' (to create a class attribute as per S12:616) doesn't work: $ perl6 -e 'class A { my $.x; method foo { say $.x } }; my A $a .= new; $a.foo' ...epic fail... I've done enough to get class attributes in place so as to pass this (and a good bit more besides). There's a bit more to do on them, but the basics at least work now. So will resolve this ticket; if we find other bits not working in relation to this, we can create more specific tickets for those. Thanks, Jonathan
[perl #57316] multisub in Test.pm causes complex subtraction to fail
# New Ticket Created by Jonathan Leto # Please include the string: [perl #57316] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57316 Howdy folks, I have attached a diff which includes a patch to is_approx() in Test.pm which prints out debugging information to STDOUT when is_approx() fails. It seems to be borking on subtracting complex numbers. This generates the following trace output when I run ../../parrot perl6.pbc log10.t 6309 new P25, Perl6Scalar P25=PMCNULL 6312 find_lex P8, $got P8=PMCNULL 6315 unless_null P8, 6P8=Float=PMC(0xb6c5eb38) 6321 find_lex P10, $expectedP10=PMCNULL 6324 unless_null P10, 6 P10=Complex=PMC(0xb6c5ea58) 6330 set_args PC16 (2), P8, P10 PC16=FixedIntegerArray=PMC(0x839403c) P8=Float=PMC(0xb6c5eb38) P10=Complex=PMC(0xb6c5ea58) 6334 find_sub_not_null P30, infix:- P30=PMCNULL 6337 get_results PC18 (1), P12 PC18=FixedIntegerArray=PMC(0x8394020) P12=PMCNULL 6340 invokecc P30 P30=MultiSub=PMC(0x8214548) 2226 get_params PC30 (2), P0, P1 PC30=FixedIntegerArray=PMC(0x8218464) P0=PMCNULL P1=PMCNULL 2230 new P2, ComplexP2=PMCNULL 2233 subtract P2, P0, P1 P2=Complex=PMC(0xb6c5da98: 0+0i) P0=Float=PMC(0xb6c5eb38) P1=Complex=PMC(0xb6c5ea58) set_number_keyed() not implemented in class 'Float' current instr.: 'is_approx' pc 6044 (EVAL_20:2140) called from Sub '_block11' pc 211 (EVAL_11:40) 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 14567 (perl6.pir:172) If anyone can point me in the right direction about what in the malarky is going on, that would be awesome. Cheers, -- [-] Jonathan Leto [EMAIL PROTECTED] Index: log10.t === --- log10.t (revision 0) +++ log10.t (revision 0) @@ -0,0 +1,7 @@ +use v6; +use Test; +plan 1; + +parrot_trace(1); + +is_approx(log10(-10 + 0i), 1 + 1i * pi / log(10), got the log10 of -10); Index: Test.pm === --- Test.pm (revision 29781) +++ Test.pm (working copy) @@ -61,13 +61,23 @@ multi sub isnt($got, $expected) { isnt($got, $expected, ''); } -multi sub is_approx($got, $expected, $desc) { -my $test = abs($got - $expected) = 0.1; +multi sub is_approx($got, $expected, $desc, $eps) { +say 4 arg; +my $residual = abs($got - $expected); +my $test = $residual = $eps; +unless $test { +print sprintf(got:\t %.8f differs from\nexpected: %.8f by\nresidual: %.8f\n, $got, $expected, $residual); +} proclaim($test, $desc); } -multi sub is_approx($got, $expected) { is_approx($got, $expected, ''); } +multi sub is_approx($got, $expected, $desc) { +say 3 arg; +is_approx($got, $expected, $desc, 0.1); +} +multi sub is_approx($got, $expected) { say 2 arg; is_approx($got, $expected, '', 0.1); } + multi sub todo($reason, $count) { $todo_upto_test_num = $num_of_tests_run + $count; $todo_reason = '# TODO ' ~ $reason;
[perl #57330] 'exit' from deep within rakudo call stack causes segmentation fault
# New Ticket Created by Carl Mäsak # Please include the string: [perl #57330] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57330 $ svn info | grep Revi Revision: 29791 The following works: $ ./perl6 -e 'exit' $ ./perl6 -e 'sub a { exit }; a()' But this doesn't: $ ./perl6 -e 'sub a { b() }; sub b { exit }; a()' perl6(26935) malloc: *** error for object 0x27c4c40: double free *** set a breakpoint in malloc_error_break to debug Segmentation fault
[perl #57340] Empty {} or pair {1=2} does not create anonymous hash in rakudo
# New Ticket Created by Carl Mäsak # Please include the string: [perl #57340] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57340 From S06 http://dev.perl.org/perl6/doc/design/syn/S06.html: ] {...} is always a block. However, if it is completely empty or consists ] of a single list, the first element of which is either a hash or a pair, it ] is executed immediately to compose a Hash object. ] ] [...] ] ] $obj = { 1=2, 3=4, 5=6 }; # Anonymous hash Rakudo is not up to spec on this point: $ ./perl6 -e 'my $a = { 1 = 2 }; say $a1' get_pmc_keyed() not implemented in class 'Closure' current instr.: '_block11' pc 39 (EVAL_13:21) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src/PCT/HLLCompiler.pir:481) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14567 (perl6.pir:172) $ ./perl6 -e 'my $a = {}; say $a.keys' Method 'keys' not found for invocant of class 'Closure' current instr.: '_block11' pc 39 (EVAL_13:19) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src/PCT/HLLCompiler.pir:481) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14567 (perl6.pir:172)
[perl #57336] Using attribute variables outside of methods causes strange errors in rakudo
# New Ticket Created by Carl Mäsak # Please include the string: [perl #57336] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57336 This works... $ ./perl6 -e 'class A { my $.a; method m { say $.a } }' ...and this... $ ./perl6 -e 'class A { has $!a; method m { say $!a } }' ...but not this... $ perl6 -e 'say $.a' error:imcc:syntax error, unexpected '\n', expecting '(' in file 'EVAL_13' line 11 Could not find non-existent sub self current instr.: '_block11' pc 11 (EVAL_13:11) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src/PCT/HLLCompiler.pir:481) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14567 (perl6.pir:172) ...nor this... $ perl6 -e 'say $!a' The opcode 'getattribute_p_ic_sc' (getattribute3) was not found. Check the type and number of the arguments current instr.: 'parrot;PCT::HLLCompiler;evalpmc' pc 744 (src/PCT/HLLCompiler.pir:448) called from Sub 'parrot;PCT::HLLCompiler;compile' pc 438 (src/PCT/HLLCompiler.pir:303) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 776 (src/PCT/HLLCompiler.pir:473) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14567 (perl6.pir:172) (Granted, they should throw errors, but errors related to using attribute syntax outside of a class definition.) This one could be made to work, but currently doesn't: $ perl6 -e 'class A { my $.a; say $.a }' error:imcc:syntax error, unexpected '\n', expecting '(' in file 'EVAL_13' line 27 Could not find non-existent sub self current instr.: 'parrot;A;_block22' pc 36 (EVAL_13:27) called from Sub 'parrot;A;_block21' pc 25 (EVAL_13:18) called from Sub 'parrot;PCT::HLLCompiler;evalpmc' pc 744 (src/PCT/HLLCompiler.pir:448) called from Sub 'parrot;PCT::HLLCompiler;compile' pc 438 (src/PCT/HLLCompiler.pir:303) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 776 (src/PCT/HLLCompiler.pir:473) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14567 (perl6.pir:172) perl6(27093) malloc: *** error for object 0x279c820: double free *** set a breakpoint in malloc_error_break to debug Segmentation fault This one probably shouldn't work, but it shouldn't segfault either: $ ./perl6 -e 'class A { has $.a; say $.a }' error:imcc:syntax error, unexpected '\n', expecting '(' in file 'EVAL_13' line 25 Could not find non-existent sub self current instr.: 'parrot;A;_block23' pc 33 (EVAL_13:25) called from Sub 'parrot;A;_block22' pc 25 (EVAL_13:18) called from Sub 'parrot;PCT::HLLCompiler;evalpmc' pc 744 (src/PCT/HLLCompiler.pir:448) called from Sub 'parrot;PCT::HLLCompiler;compile' pc 438 (src/PCT/HLLCompiler.pir:303) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 776 (src/PCT/HLLCompiler.pir:473) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14567 (perl6.pir:172) perl6(27084) malloc: *** error for object 0x27c9640: double free *** set a breakpoint in malloc_error_break to debug Segmentation fault
[perl #57318] Untodo a test
# New Ticket Created by Michael G Schwern # Please include the string: [perl #57318] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57318 The value can be used for attribute name in derived classes is passing on my machine. Remove the TODO flag. Index: t/spec/S12-class/inheritance.t === --- t/spec/S12-class/inheritance.t (revision 21559) +++ t/spec/S12-class/inheritance.t (working copy) @@ -43,12 +43,13 @@ #?rakudo skip 'stringification of objects' is($foo_bar.getme, $foo_bar, 'can call inherited methods'); -#?rakudo 4 todo 'various oo bugs' +#?rakudo todo 'various oo bugs' is($foo_bar.getme.baz, Foo::Bar::baz, 'chained method dispatch on altered method'); is($foo_bar.value, undef, 'value can be used for attribute name in derived classes'); my $fud; +#?rakudo 2 todo 'various oo bugs' lives_ok { $fud = $foo_bar.getme.fud }, 'chained method dispatch on altered method'; is($fud, Foo::Bar::fud, returned value is correct); -- Schwern What we learned was if you get confused, grab someone and swing them around a few times -- Life's lessons from square dancing
Re: [perl #57318] Untodo a test
Thank you, applied as r21575 in the pugs repository, where the tests are hosted. I see that you have a commit bit for the pugs repository already, so if you feel confident, go ahead and check in changes by yourself. Cheers, Moritz Michael G Schwern (via RT) wrote: # New Ticket Created by Michael G Schwern # Please include the string: [perl #57318] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57318 The value can be used for attribute name in derived classes is passing on my machine. Remove the TODO flag. Index: t/spec/S12-class/inheritance.t === --- t/spec/S12-class/inheritance.t(revision 21559) +++ t/spec/S12-class/inheritance.t(working copy) @@ -43,12 +43,13 @@ #?rakudo skip 'stringification of objects' is($foo_bar.getme, $foo_bar, 'can call inherited methods'); -#?rakudo 4 todo 'various oo bugs' +#?rakudo todo 'various oo bugs' is($foo_bar.getme.baz, Foo::Bar::baz, 'chained method dispatch on altered method'); is($foo_bar.value, undef, 'value can be used for attribute name in derived classes'); my $fud; +#?rakudo 2 todo 'various oo bugs' lives_ok { $fud = $foo_bar.getme.fud }, 'chained method dispatch on altered method'; is($fud, Foo::Bar::fud, returned value is correct); -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/
[perl #57310] [PATCH] Add Default Stringification of Objects
# New Ticket Created by chromatic # Please include the string: [perl #57310] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57310 From masak in IRC today: class A {}; say A.new polyglotbot OUTPUT[get_string() not implemented in class 'A' The attached patch fixes that, but it doesn't work yet due to some sneaky inheritance in P6Object. This has to wait on changes to vtable declaration and identification. -- c === languages/perl6/src/classes/Object.pir == --- languages/perl6/src/classes/Object.pir (revision 29799) +++ languages/perl6/src/classes/Object.pir (local) @@ -87,6 +87,18 @@ .return $P0.'hash'() .end +.sub 'get_string' :vtable :method +.local string what +what = self.'WHAT'() + +.local string name +name = 'obj:' +name .= what +name .= '' + +.return( name ) +.end + =item item() Return the scalar component of the invocant. For most objects,
[perl #57332] Matching against nonexistent class throws wrong kind of error
# New Ticket Created by Carl Mäsak # Please include the string: [perl #57332] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57332 $ svn info | grep Revi Revision: 29791 There's no problem matching against an extant class: $ ./perl6 -e 'class A {}; say mm, pie ~~ A' 0 But matching against an undefined class doesn't work: $ ./perl6 -e 'say mm, pie ~~ A' Method 'ACCEPTS' not found for invocant of class 'Failure' current instr.: 'infix:~~' pc 12501 (src/gen_builtins.pir:7936) called from Sub '_block11' pc 34 (EVAL_13:17) called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806 (src/PCT/HLLCompiler.pir:481) called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305 (src/PCT/HLLCompiler.pir:708) called from Sub 'parrot;Perl6::Compiler;main' pc 14567 (perl6.pir:172) Now, it shouldn't work (because A hasn't been defined), but * The error is all wrong. The class 'Failure' has got nothing to do with it. * It feels like this could/should be intercepted at BEGIN time, just like the `class DerivingClass is NotYetDefinedClass {}` error. In both cases, it's a question of an undeclared bareword.
[perl #57324] t/fetchspec is obsolete?
# New Ticket Created by Eric Wilhelm # Please include the string: [perl #57324] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57324 Hi, It seems that this file may be no longer used (no change since r25301 - 2008-01-27), or possibly just needs a comment to explain why it is different than the 'svn co' or 'svn up' which the Makefile does. Thanks, Eric
[perl #57346] parsefail on m/foo/ (/foo/ works)
# New Ticket Created by Adrian Kreher # Please include the string: [perl #57346] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57346 I've been adding tests to S05 for a few days, and I've noticed that the m/foo/ form fails, but /foo/ works. -- Adrian Kreher
[perl #57226] The statement '.say while =$*IN' makes parrot segfault
This has to do with 'while' not being recognized as a stdstopper in Rakudo yet. See #57352. Pm
[perl #57352] Implement stdstopper in grammar
# New Ticket Created by Patrick R. Michaud # Please include the string: [perl #57352] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57352 Currently Rakudo doesn't recognize certain keywords as being expression terminators -- examples would be 'while', 'if', 'for', etc. This is a placeholder ticket on which to link the other tickets that are awaiting this change in order to be fixed. Pm
[perl #57334] Zero-arg 'return' does not work with statement-modifier 'if' in rakudo
This is because statement modifiers aren't yet recognized as stdstopper in Rakudo's grammar yet. See #57352.