Is there some way we can make
case be exhaustive, and force an
else in case the compiler can’t prove that?
This is the only thing that really bothers me about Crystal. Having to write
else raise "Bug: can't happen" is really, really annoying and makes the language look unprofessional.
I know Crystal has several bugs, many related to generics, but these are bugs. They will be fixed, most probably without making a big change in the language.
case not being exhaustive is not a bug. It doesn’t need to be fixed. It needs to change.
We need to make the language better and more type safe. Requiring hash lookups to match key types is one way to make that happen. Making
case be exhaustive, like in many other languages, is another way to make that happen.
I already sent a PR with that? Could we move forward with that? What’s the fear?
If I’m in charge of that, there’s no fear about losing time on it because I will be working on it and I’m sure @straight-shoota , @RX14 and other non-Manas people will be able to review it and move it forward.