Proposal: opt-out local scoping

Yuh-Ruey Chen maian330 at gmail.com
Fri Sep 5 15:42:28 PDT 2008


Yes, Dave Herman already mentioned that, and I replied with this:

While this is true, this is far less of a problem than opt-in local
scoping, because the errors with opt-out local scoping are always going
to be local to the block/function the variable was assigned in.

Because of this, I believe the convenience is worth the cost.


Waldemar Horwat wrote:
> With this proposal you just get the dual problem:  You think you're assigning to an outer-scope variable while in fact you're creating and later discarding a local variable.  This would just flip the confusion you worry about to the other case without eliminating it.
>
> ES proposals already provide a good solution to this problem:  strict mode.  In strict mode you can't accidentally create a global just because you have a missing var.  You get an error if you try.
>
>     Waldemar
>   


More information about the Es-discuss mailing list