Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

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

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

Comments

@masak
Copy link
Member

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant