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

Lexicals declared outside of class not visible in the class #489

Closed
p6rt opened this issue Dec 14, 2008 · 8 comments
Closed

Lexicals declared outside of class not visible in the class #489

p6rt opened this issue Dec 14, 2008 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Dec 14, 2008

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

Searchable as RT61356$

@p6rt
Copy link
Author

p6rt commented Dec 14, 2008

From @masak

It feels a bit odd that the below two one-liners don't work the same
way in Rakudo r33860.

$ perl6 -e 'class A { my $a = method { say self.WHAT }; method x {
self.$a() } }; A.new.x'
A

$ perl6 -e 'my $a = method { say self.WHAT }; class A { method x {
self.$a() } }; A.new.x'
invoke() not implemented in class 'Undef'
[...]

@p6rt
Copy link
Author

p6rt commented Dec 17, 2008

From @jnthn

On Sun Dec 14 02​:26​:54 2008, masak wrote​:

It feels a bit odd that the below two one-liners don't work the same
way in Rakudo r33860.

$ perl6 -e 'class A { my $a = method { say self.WHAT }; method x {
self.$a() } }; A.new.x'
A

$ perl6 -e 'my $a = method { say self.WHAT }; class A { method x {
self.$a() } }; A.new.x'
invoke() not implemented in class 'Undef'
[...]

Actually it's a different problem. Because this works​:

my $a = method { say self.WHAT }; class A { method x($m) { self.$m() }
}; A.new.x($a)

It's actually because lexicals declared in the outer scope of a class
are not visible within the class (which in turn is, IIRC, due to a :load
:init with :outer bug in Parrot). So changing the title of this ticket
to reflect that.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Dec 17, 2008

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

@p6rt
Copy link
Author

p6rt commented Jan 1, 2009

From dave.whipp@gmail.com

example​:

<dwhipp>pugs​: my $global = 1; class A { method foo { say "foo =
$global" } }; A.foo
<p6eval>pugs​: OUTPUT«foo = 1␤»

<dwhipp>rakudo​: my $global = 1; class A { method foo { say "foo =
$global" } }; A.foo
<p6eval>rakudo 34765​: OUTPUT«foo = ␤»

@p6rt
Copy link
Author

p6rt commented Jan 2, 2009

From @pmichaud

This is a duplicate of RT #​61356, merging tickets.

Pm

@p6rt
Copy link
Author

p6rt commented Jan 2, 2009

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

@p6rt
Copy link
Author

p6rt commented Oct 20, 2009

From @moritz

This now works (as of 9d76f3), fixed by jnthn++, and unfudged tests.

@p6rt
Copy link
Author

p6rt commented Oct 20, 2009

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

@p6rt p6rt closed this as completed Oct 20, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant