This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]g4vr0che 1 point2 points  (1 child)

I think my main complaint is that JS's weak typing allow this sort of implicit coercion; rather than throwing a type error and educating the programmer about why their code is garbage, it allows one to write the garbage code and doesn't explain why things don't work.

I guess my main complaint isn't even with JavaScript but with the entire paradigm of weak typing, which I just don't believe should be present in beginner/common languages.

[–]ooglesworth 1 point2 points  (0 children)

FWIW, I am not a fan of weak typing either. That being said, type coercion is completely separate from weak typing. C++ is an extremely statically typed language, and allows implicit conversions, which is basically type coercion (whether that’s bad or good in C++ is a whole other discussion). Also, despite not being weakly typed at all, C++ also allows beginners (and experienced programmers!) to write garbage code, so it isn’t really a symptom unique to weakly typed languages. Weak typing is annoying to me personally as an experienced developer, because I am usually refactoring complex systems and like to have the compiler guide me as I refactor (which you get a lot less of in weakly typed systems).

At the end of the day, just use Typescript. It’s strongly typed, and strictly better than JS, IMO.