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

I happen to have a definite, knock-down argument in favour of a particular semi-column free style: mandatory indentation (which also eliminates curly braces).

http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-i...

I'll grant you that's not a large scale experiment on a peer reviewed paper. But I trust Chris Okasaki on this one, and to me, his experiment counts as strong evidence against semicolons and brackets. (Specifically, semicolons and brackets are error-prone, especially for beginners.)

Now for Javascript, I'd probably write the semicolons. Because there is some ambiguity in the way we humans would parse Javascript without semicolons. But really, the root of the problem is that Javascript's syntax is suboptimal. Sure, Dennis Ritchie didn't know better at the time he wrote C, but this is no longer an excuse.

If I had a say, I'd simply write an alternative syntax with mandatory indentation. It's not hard[1]. If Bootsrap's maintainer dislike semicolons so much, he probably should do so as well. He will likely lose contributors, but someone who cannot get past a Python-like syntax is probably not someone he would want to work with anyway.

[1]: http://www.tinlizzie.org/ometa/ (Quite the tool for the job. Plus, it already features a Javascript parser you can modify.)



Downvote? What could possibly warrant that? Not that I'm offended, but I am confused. I thought I was accurate and relevant. Did I get some fact wrong? Or did I say something offensive?

Re-reading my post, I find 2 potentially offensive excerpts:

"Dennis Ritchie didn't know better" Assuming mandatory indentation is superior, this one is flatly true (and there are other things to be said about the syntax of types). But I'm not saying he could have known better. As far as I know, no one knew better at the time.

"someone who cannot get past a Python-like syntax is probably not someone he would want to work with anyway" I apologize for this one, but I am personally fed up with people who won't use provably superior technology just because it would break their habits. Enforcing indentation in Javascript would be a minor syntax change, that can be learned in minutes and mastered in a day. I'd be wary of someone who refuses to make the leap despite the evidence for it. I must admit however that I'd understand if they just didn't believe in the evidence. (but then we can talk).


That's a score for coffeescript, but you don't want to start that discussion here...




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

Search: