Live data from Hacker News

Of parser-fetishists and semi-colons

christianheilmann.com

41–50 of 125 posts

Re: Of parser-fetishists and semi-colons

#42

Add the semicolon "but but but" add the semicolon There's so much FOR it, it's unbelievable. Yes, it's good to 'break the rules' now and then. Add the semicolon This is not about if JS allows it or not. It's important, but mostly irrelevant. You can also not add 'var' to JS variables unless needed. That's going to be a lot of fun when it goes wrong. But here are the million dollar questions: 1 - How much time is spen…

As a devils advocate.

1. How many times are we going to have to debug and rewrite code to work around this defect? If it were just this once sure add the the ';', unfortunately it is never just this once.

2. How much time will be saved by using a minifier that actually supports the javascript language. What other language features will break because someone didn't feel like supporting javascript in their javascript minifier?

3. How much mental effort is needed to support half a dozen different minifiers that all support a different subset of the language as well as the cross browser differences we already have to take into account.

It is a matter of trust. If your tools skip supporting language features because someone decided they didn't like language feature X, what other corner cases did they skip because they were unliked?

Re: Of parser-fetishists and semi-colons

#43
I come from a Python background. However, thanks to work and school, I now program mostly in JavaScript, PHP, and Java (though I still use Python when I get a chance).

Now, I could use underscore_names in Java and JavaScript, but I don't. Even though I personally prefer underscore_names to camelCaseNames, I also realize that those languages are designed with camelCaseNames in mind, that the community conventions are for camelCaseNames, and that it is better to write code that looks nice and idiomatic in that language than it is to write code that looks nice and idiomatic in Python.

Not to mention that there are some cases where camelCaseNames are required - for example, when overriding inherited methods in Java - and if I used camelCase where required and underscore_names everywhere else, my code would be inconsistent, which to me is worse than using a style I don't like. So just because I could use underscore_names when I wanted to, there are a lot of reasons that I shouldn't.

A lot of those points also apply to JavaScript:

* JavaScript was designed with the use of semicolons in mind. Brandon Eich himself has said that ASI was only intended as an extra check for sloppy programmers.

* Outside the Ruby on Rails crowd, all the JavaScript I have ever seen uses semicolons. Even within the Rails crowd, this "no semicolons" thing is fairly recent.

* Since the majority of JavaScript syntax is intended to mimic Java syntax, which does require semicolons to separate statements, semicolons blend well with the language, and are therefore nice and idiomatic.

* There are situations where you have to use semicolons due to ambiguity to write straightforward code - there are workarounds, like tricks involving !, but they confuse the intent of the code.

One thing that I noticed is that most of the notable semicolon-haters - fat, mislav, and the GitHub guys - come from Ruby on Rails. Conveniently enough, Ruby does not require semicolons at the end of statements. I suspect this anti-semicolon fervor may come from a desire to use Ruby's conventions with JavaScript.

Re: Of parser-fetishists and semi-colons

#44
post #27

Earlier quoted context omitted.

It seems more like a social interaction issue than a technical one.

Bingo. I'm sure the same was true of angels dancing on the head of a pin. Edit: the point is that sometimes arguments seem stupid because we don't always say (or even know) what we really care about.

If there had been software development a thousand years ago we'd be burning people for using (or not using) tabs/semicolons/emacs etc.

Re: Of parser-fetishists and semi-colons

#45
post #30

Earlier quoted context omitted.

This is so, so, so much more boring than NoSQL. I agree that Riak vs. Mongo has gotten pretty boring. But this is semicolons. For f's sake.

It could be so much worse. At least they're not going on about camelCase and Hungarian notation.

Disagree. This is so much worse than that. At least with Hungarian notation (which thankfully died a well-deserved death), its advocates were arguing for a relatively well thought-out system of readability and tying member names to their types for quickly-identifiable scope and type referencing.

But, to suggest that simply removing semicolons constitutes some grand gesture towards readability, simplicity, or something as grandiose as a "minimalist aesthetic," is...beyond absurd.

It is Bike Shedding Qua Bike Shedding.

Re: Of parser-fetishists and semi-colons

#46
The author is picking and choosing who he wants in this argument of his. He has Douglas Crockford and Brendan Eich on the pro-trailing-semicolon side. On the other side he has @fat. If he wanted to be fair he could have included someone like @izs or Thomas Fuchs. But if he referenced their viewpoints on it, it would make it harder to pretend that all code that doesn't include trailing semicolons after every statement is brittle.

Re: Of parser-fetishists and semi-colons

#47
post #30

Earlier quoted context omitted.

Of the sustained debates, I feel it is tied with the "my nosql is better than yours" debate. Both of them seem to boil down to "understand your tools, your use case may not map to the thing someone else is advocating for their use case".

This is so, so, so much more boring than NoSQL. I agree that Riak vs. Mongo has gotten pretty boring. But this is semicolons. For f's sake.

I dunno... semi-colons have practical implications for everyone, but "my use case requires speed and persistence isn't an issue, therefore mongo is better" vs "i need persistence and didn't read the docs, who cares if it's a little slower - riak is better" gets pretty tiresome, particularly when my use case is "i need easy graph traversal, neo4j w/ gremlin is the wave of the future". :P

hahaha - I feel the best use of this thread is that we agree to spawn a series of blog posts debating the most boring debates to hit HN ever. Including sock-puppets to randomly drop surprise left turns like "no you are all wrong, here is why the ocaml vs haskell debate bores me" and "no, the real boredom is the long comment threads in the ongoing 'anarco-socialist' vs 'enlightened-libertarian' viewpoint wars"

:)

Re: Of parser-fetishists and semi-colons

#48
post #17

Earlier quoted context omitted.

It's actually quite easy to develop software while being only vaguely aware of and emotionally uninvested in these sorts of kerfuffles.

Well, in nearly every job I've had, there's at least one alpha nerd[1]. Worst of all is the alpha nerd boss (I intentionally avoid the word 'manager' here). I welcome advice on how to find working environments free of this sort of thing. [1] - two or more is even worse: they're like male gerbils or betta fish, in that they fight all the time.

As a reformed "alpha nerd boss", I suspect most people grow out of it.

Re: Of parser-fetishists and semi-colons

#49
post #13

Anyone else think this is by far the most boring technical debate ever to hit HN?

God, yes. For that matter, it's not even a technical debate; it's all purely stylistic.

It boggles the mind that so many otherwise intelligent people have decided to take the time to form an opinion about semicolons.

Re: Of parser-fetishists and semi-colons

#50

Earlier quoted context omitted.

It could be so much worse. At least they're not going on about camelCase and Hungarian notation.

Disagree. This is so much worse than that. At least with Hungarian notation (which thankfully died a well-deserved death), its advocates were arguing for a relatively well thought-out system of readability and tying member names to their types for quickly-identifiable scope and type referencing. But, to suggest that simply removing semicolons constitutes some grand gesture towards readability, simplicity, or somethin…

But you're... you're doing it. Look at yourself. You have a strong opinion about using semicolons.
Post reply on HN