Call for opinions: attribute defaults and renaming "flexible"

Brendan Eich brendan at mozilla.org
Sun Aug 24 17:47:29 PDT 2008


On Aug 24, 2008, at 3:40 PM, Mark S. Miller wrote:

> Interesting point. We may have let property semantics again needlessly
> corrupt variable semantics.

That's a recurring risk due to the spec's modeling scopes via objects  
(a botch that most of us involved all along regret, but hard to fix  
in any kind of 3.x spec delta).


> Non-strict assignment to a non-writable
> property must fail silently for legacy compatibility. But I don't
> think there's any corresponding legacy constraint on assignment to a
> const variable. I agree that this should throw regardless of
> strictness.

Yes, it would be best to throw always -- this is easy to get right  
now, while we have the chance with ES3.1, for variables that do not  
map in the spec or implementations to properties.

But const at top level makes a global object property. And thanks to  
the spec's abusing objects for scopes, it seems to happen at function  
body top-level in function activations. If you have

function foo(x, z) {
     const y = x;
     return eval(z);
}

The spec talks about the activation object for foo having properties  
x and z, and any extension a la 3.1 would probably have to do  
likewise for const. Otherwise you're making a new kind of scope, not  
visible to eval'ed code.

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080824/be602b0e/attachment.html 


More information about the Es-discuss mailing list