4 ms·
Hah way to beat the system. No runtime error doesn't make sense. Say your database crashes. Something should happen...
by brianwawok 11y ago
Hah way to beat the system.
No runtime error doesn't make sense. Say your database crashes. Something should happen...
- codygman 11y agoI think it's better communicated as "compile-time guarantees that no runtime errors are unaccounted for". Though, that effectively means no runtime errors depending on your definition of runtime error.
- mmij 11y agoPresumably they'd use a Result type, which is just another value.
- mtmail 11y agoIt shields you from a lot. For example if you create an array x of size 100 and in some other piece of code you write x[101] it throws a compile-time error and the error is human readable and explains what's wrong. It's a good approach overall.
- deadfoxygrandpa 11y agoWell, in Elm you would have to explicitly handle the possiblity of a database crash and what to do with it. It wouldn't be a runtime error, it would just be another code path.
- brianwawok 11y agoSo that was the promise of checked exceptions in Java, and it was TERRIBLE. It turned into try { } catch Exception ex { //won't happen } I am sure elm does better, but at first glance it scares me ;)