-
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
Deprecate Either#right
and Either#left
projections
#6682
Conversation
Using |
@julienrf no compat library is needed to compile Cross-compilation of 2.11 and 2.13 without warnings sounds like a tall order, given the deprecations there already are in 2.13.x That said, I have no objection in investigating whether adding extension methods to |
Right, I meant 2.11, which is still widely supported by libraries. |
@julienrf something like martijnhoekstra/scala-collection-compat@386b318 ? |
But what is the story with source compat now? Deprecation requires an alternative that makes sure you can compile the same source with no warnings across 3 major versions? |
Yes, something like you did (except that you should have left the collections in the With your addition to the compat library, |
No, I don't think so. It's a best effort / cost-value thing. I'd say warnings for cross-compiling 2.11 - 2.13 is not unexpected. Ordinary projects don't cross-compile, only libraries do, so most people don't have to deal with this question. So LGTM! |
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.
Let's get this show on the road.
@SethTisue merge? |
I'm a little nervous that doing the deprecation will lead to us discovering that |
This is what I came up with for shapeless. |
Either#right
and Either#left
projections
def left = Either.LeftProjection(this) | ||
|
||
/** Projects this `Either` as a `Right`. | ||
* | ||
* Because `Either` is right-biased, this method is not normally needed. | ||
*/ | ||
@deprecated("Either is now right-biased", "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.
This message should explain more directly how users should fix their code.
the deprecation of |
The deprecation of I have to change There was a lot of talk on the various PRs about how there is no rush and the way forward isn't clear, which indicates doing nothing. |
should the deprecation message suggest |
I agree. Using |
|
* scala/scala#5135 - `Either` became right-biased in Scala 2.12 * scala/scala#6682 - `either.right` becomes a deprecated field with Scala 2.13 With Scala 2.13, it's no longer possible to test an `Either`'s right value using ScalaTest's `EitherValues` without getting a deprecating warning - ie writing: ``` either.right.value should be > 9 ``` will give you this on compile: ``` method right in class Either is deprecated (since 2.13.0): Either is now right-biased, use methods directly on Either ``` Given that `Either` is now right-biased, this change gives us the ability to write: ``` either.value should be > 9 ```
* scala/scala#5135 - `Either` became right-biased in Scala 2.12 * scala/scala#6682 - `either.right` becomes a deprecated field with Scala 2.13 With Scala 2.13, it's no longer possible to test an `Either`'s right value using ScalaTest's `EitherValues` without getting a deprecating warning - ie writing: ``` either.right.value should be > 9 ``` will give you this on compile: ``` method right in class Either is deprecated (since 2.13.0): Either is now right-biased, use methods directly on Either ``` Given that `Either` is now right-biased, this change gives us the ability to write: ``` either.value should be > 9 ```
- `RightProjection` is deprecated, `toOption.get` is now recommended: scala/scala#6682 - varargs now works only for immutable Seq, so in `Network` we can't pass directly our `Array`: https://docs.scala-lang.org/overviews/core/collections-migration-213.html - Regarding the `import Ordering.Double.IeeeOrdering` in `AVectorSpec`, have a look at: https://www.scala-lang.org/api/2.13.2/scala/math/Ordering$$Double$.html
- `RightProjection` is deprecated, `toOption.get` is now recommended: scala/scala#6682 - varargs now works only for immutable Seq, so in `Network` we can't pass directly our `Array`: https://docs.scala-lang.org/overviews/core/collections-migration-213.html - Regarding the `import Ordering.Double.IeeeOrdering` in `AVectorSpec`, have a look at: https://www.scala-lang.org/api/2.13.2/scala/math/Ordering$$Double$.html
- `RightProjection` is deprecated, `toOption.get` is now recommended: scala/scala#6682 - varargs now works only for immutable Seq, so in `Network` we can't pass directly our `Array`: https://docs.scala-lang.org/overviews/core/collections-migration-213.html - Regarding the `import Ordering.Double.IeeeOrdering` in `AVectorSpec`, have a look at: https://www.scala-lang.org/api/2.13.2/scala/math/Ordering$$Double$.html
Deprecates the Either projections again for 2.13.x
Originally deprecated in #5135
Deprecation made undone in #5433 which indicates
Warning-free cross-compilation between 2.11 and 2.13 is probably not a big requirement, and not really a feasible aim in the first place.
.swap seems to have proven itself.