develooper Front page | perl.perl5.porters | Postings from July 2012

Re: [perl #113974] package NAMESPACE manpage comments

Thread Previous | Thread Next
From:
demerphq
Date:
July 6, 2012 08:21
Subject:
Re: [perl #113974] package NAMESPACE manpage comments
Message ID:
CANgJU+V4hOyngV9pQq4N+Ztzeh0ZzEoiRTK84WGp4VjTG+ffKA@mail.gmail.com
On 6 July 2012 17:19, Eric Brine <ikegami@adaelis.com> wrote:
> On Fri, Jul 6, 2012 at 4:30 AM, Linda W <perl-diddler@tlinx.org> wrote:
>>
>>  'my' has dynamic scope
>
>
> No, it does not. Contrast with local which provides dynamic scoping:
>
>>perl -E"sub f { say $x } { my $x = 123; f() }"
>
>>perl -E"sub f { say $x } { local $x = 123; f() }"
> 123
>
>
>>
>> in the it goes away at end of the physical boundaries (sans any references
>> to it).
>
>
> Yes, that's called lexical scoping. or static scoping. Did you follow the
> link I gave?
>
>>
>> It also dynamically is created when you enter the physical boundaries of
>> it's lexical scope.
>
>
> Scope has nothing to do with where are variable is created. Scope is
> entirely about where it's visible.
>
> You're also completely wrong about where and when it's created. A "my"
> variable is created at run-tine, and either cleared or recreated on scope
> *exit*.
>
>>
>> It's a new var at that point.
>
>
> Yes,
>
>>
>> Such isn't true with state or our.
>
>
> Not so. Equally new var there. A variable is an association between a name
> and an address. "state", "our", and "my" equally create variables.

our doesnt create anything.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

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