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

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

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
November 30, 2014 00:14
Subject:
[perl #123322] "our" has the same scoping rules as "my" or "state"
Message ID:
rt-4.0.18-27925-1417306453-288.123322-15-0@perl.org
On Sat Nov 29 14:52:07 2014, ikegami@adaelis.com wrote:
> So sometimes "our" is scoped like "my", and sometimes it isn't? ow!
> 
> $ perl -E'use strict; $::x = "pkg";                say our $x, $x'
> pkgpkg
> 
> $ perl -E'use strict; $::x = "pkg"; my $x = "lex"; say our $x, $x'
> pkglex
> 
> I just said the docs weren't accurate, but now you tell me the behaviour is
> wacky too.

:-)

The stricture exemption applies to the current statement, but the lexical visibility is delayed till the following statement.

> The linked thread explains that introducing the wackiness was
> necessary because it was a maintenance release. But that's done. I just
> mentioned the docs were inaccurate, but some consistency (one way or
> another) would be nice.

A doc patch would be nice. :-)  (I would say ‘patches welcome’, but I have never seen a patch welcome anyone.)

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=123322

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