Strict mode recap

Brendan Eich brendan at
Fri Apr 11 14:15:35 PDT 2008

On Apr 11, 2008, at 12:51 PM, Lars Hansen wrote:
> There might be a slight misunderstanding here.  In my example, the  
> name C.ns is constant, not a general expression; C needs to be a  
> class, and ns needs to be a static namespace definition inside that  
> class (suitably available).

Oh, ok. The general expression for namespace qualifier syntax,  
whatever it will be, is what I was concerned about. If qualifiers in  
object literals must be identifiers that resolve to namespace  
definitions, then I'm not concerned about object initialisers being  
harder to analyze (for people or programs). Although this may be too  
restrictive, and I should share your concern about the loss of  
computed namespace qualifier use-cases.

> In my (repentant) opinion the ns in _any_ ns::id expression must  
> reference a namespace binding that was not introduced into the  
> scope by "with" (and I'm happy to outlaw all such expressions in  
> the body of a "with", if that helps keep it simple).


>  I think you're trying to say something else too but I can't figure  
> out what it is, something about the ns in ns::id being a literal in  
> a stronger sense than what I just outlined?

Let me try to be clearer. In ES3,

obj = {prop: value}

is sugar for

$tmp = new Object  // fixed in ES4 to not evaluate 'new Object'
                    // but instead use memoized Object type
$tmp.prop = value  // evaluate value only, not prop the literal id
obj = $tmp

All I am noting is that

obj = {ns::prop: value}

might want to involve no further evaluation of arbitrary expressions  
than the ES3 case.


More information about the Es4-discuss mailing list