-
Notifications
You must be signed in to change notification settings - Fork 3.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
include migration instructions in Either projection deprecation message #7121
include migration instructions in Either projection deprecation message #7121
Conversation
@@ -168,7 +168,7 @@ sealed abstract class Either[+A, +B] extends Product with Serializable { | |||
* | |||
* Because `Either` is right-biased, this method is not normally needed. | |||
*/ | |||
@deprecated("Either is now right-biased", "2.13.0") | |||
@deprecated("Either is now right-biased, use methods directly on Either", "2.13.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no get method on Either, should one be added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable.
@SethTisue can and should we still squeeze that in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it to the PR, but I have no strong feelings on the matter one way or the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meh, I think I'd rather not add more unsafe, non-total methods unless it's really a clear win. admittedly there is precedent on Option
, but I basically think nobody's asking for this and we're probably better off without it. just as we might arguably be better off without Option#get
(which we're probably stuck with, because tradition)
on Either
, .getOrElse(throw ...)
is already available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we need a better deprecation message when calling .right.get, I guess people are likely to replace it with .toOption.get (which is why I'd rather avoid the indirection and have Either#get)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually .toOption.get isn't great because it won't preserve the value of Left in the exception shown (which could be critical for debugging)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a new proposal to this branch: the deprecated message points to getOrElse
, and get
is removed.
src/library/scala/util/Either.scala
Outdated
@@ -656,7 +656,7 @@ object Either { | |||
* | |||
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse | |||
*/ | |||
@deprecated("Either is now right-biased", "2.13.0") | |||
@deprecated("Either is now right-biased, calls to right should be removed, and the operation should be used on Either directly", "2.13.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put backquotes around right
@martijnhoekstra could you squash the changes into 1? |
32653e4
to
34b4424
Compare
@lrytz this is 1 commit now |
1️⃣ 🏆 |
addresses #6682 (comment)