develooper Front page | perl.perl5.porters | Postings from December 2014

Re: [perl #123322] "our" has the same scoping rules as "my" or"state"

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
December 2, 2014 02:42
Subject:
Re: [perl #123322] "our" has the same scoping rules as "my" or"state"
Message ID:
20141202024214.GB15113@plasmasturm.org
* Eric Brine <ikegami@adaelis.com> [2014-12-02 01:55]:
> * Aristotle Pagaltzis <pagaltzis@gmx.de> [2014-12-02 00:55]:
> > Observe that the bare $x in the `say` statement resolves exactly the
> > same way as in your examples
>
> If you have to remove C<< use strict; >>, it's not "exactly the same".
> I could care less what Perl does without C<< use strict; >>.

You are proposing patches to the documentation so I could care less what
you could care less about. You don’t get to not care.

It absolutely is exactly the same even if I omitted the `use strict`:

    $ perl -E'use strict; $::x = "pkg"; our $x;        say my $x = "new", $x'
    newpkg

    $ perl -E'use strict; $::x = "pkg"; my $x = "lex"; say my $x = "new", $x'
    newlex

*Still* the same behaviour. (For those trying to follow at home: namely,
that the behaviour that $x resolves to whatever was already in scope is
not special to `our`, unlike the proposed new wording described it; and
instead this is true regardless of which declarator you use.)

But you could have known that yourself, had you actually been interested
in trying to understand what I was trying to show you about the thing
you were trying to document, instead of just looking for the first straw
to let you dismiss whether it matters.

So the rest of my points that followed from this one also still stand.

-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous | Thread Next


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