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

inconsistency in "my $.foo; $.foo" #2281

Closed
p6rt opened this issue Nov 30, 2010 · 5 comments
Closed

inconsistency in "my $.foo; $.foo" #2281

p6rt opened this issue Nov 30, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Nov 30, 2010

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

Searchable as RT80008$

@p6rt
Copy link
Author

p6rt commented Nov 30, 2010

From @bbkr

Please check following example​:

[14​:27] <bbkr> rakudo​: my $.foo; say "alive"; $.foo
[14​:27] <p6eval> rakudo : OUTPUT«aliveâ�¤Null PMC access in find_method('foo')â�¤
in main program body at line 22​:/tmp/B60vOmq2flâ�¤Â»

Declaration of class attribute works in main scope. But accessing it does not.

Either appearance of $.foo in main scope should give error about useless
usage/declaration (for example like when you try to write "method foo {}" in
main scope).
This requires STD change I think, because now this syntax is legal.

Or...

Accessing $.foo should not give Null PMC access.

I don't know which one is correct (spec says nothing about class attributes
used in main scope).

@p6rt
Copy link
Author

p6rt commented Feb 1, 2012

From @coke

On Tue Nov 30 05​:36​:43 2010, pawel.pabian@​implix.com wrote​:

Please check following example​:

[14​:27] <bbkr> rakudo​: my $.foo; say "alive"; $.foo
[14​:27] <p6eval> rakudo : OUTPUT«aliveâ�¤Null PMC access in
find_method('foo')�
in main program body at line 22​:/tmp/B60vOmq2flâ�¤Â»

Declaration of class attribute works in main scope. But accessing it
does not.

Either appearance of $.foo in main scope should give error about
useless
usage/declaration (for example like when you try to write "method foo
{}" in
main scope).
This requires STD change I think, because now this syntax is legal.

Or...

Accessing $.foo should not give Null PMC access.

I don't know which one is correct (spec says nothing about class
attributes
used in main scope).

It now warns on the first statement, but proceeds to NPA on the last​:

09​:31 < [Coke]> rakudo​: my $.foo; say "alive"; $.foo # RT 80008
09​:32 <+p6eval> rakudo ce5cca​: OUTPUT«Useless declaration of a has-scoped
  method in mainlineâ�¤aliveâ�¤Null PMC access in find_method('foo')â�¤
  in block <anon> at /tmp/SJaI203Lww​:1â�¤ in <anon> at
  /tmp/SJaI203Lww​:1â�¤Â»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Feb 1, 2012

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

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @moritz

It now warns about the first, and dies with "Variable $.foo used where
no 'self' is availalbe" for the second, which I think is good enough to
close the ticket. The latter is tested in S32-exceptions/misc.t

@p6rt
Copy link
Author

p6rt commented May 29, 2012

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

@p6rt p6rt closed this as completed May 29, 2012
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