Re: Namespace vs. Scope
[email protected] (Nathan Torkington)
| Newsgroups | perl.trainers |
|---|---|
| Message-ID | <[email protected]> |
Jonathan Feinberg writes: > Is there any pithy way to distinguish between the two concepts? The basic problem is preventing two things of the same name from clashing with one another. One solution is to give the things unique prefixes, which is what namespaces are. You're not limiting which pieces of code can access the variables, merely keeping the names distinct. That's "namespaces" in a nutshell. The other solution is to limit the visibility of the variables, so that different pieces of code access different bits of memory even though they're using the same variable name. That's "scoping" in a nutshell. Nat