Toplevel 'let' binding can be left permanently uninitialized after an error

Isiah Meadows isiahmeadows at
Tue Nov 28 19:59:50 UTC 2017

And this is why I use `var` instead of `let` in REPLs. They're doing what
they're supposed to do; it's just unintuitive.

As a secondary proposal, I feel `let`/`const` in scripts should be allowed
to shadow existing globals at the top level *provided* they are not
declared in the same script. It'd solve the globals issue as well as not
require the parser to make calls to the runtime environment. Of course,
this means engines can't assume global `const` is immutable, but they
already do similar global checks, anyways (like if the variable was not
defined in that script).

On Tue, Nov 28, 2017, 14:31 Joseph <pacerier at> wrote:

> Re "x is irreparably hosed in your REPL"; you can still use it in
> subscope, eg <{let x=1;console.log(1)}>.
> On 29 November 2017 at 01:30, T.J. Crowder <
> tj.crowder at> wrote:
>> On Tue, Nov 28, 2017 at 5:05 PM, Joseph <pacerier at> wrote:
>> > You can still do `{x}`.
>> Can you expand on that? It doesn't seem to me you can. I mean, if even `x
>> = 42;` won't work (, I fail to see how
>> anything else using `x` would work, including `{x}` (
>>, `x`
>> is permanently in the TDZ as far as I can tell.
>> -- T.J. Crowder
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list