-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Discussion: what should we do with DottyPredef before the release? #10294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See also #10302 |
And #10303. |
So looking at the early results of these PRs, we seem to be left with the following essential methods
All but |
Btw the reason to make assert if x().>(0).unary_!() then assertFail() else () With normal inline assert: (if x().>(0).unary_!() then assertFail() else
scala.runtime.BoxedUnit$#UNIT
):scala.runtime.BoxedUnit The reason for |
Yes, this is exactly what I had in mind. If we're not too particular about the error message, we could also define it as: extension [T](x: T | Null) inline def nn: x.type & T =
x.getClass() // throws NPE iff x is null; optimized by the JVM
x.asInstanceOf[x.type & T] |
It's not that much more concise. For the |
To me that looks more like a limitation of one of the transformation phases, perhaps erasure. Before erasure: // transparent:
if cond.unary_! then throw new AssertionError("assertion failed") else
()
// not transparent:
(if cond.unary_! then
throw new AssertionError("assertion failed: hello")
else ()):Unit After erasure: // transparent:
if cond().unary_!() then throw new AssertionError("assertion failed")
else
()
// not transparent:
(if cond().unary_!() then
throw new AssertionError("assertion failed: hello")
else scala.runtime.BoxedUnit$#UNIT):scala.runtime.BoxedUnit Erasure or an earlier phase could replace In any case, that does not seem like a good enough reason to use |
Here is a PR to make |
This issue is the place to discuss what needs to be done about DottyPredef.
DottyPredef
is a workaround used to include stuff in the standardPredef
. StandardPredef
comes from the Scala 2 standard library. Obviously, it would be good to have the contents of theDottyPredef
moved insidePredef
. But it is not clear how we should proceed with it – now and in the future.Given the compressed timeframe we have for the Scala 3.0.0 RC1 Release, it would be good to come up with some conclusion on this one by the end of the next week so that we have enough time to act upon the decision.
/cc @nicolasstucki @odersky @sjrd @smarter
The text was updated successfully, but these errors were encountered: