Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASI #18

Closed
NadyaNayme opened this issue Apr 1, 2015 · 2 comments
Closed

ASI #18

NadyaNayme opened this issue Apr 1, 2015 · 2 comments

Comments

@NadyaNayme
Copy link
Contributor

Automatic Semicolon Insertion (ASI) is not a feature. Don't rely on it. It's super complicated and there's no practical reason to burden all of the developers in a team for not possessing the frivolous knowledge of how ASI works. Avoid headaches, avoid ASI.

Always add semicolons where needed

To quote standard out of laziness:

No semicolonsIt's fine. Really!

There is only a single rule that is a real "gotcha!" and memorizing a single rule is not "frivolous knowledge of ASI".

I'm impartial about whether to avoid or use semicolons. However spreading FUD as the reason to use them should not be how a responsible developer does it. It's largely a stylistic issue. Feel free to advocate for the use of semi-colons but please make sure you aren't doing so under false reasons.

Regardless, I'd take a programmer with frivolous knowledge of how a language actually parses and functions over one who doesn't any day of the week.

Relevant to above statement:
http://www.slideshare.net/olvemaudal/deep-c

@bevacqua
Copy link
Owner

bevacqua commented Apr 1, 2015

Well. Knowing to use ; before ( and [ if they come after a \n, and not to do return\nvalue is not necessarily something to be proud of. I'd rather have code be consistent (just using ; everywhere), than having to bother following those rules.

Not really FUD, the rules are obtuse. The solution proposed by standard, where the linter watches for these corner cases and tells you to patch them is pretty elegant, though. You're welcome to create a pull request citing this alternative

@bevacqua bevacqua closed this as completed Apr 1, 2015
@NadyaNayme
Copy link
Contributor Author

That's a rather over-complicated way of saying "never start a line with ( or [ "... The specifics aren't overly important in that regard as the simple and easy to remember rule would prevent the specific "gotchas!" although the specifics are still good to know to better your understanding of the Javascript parser.

Code would be consistent with or without ; as long as it picked one style and stuck with it. ;)

Again, I don't care which people decide to use. So long as the code base is consistent. I actually prefer using ; , however my reasoning to do so is aesthetic in purpose rather than being based on FUD (we're going to have to agree to disagree on the information surrounding ASI being FUD or not it seems)

I'll submit a PR as suggested sometime tomorrow that proposes using a linter to watch for the "gotcha!" as an easy-fix to any possible ASI issues of not using semi-colons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants