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

It's just embracing the ASI. Nothing wrong with it. On the contrary, the understanding necessary to use it implies good knowledge of the language.


And is therefore more expensive to maintain.


It's probably less expensive to maintain, because programmers' brain reading the code while not having to parse the extra image information - which semicolons are, and they add a lot of clutter - gets less tired and in turn is less prone to make errors in other coding areas.

I see two camps here - people who fear the unknown or come from semicolon-mandatory languages and can't get used to the semicolon-less style, and informed people who don't fear to embrace what is aesthetically more pleasing and logically more sound, despite the persecution by the members of the first camp, which I'd say also happens to be more religion-prone.


I try to assume good faith with HN comments, but this smells like a troll.

In JavaScript, semicolons reduce ambiguity. Whether you know the semicolon rules in the language or not is immaterial to reducing ambiguity, similar to how defensive parenthesization is helpful regardless of whether you know the order of operations of a given language by heart. This is why the prevailing wisdom is to always use semicolons: principle of least surprise.

The nonsense about "persecution" and "more religion-prone" is just that. "Informed people" -- "aesthetically more pleasing" -- "logically more sound" -- ad hominem and begging-the-question horseshit. Do better.


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...


Yes, anything you can do to reduce ambiguity in the code will not only make it easier for the people who come after you, but it will reduce ambiguity between your mind and the implementation you're coding.


That's exactly the approach of no-semicolon javascript - only use them where they are needed to avoid ambiguity.


> Do better.

exactly. be an evangelist, not a brogrammer.


You don't think there's a third camp of people who know all about ASI but choose not to use it because their cognitive capacity (and that of their teammates, who may not spend weekends reading the ECMAScript spec) is better spent elsewhere?


It's probably less expensive to maintain, because programmers' brain reading the code while not having to parse the extra image information

In your estimation, is there a difference in experience between those JS coders who are knowledgeable of ASI and those who aren't?


> It's just embracing the ASI.

As opposed to embracing the rationally derived and broadly accepted coding guidelines used by over 99% of open-sourced javascript projects.

I could embrace linguistic documentation and still speak a form of English that would be unnecessarily dense or terse, or just plain incomprehensible to 99% of the English speaking public.


That's been done, and it's comprehensible to 90-95% on the other side. Bad analogy ;)

http://en.wikipedia.org/wiki/Differences_between_Afrikaans_a...


The point of programming is not to show off how well you know the language, else we'd be writing our C in trigrams and our JS in []()+!:

http://discogscounter.getfreehosting.co.uk/js-noalnum.php


Reductio ad absurdum.

The intention is to make code easier to read and type. The mental effort is the same.


And when legitimate bug reports are filed, they get ignored or worse, mischaracterised as the impure attacking his religion.




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

Search: