Could we just drop the TDZ for let

Not so much an idea or a proposal as a random thought that just crossed my mind.

Couldn't we go ahead and just drop the TDZ for let?

One one hand you might say, "no this is impossible, that is set in stone now and we can't change it". This may be the truth!

But let's look at the other side:

  • The language generally evolves by turning former errors into valid code
  • You'd have write a really weird application for happy-path behavior to rely on a TDZ check throwing for correctness. I haven't done the research to be able to say if there are 0 usages of this pattern on the internet, but to the best of my knowledge it's plausible

And then we'd finally have good variables: locally scoped, fast. It wouldn't be table stakes for perf optimization to turn let into var anymore.

const really requires a TDZ check to avoid allowing access to uninitialized constants, so that would stay just how it is. Only let would be affected by this hypothetical change

agendas/2023/09.md at 313701c65d25ff959f62b2f81c3487bd464f85f3 · tc39/agendas · GitHub Had a topic on TDZ

var isn't going anywhere, you know. If you want a "TDZ-less" let, shouldn't var suffice?

Also, I'm not sure what's your use case. Can you provide an example?

It seems to me from the way that people vote with their feet that they have told us exactly what they want.

Bock scope.

No TDZ.