Re:The Birth and Death of JavaScript [video]
by MichaelGG on Friday April 18, 2014 @01:15AM
(#7608041)
If by cover you mean he essentially shrugs and says "it was the 90s" and moves on to ES6.
Re:The Birth and Death of JavaScript [video]
by skrebbel on Friday April 18, 2014 @03:01AM
(#7608231)
Which seems a pretty appropriate reaction, no? :-)
Seems he took the Wat talk a little personally, but I'm not sure why he defends {} + [] by saying the first { is a statement... wat?
Re:The Birth and Death of JavaScript [video]
by drostie on Friday April 18, 2014 @08:39AM
(#7608932)
It's because they wanted to say both:
if (a) b;
and if (a) { b; c; }
which tends to make you think of curly braces as a syntactic feature which can appear anywhere, turning many lines of code into one line of code. If you think that way then these should possibly also be valid: {b; c}
{b}
{}
but, since JS scope is function-oriented and in other places (e.g. functions) the braces are ultimately needed anyways, even for one-liners, it seems like this was a stupid choice and we should have just rejected the form: if (a) b;
and then the reuse of {} for lightweight (if non-robust) hashmaps would perhaps be unambiguous again.
Re:The Birth and Death of JavaScript [video]
by kbenson on Friday April 18, 2014 @09:52PM
(#7612243)
Which is exactly what Perl did, but to alleviate the clumsiness of single statement if conditionals they added a post-conditional if statement of the form STATEMENT if CONDITION; (which has the benefit of being how some people express simple conditionals in real life. "Go left if you see the blue house.")
It's automating semicolon insertion. The browser translates {} + [] into {}; + [], so + [] === 0 too. {}; is undefined.
Re:The Birth and Death of JavaScript [video]
by codeflo on Friday April 18, 2014 @03:32AM
(#7608299)
Being pedantic: it's NOT semicolon insertion. Your actual point is correct, the {} is an empty block statement, and the +[] is a separate expression statement. It's equivalent to "{} 0".
However, semicolon insertion is only triggered when there's a newline at a position where there would otherwise be a syntax error. Here, neither is the case: blocks don't have to be terminated by semicolon (so no syntax error), and there's no newline in the source code!
Re:The Birth and Death of JavaScript [video]
by celebril on Friday April 18, 2014 @05:24PM
(#7611400)
Brendan Eich is a homophobe and whoever links to his videos are complicit in his bigotry.
All his opinions should be discarded.
Re:The Birth and Death of JavaScript [video]
by archagon on Friday April 18, 2014 @05:44PM
(#7611504)
Nobody's opinions should be discarded based on their behavior. Otherwise, we'd have a scant few scientists, artists, and thinkers in history actually worth discussing. (Also, people who link to him are complicit? Are you serious?)
http://youtu.be/Rj49rmc01Hs?t=5m7s