3 ms·
"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
by DonHopkins 4y ago
"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
https://news.ycombinator.com/item?id=19568681 https://news.ycombinator.com/item?id=19568681
https://news.ycombinator.com/item?id=19568378 https://news.ycombinator.com/item?id=19568378
https://www.youtube.com/watch?v=csL8DLXGNlU https://www.youtube.com/watch?v=csL8DLXGNlU
- masklinn 4y ago> "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 That's one thing I will heartily credit C# for, despite not being a great fan of the language. Actually retrofitting null-safety in a language never designed for that was an impressive undertaking.
- DonHopkins 4y agoAnders Hejlsberg was talking about TypeScript in that $2 billion quote, which he also designed. I love programming in C# myself, and think it's quite a nice language, carefully designed to say "Fuck You!" to Java, the same way Java was carefully designed to say "Fuck You!" to C++, which itself was insanely designed to say "Fuck You!" to C. Whereas TypeScript, which I also enjoy and appreciate, was carefully designed to say "Fuck You!" to JavaScript, but JavaScript was less designed than just haphazardly thrown together as LiveScript, and then deceptively renamed and marketed to say "Me Too!" to Java.
- throwawaymaths 4y agoHonestly, nil is not so bad in Elixir. (It's an atom type, and it and false are the only falsely values, and there are some nice defaults like List.wrap(nil) == [])
- cableshaft 4y agoFound out the hard way with Javascript I have to be careful about just doing "if(blah)" to represent what I thought was shorthand for "if(blah !== undefined && blah !== null)", when I had a weird bug where the logic was being skipped, and discovered that, oh, that also means "if(blah !== 0)"! The value was sometimes 0 and that was also causing it to evaluate to false, when I expected that to be true. Now to be safe I'm always explicit when checking for undefined and null values, and also try to limit how I use them.
- masklinn 4y ago> that also means "if(blah !== 0)"! The empty string ("") is also falsy. So is `false`, obviously. And the bigint 0. And NaN. Here is the complete truth table: https://262.ecma-international.org/#sec-toboolean https://262.ecma-international.org/#sec-toboolean FWIW undefined and null are loosely equal to one another, it's one of the few cases where loose equality is legitimate. As in if (blah != null) will exclude null and undefined, and only those two[0]. That's step 2 and 3 of IsLooselyEqual: https://262.ecma-international.org/#sec-islooselyequal https://262.ecma-international.org/#sec-islooselyequal [0] and Document.all but if you're dealing with that you're beyond the reach of god
- DonHopkins 4y agohttps://www.reddit.com/r/ProgrammerHumor/comments/225i15/proof_that_brendan_eich_never_really_cared_about/ https://www.reddit.com/r/ProgrammerHumor/comments/225i15/pro... "Proof that Brendan Eich never really cared about equality." https://i.imgur.com/j7u6KbR.png https://i.imgur.com/j7u6KbR.png
- masklinn 4y agoIf we're doing thunderdome, JS doesn't beat C++: https://howardhinnant.github.io/smf.jpg https://howardhinnant.github.io/smf.jpg
- Dylan16807 4y ago