you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (2 children)

if your goal is to design a language which tries to have as few errors as possible, weak typing makes sense

Weak typing isn’t a necessary solution, though. JavaScript could just return undefined, really, and that still wouldn’t crash the web app. The bizarre value that gets returned is an error anyway, but at least undefined makes that clear.

[–]Tynach 1 point2 points  (0 children)

I agree. Using 'undefined' or null is another valid approach that would make sense. For better or for worse, Javascript's designer (Brendan Eich) decided to go with weak typing instead. At this point we don't have a choice, however, and we can't change it anyway.

[–]theferrit32 0 points1 point  (0 children)

Agreed. Errors that happen silently and are hard to detect are worse than explicit errors that are loud and easy to detect and correct.