6 ms·
Please don't make fun of JavaScript. Last time it happened, it replied with Node and now it's everywhere.
by pluc 1y ago
Please don't make fun of JavaScript. Last time it happened, it replied with Node and now it's everywhere.
- th0ma5 1y agoReminding me of the near decade of WAT snark where people thought undefined behaviour was a complete proof of the futility of technology when it was actually just people mistaking what technology is. Like it isn't funny that you can't carry water with a brick but for some reason everyone thought JavaScript should be able to accommodate every possible fuckup with a specific error or just fix it. A nice goal but not something to then feel smug about when it doesn't happen but it seemed to be a viral perspective that persisted for way too long.
- qsort 1y agoPeople aren't mad that errors aren't fixed automatically, people are mad that the behavior is inconsistent and weird for no fundamental reason other than "that's how the interpreter worked when it all started and it's too late to fix the spec now". Python is a dynamic language as well and in many ways worse than JS, but [] + {} raises a type error. In JS [] + {} is an object and {} + [] is 0. It's not about being smug, it's that in no way, shape or form that makes any sense.
- Izkata 1y agoFirst, [] + {} isn't an object, it's a string. Second, {} + [] isn't a type conversion issue, it's a parsing issue. That {} isn't an object, it's a code block. Assign {} to a variable to ensure it's an object, then do var + [] and you get the same result as the first one. When using an actual object in both of these, the type conversion makes sense: "+" acts on primitives like strings and numbers, so it has to convert them first. You're getting obj.toString() + array.toString() in either case. I'll admit the parsing issue here is odd, but most of the time peoples' complaints about javascript type coercion is that they simply never bothered to learn how it works.
- otterley 1y agoOne can know the intricacies of how something works and still possess a valid opinion that it doesn't work all that well or defies common sense and expectations.
- th0ma5 1y agoFor me the difference is that you wouldn't then feel compelled to cynically bemoan it for retweets but this schtick went on for years where people would do something out of spec and then complain it was really bizarre to me! Anyway ... Being discouraged by a bug is fine... Making everyone else laugh at the machine on your behalf seems to against understanding and knowledge even if it is fun and funny haha
- dcow 1y agoIt’s absurd. Comedy is cognitive dissonance manifest. It can’t not be funny.
- th0ma5 1y agoI don't have dissonance. The language has the features that were designed or there is a bug in what they intended and I don't know why you think adding two empty objects together should make sense anyway. That it doesn't work resolves the dissonance.
- qsort 1y agoThe complaint is that type coercion exists at all. It solves no problems and creates several out of thin air. Or are you arguing that ceteris paribus you'd rather not have the language throw an error or just propagate undefined?
- th0ma5 1y agoIn the context of the time it was created it was fine to mess with and having an enlightened view from the future can't negate that even though I understand the complaint.
- th0ma5 1y agoI've read your comment several times and I still don't get how I'm supposed to be frustrated by this?
- fragmede 1y ago> the near decade of WAT snark For today's lucky 10,000: https://www.destroyallsoftware.com/talks/wat https://www.destroyallsoftware.com/talks/wat (2012)
- th0ma5 1y agoThis guy single handedly caused a wave of unproductive cynicism with this stunt. It's like the joke about all the things an everything bagel doesn't have except essentially shitting on the hard work of the entire industry by making up endless nitpicks for laughs.
- dcow 1y agoDid you even read TFA? Tell me dates make even the faintest sense.
- hnbad 1y ago`Date` is based on the original Java `Date` class and its API was mostly copied verbatim, explaining a lot of the quirks and silliness. While JS can't remove things easily because that would break the web, a lot of work has gone into a set of time primitives that will effectively replace it. `Date`'s parsing logic is so bad even Java has deprecated it. This is one of those cases where the problem isn't language design but boardroom politics - Sun wanted JS not to compete with Java so they had to try to make JS more like Java to present JS as a kind of "Java for amateurs".
- teaearlgraycold 1y agoI maintain that TypeScript is probably the best language you’ll be able to get paid to write.
- suprfnk 1y agoC# pays fine
- mock-possum 1y agoIf you like one, you’ll prolly like the other Hell you might even like ActionScript ;P
- const_cast 1y agoC# is nominally typed, which, in practice, leads to safer code and less type gymnastics. Of course you can avoid the type gymnastics with "any", then you you're sacrificing safety.
- DonHopkins 1y agoIf you like TypeScript and C#, then you'll probably also like Delphi and Turbo Pascal! They were all written by the same guy, Anders Hejlsberg: https://en.wikipedia.org/wiki/Anders_Hejlsberg https://en.wikipedia.org/wiki/Anders_Hejlsberg https://news.ycombinator.com/item?id=19568681 https://news.ycombinator.com/item?id=19568681 "My favorite is always the billion dollar mistake of having null in the language. And since JavaScript has both null and undefined, it's the two billion dollar mistake." -Anders Hejlsberg "It is by far the most problematic part of language design. And it's a single value that -- ha ha ha ha -- that if only that wasn't there, imagine all the problems we wouldn't have, right? If type systems were designed that way. And some type systems are, and some type systems are getting there, but boy, trying to retrofit that on top of a type system that has null in the first place is quite an undertaking." -Anders Hejlsberg
- oldsecondhand 1y agoDelphi has been dead for 10+ years. Nobody uses it except for a few legacy applications and licenses cost $1200+.