4 ms·
After Coffeescript, it's really hard to go back to excess brackets everywhere. I really wish there was a Coffeetypescript.
by zyxley 11y ago
After Coffeescript, it's really hard to go back to excess brackets everywhere. I really wish there was a Coffeetypescript.
- acjohnson55 11y agoI used to feel the same way, but now I greatly prefer languages with brackets. Refactoring and auto-formatting in indentation-sensitive languages can be a real pain. Semicolons, though, I have no use for. Pity that omitting them in JS potentially leaves you open to some nasty issues.
- jessaustin 11y agoPity that omitting them in JS potentially leaves you open to some nasty issues. You may have seen this, but if not: http://standardjs.com/ http://standardjs.com/
- WorldMaker 11y agoI've been using semicolon-free Typescript a lot lately (and really liking it that way) and its transpiler is ASI (automatic semicolon insertion) aware so it ends up adding the semicolons back into its JS output, which you can use as a safety net if you are worried that you don't quite have a handle on ASI. That said, JS ASI is not much different than Python/Coffeescript newline rules and if you are comfortable programming semicolon free in those languages there shouldn't be a reason that you should feel uncomfortable going semicolon free in Typescript and/or JS. The nasty issues are in fact mostly the same as Python/Coffescript.
- Nadya 11y ago>Pity that omitting them in JS potentially leaves you open to some nasty issues. There is only a single instance I think of that is of legitimate concern - which is #4 listed on this blog [0]. The rest, to me, seem like arbitrarily shitty formatting or scenarios that never arise in an attempt to show why semicolons are needed. i ++ j Who would write that? Why would anyone write that? That being said - "remove all semicolons except the times you need semicolons" is silly. I also personally dislike the look of prefixed semicolons, so I'll continue to add semicolons. But I disagree the "nasty issues" are a legitimate concern anymore than "adding semicolons where they don't belong" is a legitimate concern. Both can bite you in the ass and both require a small understanding of where semicolons are needed and how Javascript gets parsed. Ultimately I think having semicolons will increase the amount of people who contribute - as people will be more comfortable with that style - but I think to have or to not have semicolons is a stylistic choice in the end. [0] http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding http://blog.izs.me/post/2353458699/an-open-letter-to-javascr...
- kin 11y agoIt sure can be an eye sore. But, I'd rather that than deal with ambiguity working with Coffeescript syntax.
- krapp 11y agoSignificant whitespace just swaps out visible "brackets" for invisible ones. It looks nicer, but the basic syntax is still there, and you have to highlight non-printing characters in your text editor to make sure you're not mixing whitespace types anyway. I understand why people might prefer the whitespace but to me the ambiguity and extra technical debt isn't worth the payoff in readability. I also like semicolons. Especially in javascript.