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

[BUG w/ tests] 'our' variables in roles can't be accessed from the outside #1926

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

Comments

@p6rt
Copy link

p6rt commented Jul 10, 2010

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

Searchable as RT76450$

@p6rt
Copy link
Author

p6rt commented Jul 10, 2010

From @moritz

Fails with roles​:

18​:16 <@​moritz_> rakudo​: role Foo { our $pi = 3 }; say $Foo​::pi
18​:16 <+p6eval> rakudo 692aa1​: OUTPUT«Null PMC access in type()␤ in
main program body at line 20​:/tmp/M57BNs8HR2␤»

Works with modules​:

18​:16 <@​moritz_> rakudo​: module Foo { our $pi = 3 }; say $Foo​::pi
18​:16 <+p6eval> rakudo 692aa1​: OUTPUT«3␤»

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 21, 2011

From @coke

On Sat Jul 10 09​:18​:02 2010, moritz wrote​:

Fails with roles​:

18​:16 <@​moritz_> rakudo​: role Foo { our $pi = 3 }; say $Foo​::pi
18​:16 <+p6eval> rakudo 692aa1​: OUTPUT«Null PMC access in type()␤ in
main program body at line 20​:/tmp/M57BNs8HR2␤»

Works with modules​:

18​:16 <@​moritz_> rakudo​: module Foo { our $pi = 3 }; say $Foo​::pi
18​:16 <+p6eval> rakudo 692aa1​: OUTPUT«3␤»

This now says​:

20​:52 < [Coke]> rakudo​: role Foo { our $pi = 3 }; say $Foo​::pi
20​:52 <+p6eval> rakudo 63326f​: OUTPUT«Any()␤»
20​:53 < [Coke]> rakudo​: module Foo { our $pi = 3 }; say $Foo​::pi
20​:53 <+p6eval> rakudo 63326f​: OUTPUT«3␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 9, 2013

From @FROGGS

still​:

<FROGGS> rakudo​: role Foo { our $pi = 3 }; say $Foo​::pi
<camelia> rakudo fe7049​: OUTPUT«(Any)␤»
<FROGGS> rakudo​: module Foo { our $pi = 3 }; say $Foo​::pi
<camelia> rakudo fe7049​: OUTPUT«3␤»
<FROGGS> rakudo​: class Foo { our $pi = 3 }; say $Foo​::pi
<camelia> rakudo fe7049​: OUTPUT«3␤»

added test​:
Raku/roast@b30e9a8

@p6rt
Copy link
Author

p6rt commented Jul 30, 2015

From @jnthn

On Sat Jul 10 09​:18​:02 2010, moritz wrote​:

Fails with roles​:

18​:16 <@​moritz_> rakudo​: role Foo { our $pi = 3 }; say $Foo​::pi
18​:16 <+p6eval> rakudo 692aa1​: OUTPUT«Null PMC access in type()␤ in
main program body at line 20​:/tmp/M57BNs8HR2␤»

For reasons now described in S14, this is disallowed. It's also caught and reported at compile time. Test covering that in S14-roles/namespaced.t.

@p6rt
Copy link
Author

p6rt commented Jul 30, 2015

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

@p6rt p6rt closed this as completed Jul 30, 2015
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