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

Bogus redeclaration error when doing a declaration inside a $() in an interpolating string in Rakudo #1953

Closed
p6rt opened this issue Jul 20, 2010 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jul 20, 2010

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

Searchable as RT76608$

@p6rt
Copy link
Author

p6rt commented Jul 20, 2010

From @masak

<masak> rakudo​: "foo$(my $x = 42)bar"; say $x
<p6eval> rakudo 3370f0​: OUTPUT«===SORRY!===␤Redeclaration of symbol $x [...]
<masak> hm, redeclaration?
<masak> std​: "foo$(my $x = 42)bar"; say $x
<p6eval> std 31772​: OUTPUT«ok 00​:01 118m␤»
<[particle]> what's that dollar for?
<masak> [particle]​: variable interpolation
<[particle]> oh, i missed the quotes.
<ash_> rakudo​: my $x; "foo$($x = 3)bar"; say $x;
<p6eval> rakudo 3370f0​: OUTPUT«3␤»
* masak submits rakudobug

It's OK for the time being to declare variables inside $() in qq
strings like this. But Rakudo complains about redeclaration, and it
shouldn't. Note that STD.pm6 doesn't.

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 10, 2011

From @coke

Same behavior in rakudo 38907e.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jun 9, 2013

From @jnthn

On Tue Jul 20 11​:48​:59 2010, masak wrote​:

<masak> rakudo​: "foo$(my $x = 42)bar"; say $x
<p6eval> rakudo 3370f0​: OUTPUT«===SORRY!===␤Redeclaration of symbol
$x [...]
<masak> hm, redeclaration?
<masak> std​: "foo$(my $x = 42)bar"; say $x
<p6eval> std 31772​: OUTPUT«ok 00​:01 118m␤»
<[particle]> what's that dollar for?
<masak> [particle]​: variable interpolation
<[particle]> oh, i missed the quotes.
<ash_> rakudo​: my $x; "foo$($x = 3)bar"; say $x;
<p6eval> rakudo 3370f0​: OUTPUT«3␤»
* masak submits rakudobug

It's OK for the time being to declare variables inside $() in qq
strings like this. But Rakudo complains about redeclaration, and it
shouldn't. Note that STD.pm6 doesn't.

Seems to work fine now​:

say "foo$(my $x = 42)bar"; say $x
foo42bar
42

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Sep 25, 2014

From @usev6

stmuk added a test for this recently​: Raku/roast@b4fc0fe

I moved the test from S02-names-var/76608.t to S02-literals/misc-interpolation.t (which is in 't/spectest.data').

The test passes on all rakudo backends.

@p6rt p6rt closed this as completed Sep 25, 2014
@p6rt
Copy link
Author

p6rt commented Sep 25, 2014

@usev6 - 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