4 ms·
You want to write explicit error handling for every possible case of runtime type errors in a dynamically typed language? The "unrecognized selector sent to in
by plorkyeran 7y ago
You want to write explicit error handling for every possible case of runtime type errors in a dynamically typed language?
The "unrecognized selector sent to instance" exception is not thrown in the hope that someone will catch it. It's intended to be a fatal error reporting a precondition violation.
- aaronbrager 7y agoThat’s what secure coding guidelines say to do. It’s called “input validation”. For example here’s Apple’s: https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/ValidatingInput.html https://developer.apple.com/library/archive/documentation/Se... Especially important on methods called on launch, if a crash would cause a problem. (Swift or other strongly typed language would help here.)
- lagadu 7y agoThe halting problem's existence means that there's no input validation that is guaranteed to work absolutely 100% of the time though, for sufficiently large inputs.