Of parser-fetishists and semi-colons
christianheilmann.com
Of parser-fetishists and semi-colons
1–10 of 125 posts
Re: Of parser-fetishists and semi-colons
#2How about Bootstrap adds the damn semi-colon and JSLint accepts that for the most part the lack of a semi-colon is working and "valid" JS add allows for the edge case. Now everyone gets to go home happy.
Re: Of parser-fetishists and semi-colons
#3Re: Of parser-fetishists and semi-colons
#4Particularly his points about reading other people's code & extending functionality - there are very few use-cases where it makes sense to omit semi-colons, end-tags, etc - and if you aren't sure - yours isn't one of those use-cases.
Re: Of parser-fetishists and semi-colons
#5At least for me, mental switch between semicolon and no semicolon is hard for some reason, if it happens a lot during the day :)
Re: Of parser-fetishists and semi-colons
#6It's a natural cycle. C programmers went through the very same phase at some point and to this day different coding styles persist.
It's only when those choices cause incompatibilities that friction emerges, but we should see it as a natural step towards a more unified grasp of what Javascript means for people who program with it. That the general tone of the conversation is antagonistic is just a symptom of the fact that people care about their opinions and their choices, which by all means should be seen as a very healthy questioning on the part of the community. Just my 2 cents.
TL;DR: Sure the image conveyed is bad, but the reasons why such a debate emerges are natural and are part of the evolution of a language, it'll get better.
Re: Of parser-fetishists and semi-colons
#7 Now, this could be easily solved – by adding the friggin semicolon.
What this furore misses is that the original issue (JSMin failing to minify bootstrap-dropdown.js) was already fixed when the bug was raised [1]. Fixed without adding semicolons. Everyone should be happy with that. Developers of bootstrap got to stick to their "no semicolons" schtick, and the person with the original problem got it fixed. Everyone seems to forget this salient point when they rush in to this debate.For reference, I sometimes use semicolons in my javascript, sometimes I don't. It depends on context and whether it makes the code more readable. It's not an issue I care enough about to get involved in a holy war, one only marginally more relevant than tabs vs spaces.
[1] https://github.com/twitter/bootstrap/issues/3057#issuecommen...
Re: Of parser-fetishists and semi-colons
#8Now, this could be easily solved – by adding the friggin semicolon. What this furore misses is that the original issue (JSMin failing to minify bootstrap-dropdown.js) was already fixed when the bug was raised [1]. Fixed without adding semicolons. Everyone should be happy with that. Developers of bootstrap got to stick to their "no semicolons" schtick, and the person with the original problem got it fixed. Everyone se…
Christian's post is completely spot on here. Javascript was designed to be tolerant of errors and inconsistencies as much as it could. That fact however, shouldn't be used as an excuse for advocating inconsistent coding. Not that I'm saying semi-colons are the epitome of consistent coding (I prefer Ruby myself) but that Javascript was not designed with significant whitespace in mind, rather it just has a tolerance for inconsistent and arguably erroneous syntax.
The argument here is that we shouldn't let Javascript's tolerance excuse laxness on our parts. We should know better.
Re: Of parser-fetishists and semi-colons
#9Re: Of parser-fetishists and semi-colons
#10Now, this could be easily solved – by adding the friggin semicolon. What this furore misses is that the original issue (JSMin failing to minify bootstrap-dropdown.js) was already fixed when the bug was raised [1]. Fixed without adding semicolons. Everyone should be happy with that. Developers of bootstrap got to stick to their "no semicolons" schtick, and the person with the original problem got it fixed. Everyone se…