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

END blocks don't see external variables #615

Closed
p6rt opened this issue Jan 12, 2009 · 8 comments
Closed

END blocks don't see external variables #615

p6rt opened this issue Jan 12, 2009 · 8 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 12, 2009

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

Searchable as RT62260$

@p6rt
Copy link
Author

p6rt commented Jan 12, 2009

From publiustemp-perl6compiler2@yahoo.com

This is blocking me implementing a simple 'plan "no_plan"' for tests.

  $ perl6 -e 'my $foo = "Goodbye cruel world!"; END { say $foo }'
  Scope not found for PAST​::Var '$foo' in

Revision​: 35423

Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

From @pmichaud

On Mon, Jan 12, 2009 at 12​:57​:44PM -0800, publiustemp-perl6compiler2@​yahoo.com (via RT) wrote​:

This is blocking me implementing a simple 'plan "no_plan"' for tests.

$ perl6 -e 'my $foo = "Goodbye cruel world!"; END { say $foo }'
Scope not found for PAST​::Var '$foo' in

Confirmed -- there are still issues with lexicals in a
variety of control blocks.

However, the easy workaround is to use "our" variables instead
of "my" if at all possible.

Pm

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

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

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

From @jnthn

Patrick R. Michaud wrote​:

Confirmed -- there are still issues with lexicals in a
variety of control blocks.

I skimmed the code for that today. I noticed that we compiled the blocks
right away and pushed them onto @​?END at compile time. Is there any
reason not to just compile them with everything else and give them a
loadinit that pushes them onto @​?END?

Jonathan

@p6rt
Copy link
Author

p6rt commented Jan 13, 2009

From @pmichaud

On Tue, Jan 13, 2009 at 05​:17​:16PM +0100, Jonathan Worthington wrote​:

Patrick R. Michaud wrote​:

Confirmed -- there are still issues with lexicals in a
variety of control blocks.

I skimmed the code for that today. I noticed that we compiled the blocks
right away and pushed them onto @​?END at compile time. Is there any
reason not to just compile them with everything else and give them a
loadinit that pushes them onto @​?END?

Sounds reasonable -- feel free to try that.

Pm

@p6rt
Copy link
Author

p6rt commented Jan 22, 2009

From @jnthn

On Tue Jan 13 08​:58​:08 2009, pmichaud wrote​:

On Tue, Jan 13, 2009 at 05​:17​:16PM +0100, Jonathan Worthington wrote​:

Patrick R. Michaud wrote​:

Confirmed -- there are still issues with lexicals in a
variety of control blocks.

I skimmed the code for that today. I noticed that we compiled the
blocks
right away and pushed them onto @​?END at compile time. Is there any
reason not to just compile them with everything else and give them a
loadinit that pushes them onto @​?END?

Sounds reasonable -- feel free to try that.

Did it and it works well, and resolves the original bug report.
Assigning to moritz for tests.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Jan 22, 2009

From @moritz

On Thu Jan 22 05​:25​:52 2009, jnthn@​jnthn.net wrote​:

On Tue Jan 13 08​:58​:08 2009, pmichaud wrote​:

On Tue, Jan 13, 2009 at 05​:17​:16PM +0100, Jonathan Worthington wrote​:

Patrick R. Michaud wrote​:

Confirmed -- there are still issues with lexicals in a
variety of control blocks.

I skimmed the code for that today. I noticed that we compiled the
blocks
right away and pushed them onto @​?END at compile time. Is there any
reason not to just compile them with everything else and give them a
loadinit that pushes them onto @​?END?

Sounds reasonable -- feel free to try that.

Did it and it works well, and resolves the original bug report.
Assigning to moritz for tests.

I can neither use outer lexicals in eval(), nor can I spawn (with
reasonable effort) another Rakudo and obtain its output, so all I can
test for atm is that "eval 'my $x; END { $x }'" works.
Which is now tested in S04-closure-traits/end.t.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jan 22, 2009

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

@p6rt p6rt closed this as completed Jan 22, 2009
@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