restrictions on let declarations

Brendan Eich brendan at mozilla.com
Thu Jan 30 11:00:16 PST 2014


John Barton wrote:
>  Not silly. Can you suggest any on-line that most JS developers can 
> understand discussing how these two forms differ?
>
> Here are some that describe them as equivalent:
>
> http://en.wikipedia.org/wiki/JavaScript_syntax#If_..._else
> http://msdn.microsoft.com/en-us/library/kw1tezhk(v=vs.94).aspx 
> <http://msdn.microsoft.com/en-us/library/kw1tezhk%28v=vs.94%29.aspx>
> http://programmers.stackexchange.com/questions/16528/single-statement-if-block-braces-or-no
> http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=%2Fcom.ibm.vacpp7a.doc%2Flanguage%2Fref%2Fclrc08csor.htm
> http://msdn.microsoft.com/en-us/library/ms173143.aspx
>
> and so on across multiple languages.  Whether or not you think these 
> forms should be different, programmers don't expect them to differ.

This is all beside the point, since the unbraced let as consequent of if 
cannot make a useful binding (if you use comma-separated multiple 
declarators, you still can't use any of the values that initialize the 
bindings except in later useless-outside-the-single-declaration consequent).

/be


More information about the es-discuss mailing list