Why packages and namespaces?

Peter Michaux petermichaux at gmail.com
Wed Jan 30 09:17:19 PST 2008


On Jan 28, 2008 12:04 AM, Peter Michaux <petermichaux at gmail.com> wrote:

> Here is a concrete problem. I tried this in the reference implementation...
>
> package org {
>   public var ecmascript = {a: 1};
> }
>
> package org.ecmascript {
>   public var a = 2;
> }
>
> org.ecmascript.a   // 2
>
> How do I access the "org.ecmascript.a" that has value 1?
>
> How does the programmer writing the org package know that his "a" will
> be clobbered by the "a" in the  org.ecmascript package? Isn't the
> point of packages to avoid this type of problem?

Is this not considered a big problem? It seems like one to me.

Peter



More information about the Es4-discuss mailing list