restrictions on let declarations

John Barton johnjbarton at google.com
Thu Jan 30 09:28:29 PST 2014


On Thu, Jan 30, 2014 at 8:59 AM, Brendan Eich <brendan at mozilla.com> wrote:

> John Lenz wrote:
>
>> In my model
>>
>> if (y) let x = 42
>>
>> is equivalent to
>>
>> if (y) {
>>   let x = 42
>> }
>>
>> and it is clear "x" in "alert(x)" is 0;
>>
>
> It is as clear as those invisible braces in your model's input :-P.
>
> Come on, this is silly.


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://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.

jjb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140130/6f25eaf5/attachment-0001.html>


More information about the es-discuss mailing list