Make runtimeChecked a standard feature#23262
Conversation
|
Follow up should be to recommend this instead of |
|
@bishabosha The last commit changes the one occurrence of |
| |impossible to check them at run-time. | ||
| | | ||
| |You can either replace the type arguments by ${hl("_")} or use `@unchecked`. | ||
| |You can either replace the type arguments by ${hl("_")} or use `.runtimeChecked`. |
There was a problem hiding this comment.
Actually this error message is the one legitimate use for unchecked, case _: List[Int @unchecked] =>the other error message is elsewhere - but as I type this I'm not at my computer
There was a problem hiding this comment.
Ah yes, well spotted. I'll revert the commit.
There was a problem hiding this comment.
So currently in the code there can be both @unchecked and .runtimeChecked.
When skimming the code those 2 look like 2 opposite or very different things.
"One thing is not checked and another thing is checked"
What if we introduce @runtimeChecked just for the cases when .-notation can't be used and suggest using it in such places?
The should become more unified and readable.
There was a problem hiding this comment.
just for the cases when
.-notation can't be used
What situations do you mean? i.e. foo match { case _: List[Int @unchecked] => ??? }
because in that situation only List[?] can be checked at runtime, i.e. runtimeChecked means the pattern itself does all the necessary tests, so case _: List[Int] => is indeed not runtimeChecked by that definition
0cce292 to
057ea91
Compare
684e931 to
abb8701
Compare
The runtimeChecked implementation was accepted in the SIP meeting of May 23, 2025. Since the the feature has been around for long, and is quite uncontroversial, I think we can just merge it for 3.8. No preview phase should be needed.
abb8701 to
285dea2
Compare
Stabilising `scala.Predef.runtimeChecked` seems to have been forgotten in #23262.
The runtimeChecked implementation was accepted in the SIP meeting of May 23, 2025. Since the feature has been around for long, and is quite uncontroversial, I think we can just merge it for 3.8. No preview phase should be needed.
We should merge this PR for 3.8 RC1.