perl6 / Pugs.hs

(ARCHIVE) Raku User's Golfing System in Haskell
84 stars 17 forks source link

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

Open masak opened 12 years ago

masak commented 12 years ago
<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.