Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is all spectacularly bad advice. Some of it is actually just false.

> A linebreak indicates, in most cases, the end of a statement; a semicolon is automatically inserted for you.

These are weasel words. Either a line break is the end of a statement or it's not. In JavaScript it is not.

> In order to be able to write properly working code, you need to be aware of the rules of Automatic Semicolon Insertion, regardless if you choose to add semicolons at the end of lines or not.

You absolutely do not. I don't care if you use semicolons or not, but don't claim that knowledge of ASI is required to write good JavaScript.

> Fix problems when you actually have them. Use the time you’ve freed up by not prematurely optimizing and spend it with your family or have a holiday on the beach.

Using deprecated features like __proto__ and arguments.callee is not something that you can trivially fix later. These are advanced features and I can't think of an easy why to duplicate their behavior once they are gone. You're going to have to rewrite a significant chunk of your code. Please never, ever use these features in libraries that are shared with other developers.



> Please never, ever write libraries that are shared with other developers.

FTFY


> These are weasel words.

No, actually, that's how it works in JS. ASI doesn't "work" in all cases because a line break doesn't always indicate the end of a statement. No less than Brendan Eich wrote this himself, in his blog post reply to the whole "semicolongate" which happened a couple weeks ago.

I'm sure it feels good to be all righteously angry… but it helps to be right.


Brendan's other words included:

> My two cents: be careful not to use ASI as if it gave JS significant newlines.

http://brendaneich.com/2012/04/the-infernal-semicolon/


Yes, and that's an opinion. And he doesn't say it is a fact.


http://www.thefreedictionary.com/weasel+word

> Weasel word: An equivocal word used to deprive a statement of its force or to evade a direct commitment.

From the article, emphasis mine:

> A linebreak indicates, in most cases, the end of a statement;


That's like saying that "Car crashes, in most cases, are not fatal" is weasel words at work, when in fact it's simply a fact. Car crashes are not fatal, in most cases. And in JS, a line break indicates the end of a statement, in most cases. It's in the spec for ASI.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: