Live data from Hacker News

Of parser-fetishists and semi-colons

christianheilmann.com

21–30 of 125 posts

Re: Of parser-fetishists and semi-colons

#21
post #11

I've been shocked at the level of disrespect for language standards here. Yes: adding semicolons is probably good practice because it avoids the chance of stumbling over bugs like this. And yes: the ASI feature in Javascript is in hindsight a terrible mistake. That said: you go to war with the language you have, not the one you might want or wish to have. ECMAScript is ECMAScript. Arguing that your transformation too…

I agree with you to a certain extent, but I do think it is important to distinguish between those that think that they should just use a semi-colon and those that seek to disrespect a standard.

In my case, and I've seen this sentiment expressed repeatedly by others on HN, I think it is odd that a minification script would actively choose not to support a syntax that is standards compliant. On the other hand, I think it is crazy for a major project to use a valid syntax that not only breaks said [popular] minifier but also offers no noticeable benefit.

I do not feel as if I'm disrespecting any standard just because I think simply adhering to that standard is not a sufficient justification for doing something.

Re: Of parser-fetishists and semi-colons

#22
post #13

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

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

Re: Of parser-fetishists and semi-colons

#23

I suspect, that to understand the logic behind semicolon exclusion, you should program at least a little in the languages, that do not require it. At least for me, mental switch between semicolon and no semicolon is hard for some reason, if it happens a lot during the day :)

I leave out semicolons in my Haskell, and my Python. I use them in my JS, because JS's implicit semicolon rules are rubbish compared to any other language that I've tried with such rules.

It's kinda presumptuous to assume that people who disagree with you don't "understand the logic behind" your position.

Re: Of parser-fetishists and semi-colons

#25
post #11

I've been shocked at the level of disrespect for language standards here. Yes: adding semicolons is probably good practice because it avoids the chance of stumbling over bugs like this. And yes: the ASI feature in Javascript is in hindsight a terrible mistake. That said: you go to war with the language you have, not the one you might want or wish to have. ECMAScript is ECMAScript. Arguing that your transformation too…

I think you missed the point.

This is not really about whether semicolons are required or not.

The point is that in order to ensure maintainability of code you should try to use language (and framework) in a way which ensures better maintainability, supportability, and portability of your code.

Look, the statement like "a && b" is 100% valid in many languages but in order to increase maintainability, supportability, and portability of your code it should be written like "if (a) { b; }".

The easiest way to understand the point of this rule is to get a job maintaing some old crappy code-base :) - I learned that way.

Re: Of parser-fetishists and semi-colons

#26
post #11

I've been shocked at the level of disrespect for language standards here. Yes: adding semicolons is probably good practice because it avoids the chance of stumbling over bugs like this. And yes: the ASI feature in Javascript is in hindsight a terrible mistake. That said: you go to war with the language you have, not the one you might want or wish to have. ECMAScript is ECMAScript. Arguing that your transformation too…

I agree with you to a certain extent, but I do think it is important to distinguish between those that think that they should just use a semi-colon and those that seek to disrespect a standard. In my case, and I've seen this sentiment expressed repeatedly by others on HN, I think it is odd that a minification script would actively choose not to support a syntax that is standards compliant. On the other hand, I think…

But "no noticeable benefit" is your aesthetic decision, not an objective truth. Not everyone feels the same. Pythonistas, for example, might quibble with you about that, because they skip semis when typing all the time and will experience editor friction when using Javascript. And even if you think it's "crazy" to skip the semicolons, you might not think it's crazy to write something like "test && result" as a simple if. Shell and perl programmers like that sort of thing and can read it without difficulty.

I'm not saying that all working code is good code, or that you have to actually use all the language features in all your code, or that you can't have your own well-reasoned opinions about this stuff. What I am saying is that if you're serious about using "Javascript" and interacting with the broader community of "Javascript" programmers, this kind of feature pedantry is going to hurt you and the community badly. You will constantly be running into useful (maybe even brilliant) code that does "crazy" things.

Re: Of parser-fetishists and semi-colons

#27
post #13

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

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.

Re: Of parser-fetishists and semi-colons

#28
post #11

I've been shocked at the level of disrespect for language standards here. Yes: adding semicolons is probably good practice because it avoids the chance of stumbling over bugs like this. And yes: the ASI feature in Javascript is in hindsight a terrible mistake. That said: you go to war with the language you have, not the one you might want or wish to have. ECMAScript is ECMAScript. Arguing that your transformation too…

I agree with you to a certain extent, but I do think it is important to distinguish between those that think that they should just use a semi-colon and those that seek to disrespect a standard. In my case, and I've seen this sentiment expressed repeatedly by others on HN, I think it is odd that a minification script would actively choose not to support a syntax that is standards compliant. On the other hand, I think…

>>On the other hand, I think it is crazy for a major project to use a valid syntax that not only breaks said [popular] minifier but also offers no noticeable benefit.

That's basically the take-away I got from yesterday's semicolon drama. You can appreciate that JS allows you to omit semicolons or you can bash those who choose the ambiguous over the explicit. But if you're the lead on a hugely successful project you should pick the syntax that will make it work everywhere. It's especially odd for a web developer to choose aesthetics over pragmatics when it comes to things like this.

Re: Of parser-fetishists and semi-colons

#29
post #11

I've been shocked at the level of disrespect for language standards here. Yes: adding semicolons is probably good practice because it avoids the chance of stumbling over bugs like this. And yes: the ASI feature in Javascript is in hindsight a terrible mistake. That said: you go to war with the language you have, not the one you might want or wish to have. ECMAScript is ECMAScript. Arguing that your transformation too…

That's all well and good until you write code that other people have to read. It's basic courtesy to respect the value of their time.

Re: Of parser-fetishists and semi-colons

#30
post #13

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

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.
Post reply on HN