Re: Namespaces

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sun, Apr 29, 2001 at 05:38:13PM -0500, Ted Fines wrote:
> Could you please explain namespaces?   Why are they important/good/possibly 
> bad?  Who uses them and why, etc?
> 
> Start at ground zero, as the only namespaces I deal with are on Netware 
> volumes, and are certainly unrelated to what you're referring to :).

Of course. Short answer: makes programming easier, as you don't
have to worry about name conficts (i.e. two functions with the name "foo").
Now for the long answer:
You see, in the early days of programming, programming languages didn't
even have variables, just memory addresses. As this was very complicated,
variables were quickly used to simply life. However, this introduced a new
problem: two variables with the same name. At first, it was pretty minor,
because people tended to write everything themselves. However, as
code-sharing gained popularity, it became an extreme cause of errors.
So, in euphoria, routines had their own set of variable names, and local files
have their own as well. That's why you have to use "global" to share a routine,
because of namespacing. The problem with euphoria is that it doesn't support
inline namespaces, which allow programs to define multiple scopes in a single
file. Basicly, you can have the infomation hiding of multiple files in a single
file. That's why namespaces are so useful.

> Thanks,
> Ted

You're welcome.
jbrown

-- 
Linux User:190064
Linux Machine:84163
http://jbrown105.1avenue.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu