Re: Namespace vs. Scope

[email protected]
Newsgroups perl.trainers
Message-ID <[email protected]>
A very loose analogy is that a namespace is like "all the people
with the first name John" whereas a scope is "all the people who
live on my street."  In the first case, you're grouping by
nomenclature (variables named $main::something vs variables
named $other_package::something) and in the second you're
grouping by locality (all the my() variables in a particular
set of braces).

  -joseph

On 27 Jan, Jonathan Feinberg wrote:
> My students caught me off guard when they pointed out that sometimes I use 
> the word "scope", as when I'm discussing my(), and that sometimes I use the 
> word "namespace", as when I'm discussing packages.  They wanted me to help 
> them understand the difference, and I found myself nonplussed.  I don't 
> want to have to go into typeglobs and the package namespace hash, since 
> they're not ready for those concepts.
> 
> Is there any pithy way to distinguish between the two concepts?
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.