On Fri, Dec 28, 2007 at 11:51:17AM +0900, Charles Oliver Nutter wrote:
> I was thinking about this a bit more today and I don't see how it's 
> particularly useful. If the namespacing is only local to some block or 
> other lexical structure...why don't you just call the methods directly? 
> What does it gain you?
>
> It seems like namespacing is only "really" useful if you can also have 
> namespace changes apply to calls further down the stack. In a lexical 
> context, I don't see what it gains you over just calling different methods.

It might not be desirable to call the methods directly if you don't know
what the type of the object is.  For example, if I have a method that
was passed an object as a parameter, I might import a namespace to get a
particular behavior for arrays in case the object passed in is an array.
But the object might not be an array, in which case I can't just change
the name of the method I call.

I do see the point about #each, but I'm having a hard time imagining
what the implications are of having the namespace apply further down the
stack.  What do we do if I call a method that imports a namespace which
conflicts with the one I've just imported?

Namespaces in Ecmascript appear to be lexically scoped:

http://docs.huihoo.com/web/js/es4/core/namespaces.html

I'm curious if implementors of other languages have thought about this
issue.  I wonder if we could get David Simmons to chime in, since he's
the one who pointed us here in the first place.

Paul