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

lexical wrongly evaluates to its value in the innermost closure. #2561

Closed
p6rt opened this issue Nov 25, 2011 · 5 comments
Closed

lexical wrongly evaluates to its value in the innermost closure. #2561

p6rt opened this issue Nov 25, 2011 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Nov 25, 2011

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

Searchable as RT104594$

@p6rt
Copy link
Author

p6rt commented Nov 25, 2011

From @cognominal

A combination of many conditions seem necessary for this to happen :
the lexical must braced within a string in a return statement of a
recursive function.

$ perl6 -e 'sub t($p) {   t $p-1  if $p-1 > 0;  return "{$p}" }; say t
3'1$ perl6 -e 'sub t($p) {   t $p-1  if $p-1 > 0;  return "$p" };
say t 3'3

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Nov 26, 2011

From @jnthn

On Fri Nov 25 07​:01​:02 2011, cognominal wrote​:

A combination of many conditions seem necessary for this to happen :
the lexical must braced within a string in a return statement of a
recursive function.

$ perl6 -e 'sub t($p) { � t $p-1 �if $p-1 > 0; �return "{$p}" }; say t
3'1$ perl6 -e 'sub t($p) { � t $p-1 �if $p-1 > 0; �return "$p" };
say t 3'3

Fixed​:

sub t($p) { t $p-1 if $p-1 > 0; return "{$p}" }; say t 3
3
sub t($p) { t $p-1 if $p-1 > 0; return "$p" }; say t 3
3

Needs tests.

/jnthn

@p6rt
Copy link
Author

p6rt commented Nov 26, 2011

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 30, 2012

From @moritz

Now tested in S02-literals/misc-interpolation.t

@p6rt
Copy link
Author

p6rt commented Jan 30, 2012

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

@p6rt p6rt closed this as completed Jan 30, 2012
@p6rt p6rt added the testneeded label Jan 5, 2020
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