by jonpacker · 14y ago · 0 comments
2. The fact that pathological-condition-X of a language is in theory understandable with sufficient study is a total red herring in a broad discussion of that language.
Today, I spent five minutes tracking down a
SyntaxError: Unexpected token u
It was honestly hard to read this as "don't give an un-itialized value to this function or it will end up being passed to JSON.parse that will happily treat undefined as a string".I'd take a NullPointerException with a proper stacktrace everyday.
By now I'm sure everyone has seen the WAT talk (https://www.destroyallsoftware.com/talks/wat) which illustrates some of the more obscure (and funny) coercions.
It's ok to say that JS's type coercion is a misfeature, good programmers learn to not throw out the baby with the bathwater.
Rewritten as a general programming language "smell". (That said, I do enjoy me some Javascripting, and I have a side-project with it.)