On 24 January 2012 18:49, Brendan Eich <[email protected]> wrote: > Andreas Rossberg <mailto:[email protected]> >> Consequently, I maintain my claim that it is impossible to reconcile >> sane let/const semantics with the idea of having toplevel bindings >> represented as data properties on the global object. > > I agree. For ES4 we equated let to var at top-level, a mistake. For ES6 IIRC > you have proposed an implicit block scope at top level (of functions at > least, I don't see why not programs as well), whereby let and const bind > lexically. Only var and function make global object properties.
Taken literally, an implicit block scope at toplevel would imply that let/const-bound properties won't show up on the global object at all. That seems to devalue the global object and/or let. (Part of) what I proposed in the OP of this thread is that for the toplevel, we can still safely reflect let/const bindings on the global object, but through accessor properties -- just like with module instance objects. Solves all the problems we just discussed, while also keeping let useful as the new var. Var would keep its current semantics, aliasing a data property. For functions, it doesn't matter much either way, but for consistency with other static bindings I'd move to accessor-based semantics in ES6. /Andreas _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

