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

[perl #67040] [BUG] state $x //= ... doesn't work

0 views
Skip to first unread message

Moritz Lenz

unread,
Jun 28, 2009, 3:05:28 PM6/28/09
to bugs-bi...@netlabs.develooper.com
# New Ticket Created by Moritz Lenz
# Please include the string: [perl #67040]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=67040 >


20:11 <@moritz_> rakudo: sub a { state $x //= 3; $x++; say $x }; a(); a()
20:12 < p6eval> rakudo 6c43f9: OUTPUT«4␤4␤»

Although that's better written as 'state $x = 3', it should IMHO give
the result 4\n5\n, not 4\n4\n

Cheers,
Moritz

jnthn@jnthn.net via RT

unread,
Jun 30, 2009, 12:06:24 PM6/30/09
to perl6-c...@perl.org
On Sun Jun 28 12:05:28 2009, moritz wrote:
> 20:11 <@moritz_> rakudo: sub a { state $x //= 3; $x++; say $x }; a(); a()
> 20:12 < p6eval> rakudo 6c43f9: OUTPUT«4␤4␤»
>
> Although that's better written as 'state $x = 3', it should IMHO give
> the result 4\n5\n, not 4\n4\n
>
Aye, agree. And after git 95a2c4f it now does.

> sub a { state $x //= 3; $x++; say $x }; a(); a()

4
5

Plus spectest for //= and state interaction unfudged.

Thanks,

Jonathan

0 new messages