Namespaces on definitions

Brendan Eich brendan at mozilla.org
Wed Apr 16 06:38:57 PDT 2008


On Apr 16, 2008, at 2:50 AM, Yuh-Ruey Chen wrote:

> I agree. I don't see why there should be multiple syntaxes that are as
> concise as each other and both have about equal precedent (AS3 vs.  
> E4X).
> If in some futuer spec, properties can inhabit multiple namespaces,  
> then
> we can consider the |ns1 ns2 ... var foo| syntax again.

The syntaxes are not equally concise, not only because :: is heavier  
visually and in terms of keyboard input (two shifted chars) than  
spaces. Consider

   ns var foo, bar;

vs.

   var ns::foo, ns::bar;

It's true you can't distribute one type across several variables:

   var foo:T, bar:T;

but that's not a reason to restrict namespace syntax per se.

Cases of ns including public, protected, private, and internal may be  
the most useful ones for this distributive syntax, but are those  
namespaces? Either way, the ns var foo syntax is more concise.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080416/62122be2/attachment-0002.html 


More information about the Es4-discuss mailing list