3 ms·
> And a switch with no default case would be reported as an error if some cases are not covered. In what language? It's not an error in Scala, which is what th
by lmm 6y ago
> And a switch with no default case would be reported as an error if some cases are not covered.
In what language? It's not an error in Scala, which is what the post is talking about.
- pkolaczk 6y agoIn Scala or OCaml you get a compile-time warning + runtime error. In Java 14, Kotlin and Rust there is a compile-time error if switch/match expression is non-exhaustive.
- lmm 6y agoYou don't get a compile-time warning in Scala, only a runtime error. https://scastie.scala-lang.org/6fGnDSzDSdmI4USN5k9OTA https://scastie.scala-lang.org/6fGnDSzDSdmI4USN5k9OTA