-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
StdLib Extensions #22006
Comments
inline |
Beginner students often struggle with versatile |
If we are allowed to modify the code (to break bincompat, but keep sourcecompat, kinda), then:
|
We will definitely not break backwards binary compatibility at this point. |
Why is |
If we are not breaking any compatibility (understandable) then there is very little that can be fixed this way: mostly adding some implicit evidence in such a way that evidence would be erased and not become a part of binary signature (didn't know it was even possible? is it?). Maybe OOTB witness here and there. What other changes are allowed? |
|
possibly replace the signature in the scala2-stdlib-tasty? otherwise the trick like with stdLibPatches.Predef |
I'm not sure if this viable now in Scala 3, but I think it might be viable to also consider changing For example, consider the following very simple example: trait Collection[T] {
def foreachOld[U](f: T => U): Unit
def foreachNew(f: T => Unit): Unit
}
final case class BoxedInt(x: Int) extends Collection[Int] {
def foreachOld[U](f: Int => U): Unit = f(x)
def foreachNew(f: Int => Unit): Unit = f(x)
} Here's how the
I believe this is the reason Note that it's also possible to just do something like: def foreach[U](f: T => U): Unit
@scala.annotation.targetName("foreachUnboxed")
def foreach(f: T => Unit): Unit Which I think would not break binary compatibility.
|
Since extension methods are not as flexible as implicit class methods, I'm fully against this. We first need to try and solve https://contributors.scala-lang.org/t/relaxed-extension-methods-sip-54-are-not-relaxed-enough/6585 |
My reasons:
And if you mentioned fast C-style loops, I guess if anyone uses |
The original pushback from Ichoran on performance of tap: scala/scala#7007 (comment) That is followed by the pushback from Miles on Also, the heightened dislike for "symbolic operators", peculiar to that period of time, deterred the definition of operators which everyone has asked for ever since. |
This is a mantle issue to collect areas where the standard library should be retro-fitted to work better with Scala 3. Please add more requests in comments, or, if you have access rights, edit this PR description.
derived
in classes like Ordering. See https://contributors.scala-lang.org/t/derived-ordering-for-simple-enum/5243/10CanEqual
given instances in classes likeOption
CanEqual
requirements in methods likecontains
foreach
inRange
so that we finally get fast C-style for loopsThe text was updated successfully, but these errors were encountered: