Why packages and namespaces?

T. Michael Keesey keesey at gmail.com
Wed Jan 30 10:15:47 PST 2008


On Jan 30, 2008 9:35 AM, Jeff Dyer <jodyer at adobe.com> wrote:
>
> Here's another example, which packages won't help with:
>
>   import org.ecmascript.a;
>   var org = {ecmascript: 4}
>
>   ... = org.ecmascript.a   // error: a is undefined in 'ecmascript'
>
[...]
>
> What do you suggest we do differently?

The obvious thing would be to change package reference syntax, e.g.,
by using a symbol other than periods. But this would break backwards
compatibility, so it's not an option.

In prior cases of language ambiguity, an alternate syntax was created.
For example "Array(x)" was ambiguous, so "x as Array" was created as
another way to cast variables. Similarly, there could be an alternate
syntax for inline package references, e.g.,
"package(org.ecmascript).a".

This kind of seems like language bloat, though. In practice, just
about everyone uses capitalized camel-humped names for classes and
lower-case camel-humped names for fields and methods, so this issue
doesn't come up.
-- 
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
http://exopolis.com/
--
http://3lbmonkeybrain.blogspot.com/



More information about the Es4-discuss mailing list