Ah. The shork did the math. This explains a lot.
Not enough alcohol involved.
The tech equivalent of inventing leaded gasoline.
This is one of the most educational and entertaining reads on the internet, if you are into that kind of thing:
Has anyone actually read through that? Reading the first few examples and it’s just not understanding how languages work half of the time:
!!"false" == !!"true"; // -> true
!!"false" === !!"true"; // -> true
Wow, no shit, non-empty string coerces to true, who would’ve guessed! Did you know that !!"bullshit" === !!"true"
as well? Mind=blown.
NaN === NaN; // -> false
Again, no shit, that’s in the NaN specification and the page even mentions it, so why even include it?
Which is why I’m of the opinion that dynamically typed languages are evil. !!“false” should either be caught at compile time or raise an exception.
I’m thoroughly convinced that the only use of dynamically typed languages is to introduce bugs
Why? IMO that’s perfectly valid. The various type coercions are sometimes crazy, but IMO the rule that non-empty string is coerced to true
and empty string to false
is very simple to follow. The snippet is not even a gotcha, I don’t see anything worth failing over. Putting “true” or “false” in a string doesn’t change that.
Dynamically typed doesn’t imply it’s monotyped. And monotyped languages can work just fine, you just have to not hide different operations under the same symbols just differing by type like JS does.
The entire problem with JS is that it both is monotyped and it isn’t.
Also, a huge proportion of the list is just not understanding IEEE floats behaviour and blaming the language for it. Exactly like this post is doing. All those weird number things js does is because it only uses floats for everything and every language that uses floats will behave the exact same way.
You just have to look at the problem from a different angle.