Skip to content
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

Remove unused type parameter for Parallel instances #2789

Closed
wants to merge 2 commits into from

Conversation

Billzabob
Copy link
Contributor

No description provided.

@tpolecat
Copy link
Member

Looks like changing def to val and/or removing the unused type parameter breaks binary compatibility.

@Billzabob
Copy link
Contributor Author

@tpolecat How does cats handle binary compatibility breaking changes?

@kailuowang
Copy link
Contributor

@Billzabob we made a promise to no breaking binary compatibility on core until Cats 3.0.
Did it cause any issues for users?
We could fix it in a BC way - we remove the implicit keyword of the original def, make it package private and deprecated, add your implicit val with a BinCompat suffix.

@Billzabob
Copy link
Contributor Author

@kailuowang No I don't think it causes any issues so it's probably not worth it to do all that. It was just something I noticed and mentioned on Gitter and someone suggested I make PR to fix it. Does that mean this PR just stays up until 3.0?

@kailuowang
Copy link
Contributor

Okay, I will schedule it for 3.0

@kailuowang kailuowang added this to the 3.0 milestone Apr 14, 2019
@kailuowang kailuowang removed this from the 3.0 milestone Jul 9, 2019
@kailuowang kailuowang self-requested a review July 9, 2019 16:32
@johnynek
Copy link
Contributor

johnynek commented Sep 8, 2019

isn't this superceded by @travisbrown 's great observation here: #3012

@travisbrown
Copy link
Contributor

@johnynek I hadn't seen this PR, but the problem isn't removing the type parameter, it's the change from def to val and the fact that this is a trait—you end up with the kind of silly-seeming synthetic public setter.

We could go ahead and make this change but without the vals.

@johnynek
Copy link
Contributor

johnynek commented Sep 8, 2019

actually, I didn't even look at the diff (like a fool). Sorry, I just read the title and assumed.

@Billzabob
Copy link
Contributor Author

@travisbrown Can you help me understand what you mean by "synthetic public setter"? I thought zero parameter defs and vals were basically equivalent if you're not side-effecting and aren't using type parameters.

@travisbrown
Copy link
Contributor

@Billzabob They're equivalent in the universal access principle sense—they look the same to callers—but they're implemented differently on the underlying platform, especially in traits, where the initialisation of vals is tricky. The compiler is mapping traits onto JVM interfaces, which don't have instance fields and up until Java 8 didn't even have instance method implementations, and the details of that mapping mean making a def a val breaks binary compatibility (definitely on 2.11 but IIRC also on 2.12 and 2.13).

@travisbrown
Copy link
Contributor

@Billzabob This is a good catch and I'd personally really like to see this change in 2.0.0. Would you mind opening a new PR that only removes the type parameters? Unfortunately it'll have to happen in two places, since these instances are now part of version-specific code, but if you search for the names you'll find them.

@travisbrown
Copy link
Contributor

@Billzabob Hope you don't mind but I took your commit, updated it, and opened #3042, with the hope that we can get this into today's 2.0.0.

@Billzabob
Copy link
Contributor Author

@travisbrown I don't mind at all! Also, thanks for the explanation.

# Conflicts:
#	core/src/main/scala/cats/instances/parallel.scala
@codecov-io
Copy link

codecov-io commented Sep 10, 2019

Codecov Report

Merging #2789 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2789   +/-   ##
=======================================
  Coverage   93.46%   93.46%           
=======================================
  Files         368      368           
  Lines        6979     6979           
  Branches      184      184           
=======================================
  Hits         6523     6523           
  Misses        456      456

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccd712a...77f5c64. Read the comment docs.

@travisbrown
Copy link
Contributor

Included in #3042, which is now merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants