Post #1652041
2026-04-06 18:04 UTC
And in no place does it explain what it means for the check to be done at runtime.
Like does it explode in an uncatchable way?, is there a specific message it gives?, is it an exception that is catchable?...
Is it better than doing the typical "throw IllegalState("this shouldn't happen")"??
Nobody knows.
The docs are only this https://www.scala-lang.org/api/docs/other-new-features/runtimeChecked.html
Absolutely not user friendly. A quick example that should be more developed and then jumps to a weird example.
Replies (1)
-
@vascorsd@mastodon.social 2026-04-06 18:12
Nothing useful in the implementation - https://github.com/scala/scala3/pull/20987 Only way to know? Run an example: ``` (Some("a"), Some("b")).runtimeChecked.match { case (Some(_), None) => println("a") case (None, Some(_)) => println("b") } ``` https://scastie.scala-lang.org/0snylcSNRS6l26fzZGWqFg Ok, seems to throw somekind of MatchError :yell: