Anyone else think this is by far the most boring technical debate ever to hit HN?
Because all you see it as is an argument about syntax. It's actually an argument between the old guard and the up-and-coming hotshots. Nobody really cares one way or another, and while it would take Twitter more time to append changes to their code than it would Crockford, my guess is the trouble for either would be negligible. That said, this is very obviously a pride war between those who stick to convention and th…
Of parser-fetishists and semi-colons
111–120 of 125 posts
Re: Of parser-fetishists and semi-colons
#112The 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…
"He has Douglas Crockford and Brendan Eich on the pro-trailing-semicolon side" Brendan Eich, the conceiver of the language. The best placed person in understanding why the JavaScript language does what it does, and what problem a feature was trying to solve. Douglas Crockford, the developer who took all of JavaScript and found within a clean elegant language. And then he pulled together what he considered the best bi…
As for crockford leading the way to sanity, the biggest problem I have with him is that instead of warning and educating he flat out forbids, and then heckles people who disagree. "with" is considered a "bad part", but it is used by literally every js template framework. He recommends closure based object construction, but in a big app that is a memory nightmare. And then there is stuff that basically treats js devs as mindless idiots. Like the "new" operator is discouraged, just in case someone forgets to use it when they want to instantiate something or the function keyword is discouraged, because it hoists.
All of those are opinions, and some are demonstrably terrible. But for some reason The Good Parts is still held up as gospel, while the community just chooses to ignore the parts of the book it doesn't like.
As for minifiers, JSMin is pretty obsolete at this point. If you are using it, as an incredibly easy win you can decrease your page load times by using uglify js, google closure compiler, or yui compressor. All of these support asi fully, but that is probably the least important reason to use them.
Re: Of parser-fetishists and semi-colons
#113Anyone else think this is by far the most boring technical debate ever to hit HN?
Because all you see it as is an argument about syntax. It's actually an argument between the old guard and the up-and-coming hotshots. Nobody really cares one way or another, and while it would take Twitter more time to append changes to their code than it would Crockford, my guess is the trouble for either would be negligible. That said, this is very obviously a pride war between those who stick to convention and th…
Re: Of parser-fetishists and semi-colons
#114Earlier 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.
Re: Of parser-fetishists and semi-colons
#115Earlier quoted context omitted.
Oh for fuck's sake.
I understand the frustration with this comment, but the clincher for me on the whole anti semi-colon crowd was at this article: http://www.wordsbyf.at/2011/10/31/i-dont-write-javascript/ He says he doesn't use semicolons, except that it caused issues for those who concatenation scripts so he adds a semicolon to the end of the js file. But, lo! This causes issues for those who use the following pattern: (function() {…
(function() {
// Le code
})()
!function() {
// Le code
}()
YOU'RE RIGHT. I'M HORRIFIED.Re: Of parser-fetishists and semi-colons
#116I 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…
Incidentally, we use CamelCaseMethodNames in Python at Google, presumably to be consistent between languages. If you're one company that uses multiple languages, it may be beneficial to use the same style in each, even if that style is non-idiomatic.
Re: Of parser-fetishists and semi-colons
#117Earlier quoted context omitted.
Because all you see it as is an argument about syntax. It's actually an argument between the old guard and the up-and-coming hotshots. Nobody really cares one way or another, and while it would take Twitter more time to append changes to their code than it would Crockford, my guess is the trouble for either would be negligible. That said, this is very obviously a pride war between those who stick to convention and th…
>That said, this is very obviously a pride war between those who stick to convention and those who undermine it. I'd frame it as "a pride war between people wanting a sane codebase not based on fragile parser edge cases --include two that know the language inside out--, and the developer of some minor js code that thinks he's too clever for all that". That's no "undermining convention", that's juvenile bs. I know who…
The problem is that jsmin is a naive pile of textual replacements (though not quite as abysmal as John Gruber's markdown.pl) instead of being a javascript implementation — something that actually parses javascript into an AST and compiles it to minified javascript.
He left out cases for several unary operators so it broke perfectly valid code. After bitching at them he came to his senses and fixed it: https://github.com/douglascrockford/JSMin/commit/5ca277ea452...
Unless for some reason you need your minifier to be trivial enough to be portable with no dependencies, you should really be using something along the lines of google's Closure Compiler, which produces far better output and even has stuff like tests!
Re: Of parser-fetishists and semi-colons
#118Earlier quoted context omitted.
That's correct. You could use: !isActive && ($parent.toggleClass('open'), do_something_else()) but I don't think anyone would advise it.
Actually, you are all missing Crockford's real point, which is that they are considering making ! a binding deference of function objects. If they do, then this: clearMenus() !isActive && $parent.toggleClass('open') Becomes this: clearMenus()!isActive && $parent.toggleClass('open'); And not this: clearMenus(); !isActive && $parent.toggleClass('open'); The no semi-colon crowd is ridiculous. There are no good arguments…
Re: Of parser-fetishists and semi-colons
#119I think the argument that we shouldn't rely on the parser for certain language features is a bit silly (including interpreting end-of-statements). The language is precisely what the parser says it is, and nothing more or less. JSMin is free to not do what the parser does of course, but that won't be Javascript.
I'm not sure if you're making that argument yourself, but it's thoroughly wrong. First, there's no "the parser". There are a lot of parsers, some of which don't yet exist. Second, that means there's no way to distinguish between bugs and features. If the language is defined by parser behavior, then any parser bug is now part of the language. Third, you've eliminated the white space needed for future growth. If you lo…
the problem was that jsmin didn't just violate the spec — it's not a javascript implementation at all, but rather a pile of naive textual replacements
Re: Of parser-fetishists and semi-colons
#120Earlier quoted context omitted.
That's correct. You could use: !isActive && ($parent.toggleClass('open'), do_something_else()) but I don't think anyone would advise it.
Actually, you are all missing Crockford's real point, which is that they are considering making ! a binding deference of function objects. If they do, then this: clearMenus() !isActive && $parent.toggleClass('open') Becomes this: clearMenus()!isActive && $parent.toggleClass('open'); And not this: clearMenus(); !isActive && $parent.toggleClass('open'); The no semi-colon crowd is ridiculous. There are no good arguments…