Message from JavaScript discussions

November 2017

— User experience


Either they can get a cryptic error which may not explain the type is wrong althrough it is the cause of the error, or they get a nice message clearly explaining it

— C++ is really crappy when it comes to that lol

— In C++ it will pick a "function candidate" for the argument types, so you can write 5 functions all named the same, but accepting different types, and C++ will try to use the most fitting one... If you give types which there were no functions for, you will get: [Error] no matching function for call which really uh... does not tell you what happened

Message permanent page

— Or you even can get [Note] no known conversion for argument 1 from ...

— It is trying to do some things under the hood for you, and complains when it fails, but you still don't know that's because you passed the wrong type

Message permanent page

— C++

— For comparison

— If you know C++, you know what those errors mean, but in JS you don't get anything nearly that helpful

Message permanent page

— Without type checking you are reliant on some function in your code throwing a TypeError itself, which could be deep down in execution, several hundred calls into the stack... hard to debug

Message permanent page

— With the asserts, one can find very easily that it is their fault

— With a lib/framework it just helps to reduce bored kids emailing me