Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #70469] [BUG] Either binding or lexicals are broken in Rakudo when recursing in methods

0 views
Skip to first unread message

Carl Mäsak

unread,
Nov 13, 2009, 8:30:25 AM11/13/09
to bugs-bi...@netlabs.develooper.com
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #70469]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=70469 >


$ cat /tmp/test
class M {
has M @.ms is rw;
method s($i=0) {
$i ~ "[{ map { "{$_.s($i + 1)}" }, self.ms }]"
}
}

my $m = M.new;
my $m2 = M.new;
$m2.ms = M.new;
$m.ms = M.new, $m2, M.new;
say $m.s;

$ perl6 /tmp/test
0[1[] 2[3[]] 4[]]

# expected output:
# 0[1[] 1[2[]] 1[]]

<masak> jnthn: did you fix my bug yet?
<jnthn> masak: no.
<jnthn> ENEEDMORECOFFEE
<jnthn> I looked at it, and then ran to the coffee machine. :-)
<masak> lol
* moritz_ also found it a bit hard to follow :-)
<masak> I think by golfing it I actually made it harder to follow. :/
<masak> when it was about indentation, it was immediate that it was wrong.
<moritz_> or if you gave them names (<a b c d e>) and print that along
with the number
<masak> the structure looks like this: Ma[Mb, Mc[Md], Me]
<masak> now, Mb and Me should be printed with the same indentation/number.
<jnthn> masak: ugh
<masak> but they aren't.
<jnthn> masak: Yes, I see the bug now.
* masak submits rakudobug
<jnthn> I agree it's wrong.

bugs-c...@netlabs.develooper.com

unread,
Nov 15, 2009, 12:43:55 PM11/15/09
to perl6-c...@perl.org
masak (>):

<masak> rakudo: sub f(@a, $i=0) { $i ~ "[{map { f($_, $i + 1) }, @a}]" }; say f([[], [[]], []])
<p6eval> rakudo 7347ec: 0[1[] 2[3[]] 4[]]␤
* masak adds that to #70469
<pmichaud> masak: I suspect that's related to dispatch/binder changes, but that's just a
guess.
<masak> pmichaud: same here.
<jnthn> Me too now I see it as a sub example.
<jnthn> masak: Default param to blame?
<masak> jnthn: I'll check.
<masak> rakudo: sub f(@a, $i) { $i ~ "[{map { f($_, $i + 1) }, @a}]" }; say f([[], [[]], []], 0)
<p6eval> rakudo 7347ec: 0[1[] 2[3[]] 4[]]␤
<masak> jnthn: no.
<jnthn> masak: Aww.
<moritz_> masak: dammit. I was just about to put it into S06-signature/defaults.t
<jnthn> lol
<masak> :)
<pmichaud> looks to me as though a new lexpad isn't being created somehow.
<jnthn> Yeah, the problem is in there somehow.
<moritz_> masak: and now I realize it's the wrong place, and I have no clue where to put it
<masak> moritz_: sorry :D

0 new messages