'state' declarations run their initialization assignments each time, not at START time #11

Open
masak opened this Issue Mar 9, 2012 · 0 comments

Comments

Projects
None yet
1 participant
Owner

masak commented Mar 9, 2012

<masak> r: sub foo { state $a = 5; state $b = 42; $a++; $b--; say "$a $b" }; foo; foo; foo
<p6eval> rakudo a8086d: OUTPUT«6 41␤7 40␤8 39␤»
<masak> r: sub foo { state ($a, $b) = 5, 42; $a++; $b--; say "$a $b" }; foo; foo; foo
<p6eval> rakudo a8086d: OUTPUT«6 41␤6 41␤6 41␤»
* masak submits rakudobug
<masak> n: sub foo { state ($a, $b) = 5, 42; $a++; $b--; say "$a $b" }; foo; foo; foo
<p6eval> niecza v15-4-g1f35f89: OUTPUT«6 41␤7 40␤8 39␤»
<[Coke]> pugs: sub foo { state ($a, $b) = 5, 42; $a++; $b--; say "$a $b" }; foo; foo; foo
<p6eval> pugs b927740: OUTPUT«6 41␤6 41␤6 41␤»
<[Coke]> :(
* masak submits pugsbug
<[Coke]> danke.
<masak> p: sub foo { state $a = 5; state $b = 42; $a++; $b--; say "$a $b" }; foo; foo; foo
<p6eval> pugs b927740: OUTPUT«6 41␤6 41␤6 41␤»
<masak> Pugs' bug is deeper than Rakudo's. :)

All outputs should be equal to Niecza's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment