perl6/Pugs.hs — Issue #11: 'state' declarations run their initialization assignments each time, not at START time
Author: masak
Created: 2012-03-09 13:59:01+00:00
State: open

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

All outputs should be equal to Niecza's.