Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$/ does not bind correctly in the right-hand side of s/// inside a for loop in Rakudo #4395

Closed
p6rt opened this issue Jul 11, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 11, 2015

Migrated from rt.perl.org#125598 (status was 'resolved')

Searchable as RT125598$

@p6rt
Copy link
Author

p6rt commented Jul 11, 2015

From @masak

<lucasb> m​: my $x = 'a1'; $x ~~ s/(\d+)/<$0>/; say $x
<camelia> rakudo-moar 58a5ed​: OUTPUT«a<1>␤»
<lucasb> m​: for 1 { my $x = 'a1'; $x ~~ s/(\d+)/<$0>/; say $x }
<camelia> rakudo-moar 58a5ed​: OUTPUT«Use of Nil in string context in
code at /tmp/SOTPBUyxHF​:1␤a<>␤»
* masak submits rakudobug
<masak> lucasb​: clearly that should work. thanks for finding it.
<masak> m​: my $s = "OH 819"; $s ~~ s​:g/(\d)/{chr(64 + $0)}/; say $s
<camelia> rakudo-moar 58a5ed​: OUTPUT«OH HAI␤»
<masak> m​: my $s = "OH 819"; for $s { s​:g/(\d)/{chr(64 + $0)}/; .say }
<camelia> rakudo-moar 58a5ed​: OUTPUT«Use of Nil in numeric context in
block at /tmp/4I0l1xSFeV​:1␤Use of Nil in numeric context in block
at /tmp/4I0l1xSFeV​:1␤Use of Nil in numeric context in block at
/tmp/4I0l1xSFeV​:1␤OH @​@​@​␤»

So, two cases of the same code, with and without a surrounding for
loop block. All these match, but in the presence of the for loop, $/
is Nil instead of the appropriate match object.

@p6rt
Copy link
Author

p6rt commented Oct 18, 2015

From @FROGGS

Patch​: rakudo/rakudo@32d7b08334
Tests​: Raku/roast@f665268fde

Closing ticket.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 18, 2015

From @FROGGS

Patch​: rakudo/rakudo@32d7b08334
Tests​: Raku/roast@f665268fde

Closing ticket.

@p6rt p6rt closed this as completed Oct 18, 2015
@p6rt
Copy link
Author

p6rt commented Oct 18, 2015

@FROGGS - Status changed from 'new' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant