-
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
Add typed versions of Mirror.ProductOf#fromProduct #14114
Add typed versions of Mirror.ProductOf#fromProduct #14114
Conversation
b636aa9
to
8fefb76
Compare
Add as experimental? |
Done. Curious when |
We can only remove experimental when going to a new minor release (3.2.0, 3.3.0, 3.4.0, ...). Before each minor release we need to decide which experimental method will become non-experimental. |
It looks to me that the existing |
What are the benefits of adding these API to the standard library as opposed to defining then in user space? IIUC the Mirror API was not designed to provide a type safe experience out of the box, but rather to be a low-level building block for people to build type-safe frameworks on top... |
Discoverability & avoidance of dependencies in foundational libraries, which lead to instability & churn in overall library ecosystem. The more type safety we can provide in these foundational APIs, the easier it will be for folks to build their higher level derivations, frameworks, etc. |
That makes sense, although if it's just an extension method away I think we could also do without. But I suppose such argument could be made for any addition to the standard library... Regardless, I think that PR should also update |
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 think that addition is quite useful.
@mpilquist Can you rebase on latest master, then we can merge? Thank you! |
5d8a855
to
8df5094
Compare
Done, thanks! |
b49216d
to
8248da2
Compare
8248da2
to
6e6e0d2
Compare
The existing
Mirror.ProductOf#fromProduct
method is defined for anyscala.Product
which can lead to some surprising runtime errors:This PR adds
fromTuple
andfromProductTyped
extension methods toMirror.ProductOf[T]
, both which ensure the argument is well typed: