Skip Menu |
Report information
Id: 116595
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] Nesting wrapping roles bind 'callsame' to the wrong recipient in Rakudo
Date: Wed, 30 Jan 2013 12:51:08 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 1.3k
<masak> hm, not sure I can golf this significantly. <masak> does the following look odd to anyone? <masak> r: role Filter[$factor] { method next { repeat until $.value % $factor { say "R$factor, $.value"; callsame } } }; class Stream { has $.value is rw = 1; method next { say "bottom out $.value"; ++$.value }; method filter { self but Filter[$.value] } }; .next && say .value for Stream.new, *.filter ... * <p6eval> rakudo b3fc32: OUTPUT«(timeout)bottom out 1␤2␤R2, 2␤bottom out 2␤3␤R3, 3␤R2, 3␤bottom out 3␤R2, 4␤R2, 4␤R2, 4␤R2, 4 [...] <masak> more specifically, why, after 'bottom out 3', does it never bottom out again? <masak> it's a stack of nested roles, it should bottom out all the time. <masak> the fact that it doesn't feels like a mis-reference somewhere. <masak> n: role Filter[$factor] { method next { repeat until $.value % $factor { say "R$factor, $.value"; callsame } } }; class Stream { has $.value is rw = 1; method next { say "bottom out $.value"; ++$.value }; method filter { self but Filter[$.value] } }; .next && say .value for Stream.new, *.filter ... * <p6eval> niecza v24-18-gaf64300: OUTPUT«(timeout)bottom out 1␤2␤R2, 2␤bottom out 2␤R3, 3␤R2, 3␤bottom out 3␤R2, 4␤bottom out 4␤R5, 5␤R3, 5␤R2, 5␤bottom out 5␤R2, 6␤bottom out 6 [...] * masak submits rakudobug <masak> if I find a way to golf the thing, I'll add that to the ticket.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 558b
<masak> rn: role F[$n] { method x { callsame; callsame until $.v % $n } }; class S { has $.v is rw = 1; method x { ++$.v } }; my $s = S.new; for ^3 { $s.x; say $s.v; $s = $s but F[$s.v] } <p6eval> niecza v24-18-gaf64300: OUTPUT«2␤3␤5␤» <p6eval> ..rakudo b3fc32: OUTPUT«(timeout)2␤3␤» <masak> jnthn: this is as short as I'm able to golf it. <masak> jnthn: the problem happens in the 'callsame' in the 'until' loop, and the .x method in the S object never gets triggered. or rather, it gets triggered in Niecza, but it gets waylaid in Rakudo.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 693b
On Wed, 30 Jan 2013 07:17:38 -0800, masak wrote: Show quoted text
> <masak> rn: role F[$n] { method x { callsame; callsame until $.v % $n } > }; class S { has $.v is rw = 1; method x { ++$.v } }; my $s = S.new; for > ^3 { $s.x; say $s.v; $s = $s but F[$s.v] } > <p6eval> niecza v24-18-gaf64300: OUTPUT«2␤3␤5␤» > <p6eval> ..rakudo b3fc32: OUTPUT«(timeout)2␤3␤» > <masak> jnthn: this is as short as I'm able to golf it. > <masak> jnthn: the problem happens in the 'callsame' in the 'until' loop, > and the .x method in the S object never gets triggered. or rather, it > gets triggered in Niecza, but it gets waylaid in Rakudo.
Unchanged behavior in 2018.05-55-g95aa77c94 -- Will "Coke" Coleda


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org