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

Variables do not interpolate properly in double-quoted strings in regexes in Rakudo #2810

Closed
p6rt opened this issue Jul 3, 2012 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jul 3, 2012

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

Searchable as RT113958$

@p6rt
Copy link
Author

p6rt commented Jul 3, 2012

From @masak

<hoelzro> so I can do regex { ... "something $variable something" ... }?
<hoelzro> and $variable will be interpolated?
<moritz> yes
<tadzik> try it :)
<masak> hoelzro​: there's an evalbot.
<moritz> and it will be interpolated as a string
<moritz> not as a regex
<masak> r​: my $foo = '42'; say "there are 42 kangaroos" ~~ / "there
are $foo kangaroos" /
<p6eval> rakudo 16db64​: OUTPUT«#<failed match>␤»
<moritz> wat
* masak submits rakudobug
<hoelzro> moritz​: right
<masak> n​: my $foo = '42'; say "there are 42 kangaroos" ~~ / "there
are $foo kangaroos" /
<p6eval> niecza v19-7-g5e25209​: OUTPUT«#<match from(0) to(22)
text(there are 42 kangaroos) pos([].list) named({}.hash)>␤»
<hoelzro> that's what I would expect
<masak> niecza++
<moritz> niecza++
<moritz> hoelzro++ # finding a rakudobug
<masak> hoelzro++

@p6rt
Copy link
Author

p6rt commented Jul 3, 2012

From @masak

<moritz> r​: my $foo = '42'; say '$foo' ~~ /"$foo"/
<p6eval> rakudo cef445​: OUTPUT«q[$foo]␤␤»
* masak add's moritz' eval to the RT ticket

So variables in the double-quoted strings are simply not interpolated
currently, but left in place.

@p6rt
Copy link
Author

p6rt commented Jul 3, 2012

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 11, 2012

From @jnthn

On Tue Jul 03 01​:04​:58 2012, masak wrote​:

<hoelzro> so I can do regex { ... "something $variable something" ... }?
<hoelzro> and $variable will be interpolated?
<moritz> yes
<tadzik> try it :)
<masak> hoelzro​: there's an evalbot.
<moritz> and it will be interpolated as a string
<moritz> not as a regex
<masak> r​: my $foo = '42'; say "there are 42 kangaroos" ~~ / "there
are $foo kangaroos" /
<p6eval> rakudo 16db64​: OUTPUT«#<failed match>␤»
<moritz> wat
* masak submits rakudobug

Was just an NYI of sorts. Fixed now​:

my $foo = '42'; say "there are 42 kangaroos" ~~ / "there are $foo
kangaroos" /
q[there are 42 kangaroos]

Tagging testneeded.

Thanks,

/jnthn

@p6rt
Copy link
Author

p6rt commented Aug 13, 2012

From @moritz

There are two passing tests for that in S05-mass/rx.t, closing.

@p6rt
Copy link
Author

p6rt commented Aug 13, 2012

@moritz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant