4 ms·
I'll say that I disagree with just about every point made here and certainly not because of some religious fervor. I won't enumerate them all, and I completely
by bcrescimanno 15y ago
I'll say that I disagree with just about every point made here and certainly not because of some religious fervor. I won't enumerate them all, and I completely refuse to get drawn into the debate of semicolons vs. no semicolons; but statements like this,
"Whether you like it or not, whitespace is significant in JavaScript. A linebreak indicates, in most cases, the end of a statement; a semicolon is automatically inserted for you."
Are just flat out absurd. Like it or not, automatic semicolon insertion is NOT significant whitespace and the second sentence completely contradicts the first by pointing out that ASI happens in MOST cases--but not all. If whitespace were truly significant, it would apply in ALL cases. Again, I'm not debating whether you should use semicolons or not--but I'm willing to flat out state that Javascript does not have significant whitespace; no matter how you want to spin it.
That said (and now here comes the "someone had to say it department") this strikes me, yet again, as Thomas being contrarian for the sake of getting a rise out of folks to draw attention to himself. I mean no disrespect with this statement; but anyone who has followed him for a long time on Twitter knows that he's apt to taking an unpopular position and leveraging it as a marketing opportunity for himself (and, by extension, his consulting and training enterprises). That's a fine approach; but, I felt it time someone identified it for what it is. Thomas is a smart dude and he's built some amazing things; but his public persona and style is carefully crafted and contrarian and we're all buying in by popularizing the debates he either creates or catalyzes.
[Edit: fixed a typo]
- ahoyhere 15y agoWhitespace is significant sometimes, and not other times. That's the fact of the language design/ASI itself, not Thomas being contrary. As to this: leveraging it as a marketing opportunity for himself (and, by extension, his consulting and training enterprises) Thomas doesn't consult any more, and hasn't for years, and we have almost entirely discontinued our training workshops, because they are too much work. However, when we want some extra cash and put one on, they sell out regardless of what we say or do, because Thomas' real life JavaScript experience (crafting amazing libraries which jumpstarted the dynamic web, used by millions) and my real life teaching experience speak for themselves. Yours is a fallacious argument.
- bcrescimanno 15y agoYour entirely predictable defense of your husband notwithstanding; I don't mean to diminish Thomas's contributions to the Javascript community at large nor the quality of the work he does. I hope I made that point entirely clear in my original post (and if I hadn't, I hope I am doing so now). I call it how I see it; and I see no need to repeat myself as to why I believe what I posted. Attempting to call my argument fallacious with absolutely no justification other than correcting one minor (and somewhat irrelevant given that self-marketing is important regardless of one's current occupation) incongruity is little more than an attempt to drag me into a 2-on-1 battle royal in which I refuse to participate.
- ahoyhere 15y agoYou spent 47% of your words in your comment on that paragraph because "somebody had to say it", and it was incorrect. Is 50% of what you write being incorrect a "minor" issue? And as for my entirely predictable defense of my husband… anyone who's watched us work together would laugh at that statement. But in this case, he's right, and you barely mounted an argument except that: "Whitespace isn't significant" -- except that, of course, by ASI rules, it is sometimes and not others. You can argue over the meaning of the word "significant" and say it is all or nothing, but that is not what the rules of ASI indicate. Call it what you will -- sometimes it is, sometimes it isn't. "This is a calculated marketer at work, trying to sell consulting and training" -- which is untrue. As for my comment being "little more than an attempt to drag me into a 2-on-1 battle royal" -- is Thomas even addressing you? Not at all, from what I can see.
- bcrescimanno 15y agoOnly responding to clarify: the only part I will admit was incorrect was the quote, "and, by extension, his consulting and training enterprises." Everything else I said I stand by 100%. Maybe I'm wrong and that's not his intent--but it's certainly the perception I have; having watched this same scene play out time and again.
- 14y ago
- chc 15y ago>but statements like this, >"Whether you like it or not, whitespace is significant in JavaScript. A linebreak indicates, in most cases, the end of a statement; a semicolon is automatically inserted for you." >Are just flat out absurd. Like it or not, automatic semicolon insertion is NOT significant whitespace and the second sentence completely contradicts the first by pointing out that ASI happens in MOST cases--but not all. If whitespace were truly significant, it would apply in ALL cases. I don't mean to gang up on you, but that just isn't right. Will you agree that newlines are significant in both Ruby and Python? Because both of those have cases where newlines are not terminal. So I think this absolutist stance is quite unreasonable. Automatic semicolon insertion is ipso facto indistinguishable from significant newlines in a language where semicolons are statement terminators — both mean that you can end statements with newlines. The fact that JavaScript's ASI rules have awkward holes just means that its ASI rules have awkward holes. Have a look at Go for an ASI language whose creators take the opposite stance of Eich's — even though semicolons are canonically there at the end of statements, you're encouraged to omit them in your code. Basically, I think you're taking a far stronger stance than is warranted. I don't agree with a lot of what Thomas Fuchs said in the OP, but let's not try to outdo him in absurdity. You can feel that including semicolons is the right choice without ignoring the plain fact that ASI does mean you can end statements with newlines most of the time (and that the inability to do so in a few edge cases does not prove otherwise).