3 ms·
Any `nil` error, like the famous `undefined method 'users' for nil` is a type error. Every time that serialization gets the wrong value passed in but continues
by berkes 3y ago
Any `nil` error, like the famous `undefined method 'users' for nil` is a type error.
Every time that serialization gets the wrong value passed in but continues anyway, is a type error. Every time a database-record misses a value (NULL) but the app continues to run over that, is a type error. And so on.
When I look at my most stable apps' Rollbar or Sentry, the top 20 errors are nearly all errors that a type system (which does not allow |null, like Java's - ugh, useless) would've caught compile or dev-time. The very few non-typing errors that are then left are race-conditions and business-logic-bugs.
The latter are really the only bugs that I'm "fine" with, they come with the domain. Race-conditions are quite often deep down also typing issues - they surface as similar `Undefined method on nil` errors because some data is nil due to the racing threads. Something a typing system would partly fix - as we can see in Rust.
- hartator 3y agoNil errors are still there, but you are just forced to handle them. It doesn't mean your app is not broken.