2 ms·
Agreed. I would rather be forced to explicitly cover all match cases than accidentally run into problems that are hard to debug.
by rootnod3 2y ago
Agreed. I would rather be forced to explicitly cover all match cases than accidentally run into problems that are hard to debug.
- pmarreck 2y agoExactly. I wish all languages implemented things like this, a bit more strictness (such as requiring all possible match cases to be handled across a set of inputs) goes a long way
- rootnod3 2y agoNot all though. I am currently writing my own Lisp dialect, and as much as I wish and hope I will be able to force case/switch to be exhaustive, I don't see a direct way for that in a dynamically typed version. I do plan to add something similar to Clojure's spec though, so the compiler can at least be advised about things and warning if stuff is missing. But I do agree, any statically typed language should have that check and not just warn about it. It should be a hard error, no questions asked. And I love that Rust didn't relegate it to a warning that could be turned be into an error.