ES4 note: Reserved namespaces

Lars Hansen lhansen at adobe.com
Mon Apr 28 19:10:17 PDT 2008


> -----Original Message-----
> From: Waldemar Horwat [mailto:waldemar at google.com] 
> Sent: 28. april 2008 18:39
> To: Lars Hansen
> Cc: es4-discuss
> Subject: Re: ES4 note: Reserved namespaces
> 
> I agree with everything except:
> 
> * reserved namespaces may not be aliased (ie they are illegal
>   on the right hand side of "=" in "namespace ns1 = ns2")
> 
> If we want to make reserved namespaces into keywords, 

We do not...

> that 
> might be ok.  However, at the current time they're not 
> keywords, and one could write:
> 
>   const foo = intrinsic;

But "foo" can't be used as a namespace qualifier in any
context, so that's OK.

> and:
> 
>   namespace instrinsic = my_namespace;

That one either shadows an existing namespace or causes an 
ambiguity, so I don't think that's a problem either.

> Being able to write those but not:
> 
>   namespace foo = intrinsic;
> 
> is just splitting hairs without achieving anything important. 

I disagree.  The rules guarantee that it is possible for the
implementation to determine statically whether a particular
fixture definition introduces a binding in one of the reserved
namespaces.  (That actually depends on namespace annotations
always being statically resolvable.   Some of the details
of how that's handled are still open but that's the goal.)

> You still shouldn't be able to define properties in the 
> reserved namespaces except as outlined in the proposal.
> 
> 
> One can also write:
> 
>   var intrinsic = 3;
> 
> which (I hope) would shadow the intrinsic namespace within 
> its hoisted scope.

It should, and it's considered desirable that this would work,
which is why the reserved namespaces are not reserved words.

--lars



More information about the Es4-discuss mailing list