# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #126984] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=126984 >
<masak> m: sub foo($x) { say (* == $x)($_) given $x }; foo(1); foo(2) <camelia> rakudo-moar cfb1f3: OUTPUT«TrueFalse» * masak submits rakudobug Examining the expression printed, it basically says "$x should be numerically equal to itself" in a circuitous way. Since this is true for any integer, I'd expect the program to print "True\nTrue\n". Here's what's wrong: <masak> m: sub foo($x) { say (* ~ $x)($_) given $x }; foo(1); foo(2) <camelia> rakudo-moar cfb1f3: OUTPUT«1121» That "1" there in "21" is from the first call to &foo -- it shouldn't be there any more. But something in the WhateverCode (* ~ $x) holds onto the old $x. <masak> this bug brought to you by: Refactoring™ <lucasb> so... the WhateverCode is caching the first value it's *created* with? <masak> yes, but only if it's in a given <masak> m: sub foo($x) { say (* ~ $x)($x) }; foo(1); foo(2) <camelia> rakudo-moar cfb1f3: OUTPUT«1122»