-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unifies NonEmpty datatypes on 2.13 to the Newtype encoding #2930
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2930 +/- ##
==========================================
- Coverage 94.03% 93.34% -0.69%
==========================================
Files 370 369 -1
Lines 7038 6796 -242
Branches 186 185 -1
==========================================
- Hits 6618 6344 -274
- Misses 420 452 +32
Continue to review full report at Codecov.
|
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.
Thank you so much for this huge effort @kailuowang!
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'm strongly 👎 on having significant differences between e.g. NonEmptyList
implementations on 2.13 and pre-2.13 Scala versions. Even if we could be 100% confident that this would never cause problems for people cross-building non-version-specific code (which I'm at most maybe 30% confident about), I'm not sure it's worth the confusion for people reading the codebase or trying to reason about performance across Scala versions.
If there's a good reason to make breaking changes (and in my view there is and has been for months), let's bundle them up and make a breaking change, not smuggle them in via version-specific shenanigans like this.
laws/src/main/scala-2.12-/cats/laws/discipline/ScalaVersionSpecific.scala
Outdated
Show resolved
Hide resolved
Thanks for your feedback @travisbrown. I am going to take this chance to rethink our 2.0-3.0 strategy.
I am 95% confident, since all the existing tests are still cross building without the need for version specific stuff, but for rare cases it shouldn't be hard to add version specific code, they probably already have the machinery to support 2.13
Not sure if that will be a big issue, different Scala versions have different performance implications.
I disagree with your suggestion that this PR is smuggling breaking changes. For a change to be breaking it has to be breaking from past binaries. In this case, there are no past (officially released) binary to be broken from. Users who upgrades from 1.6 to 2.0 while migrating to or adding support for Scala 2.13 won't experience any breaking changes. |
@kailuowang If the argument is "we want to standardize these as soon as possible" and "as soon as possible" is now for 2.13, then why couldn't we make the same argument for other things that have been blocked by bincompat? Why not have a separate source tree for 2.13 with no |
That's exactly my rethinking is about. I am drafting a new plan for 2.0 now. Will submit the issue soon. |
@kailuowang To address your comment on Gitter:
My more general concern here is that the Cats maintainership (and I'm including myself) has a pretty poor track record when it comes to managing complexity and promoting consistency. Things are constantly slipping into the public API that definitely should not be there, there are instances all over the place that don't follow naming / location conventions, etc. I don't trust us to maintain separate source trees for 2.13 and pre-2.13 versions without making mistakes that will lead to pain for other library maintainers and a worse experience for users. |
(That last comment may come across as more negative than I intend—I think Cats is a great library, I use it every day, I'm proud of the small part I've played in helping to build it, and I appreciate the work everyone else is doing. I just think we need to be realistic about the limited resources we have in terms of maintainer attention and effort, and correspondingly thoughtful about what we prioritize.) |
I don't have much else to say at this point, but just want to clarify on so called "a pretty poor track record" which is referring to the following statement, among other complaints in the linked issue.
Both the inconsistency in #2790 and |
Okay, if that's the direction people want to go I'd be happy to be proven wrong! |
I extracted the less contentious |
replaced by @2941 based on feedback. |
As of now there are four types of NonEmptyXXX data types in Cats.
This PR unifies them all to the newtype encoding 4 but only on Scala 2.13, on Scala 2.12- things are mostly kept to maintain BC.
This PR also added a new
NonEmptyLazyList
data type on 2.13, fixes #2903