You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my Str $s = 'abc';
my @l = $s.comb.map(-> $g { /$g/ });
# time passes
@l.perl.say
Expect:
[/a/, /b/, /c/]
Got:
[/$g/, /$g/, /$g/]
The generated regexes do work, they just display wrong/useless. At the time I inspect the data structure, $g had been assigned multiple times with varying values and is long already out of scope.
21:27 | jnthn | Regexes ain't strings, they're compiled code; I suspect it is getting the closure semantics right, but you aren't going to see that reflected in the stringification of the regex, since that's really just carrying along its source
21:29 | MasterDuke | my Str $s = "abc"; my @l = $s.comb.map(-> $g { /$g/ }); say "a" ~~ @l[0]; say "a" ~~ @l[1]
21:29 | evalable6 | MasterDuke, rakudo-moar 99b67a4b6: OUTPUT: «「a」Nil»
21:29 | MasterDuke | jnthn++
21:30 | MasterDuke | jnthn: so you think https://github.com/Raku/old-issue-tracker/issues/6690 should be closed?
21:32 | jnthn | Yes, also the "$g has been assigned many times" thing is a bit confusing, given then it's a read-only parameter
21:32 | jnthn | But that issue seems to want things to work in a way that they fundementally do not
Migrated from rt.perl.org#133772 (status was 'new')
Searchable as RT133772$
The text was updated successfully, but these errors were encountered: