develooper Front page | perl.perl6.compiler | Postings from February 2012

[perl #80008] inconsistency in "my $.foo; $.foo"

From:
Will Coleda via RT
Date:
February 1, 2012 06:33
Subject:
[perl #80008] inconsistency in "my $.foo; $.foo"
Message ID:
rt-3.6.HEAD-14510-1328106787-1342.80008-15-0@perl.org
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



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About