migrating `let' and `const'

Andy Wingo wingo at igalia.com
Wed Nov 16 03:05:31 PST 2011

Hi again,

Please excuse my ignorance, but:

On Tue, 2011-11-15 at 07:41 -0800, Brendan Eich wrote:

> To quote Waldemar from
> https://mail.mozilla.org/pipermail/es-discuss/2010-October/011972.html
> "It's a judgment call, and I'd take these on a case-by-case basis.
> For const and let, I see little harm in browsers allowing them now in
> strict mode with the purely non-hoisting (C++-like) scoping rules,
> particularly if they complained when you accidentally declared a
> variable twice directly in the same block."

So the current idea is that ES.next has different syntax and semantics,
and so in general the strategy would be to offer <script type="harmony">
and otherwise some form of "transpilation".

But you are also proposing to move some ES.next features into the
existing ES5.1 strict mode already provided by implementations?  This
would not be necessary if you relied on "transpilation" when targetting
older hosts.

Don't get me wrong, I think that adding block-scoped `let' and `const'
to strict mode is the right thing, but the big migration picture is
still a little unclear to me.  There seems to be some subset of ES.next
that will be implemented in ES5.1 strict-mode browsers, and some other
subset that will rely on versioning.


More information about the es-discuss mailing list