4 ms·
> A lot of people have to write JavaScript, but aren't good at JavaScript, [...] they blame it for being a crappy language, when it's really just their own lack
by _pferreir_ 13y ago
> A lot of people have to write JavaScript, but aren't good at JavaScript, [...] they blame it for being a crappy language, when it's really just their own lack of investment.
I think it's pretty much an accepted fact that JS has its problems. Even Brendan Eich has been quoted as admitting it.
(Note: I am a JS developer myself)
- rictic 13y agoThis is true, but the "wtf js is such a fucked up language" meme is outsized compared to the actual problems of javascript. Having worked full time in python for a couple years I could easily show you just as many weird python semantics that will inevitably bite you[1]. I think the grandparent's point has merit, that people expect to invest in their primary language for a project, but when circumstances dictate that they need to use a bit of javascript they find it annoying. 1] What does this program do? print object() > object()
- raverbashing 13y agoAbout your code snippet, it prints a "random" boolean value You're creating two objects (with random addresses, which affect the __str__ method result, which in turn result in a string comparison that returns False or True)
- aduitsis 13y agoThat's nothing compared to the "Perl is Satan!!1" meme that us Perl programmers usually have to put up with ;)
- beat 13y agoActually, Perl is many different Satans, depending on the particular stylistic quirks of the programmer in question.
- merfakos 13y agoIMHO, it's well deserved. Start by stop having those $, @, % identifiers for variables and then we 'll talk again about how many more daemons you need to impale.
- draegtun 13y agoSigils are what make Perl standout, in syntax and behaviour, to (most) other languages so it would be silly to get rid of them! i.e. it's a differentiator to what is or isn't Perl.
- _pferreir_ 13y agoEvery language has its quirks. Python is not perfect either. But JS shows clear signs of bad design decisions, such as the behavior of the == operator.
- woah 13y agoWhat == does is pretty simple and easy to understand. If you have a hard time with it, use ===. Problem solved.
- georgemcbay 13y agoThe problem is that JavaScript does not exist in isolation, there are other languages that use this operator. If you're familiar with any other C-derived language, the way == acts in JavaScript is very unexpected. Yes, you can learn to deal with it, but that doesn't mean it wasn't a bad design choice. If both forms of equality are required to be operators, == and === should have been swapped. Too late to do it now, woulda, coulda, shoulda, but it certainly is, IMO, a "bad design" smell in the language, and hardly the only one that still bites people. Another example: the way 'this' scoping works is similarly busted in that while the rules for it are reasonably straightforward in isolation, it is different enough compared to other languages that share the same basic keywords and syntax that it should have been called something else. To be fair, I don't think much of this has to do with Brendan Eich being a bad PL designer as much as it has to do with the odd history of JavaScript that is still represented in the name of the language ("Take this client language you made which has no connection to Java, and make it look kinda like Java, please!").
- ptx 13y ago>>> print(object() > object()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: object() > object() Yet another reason to upgrade to Python 3! :)
- jiaweihli 13y agoThat one is somewhat reasonable (and relatively obscure code you'd probably never write). A more realistic example: inner classes can't see class variables from their enclosing classes. (Why enclose classes? - builder pattern)