-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove the helpers in scala.deriving. #10405
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
Conversation
The community build says that two projects are affected: scodec and upickle. This fits my earlier expectations that the members here are fairly specific to deserializers. To follow up on our meeting: There are two more-or-less separate things here:
/** The Mirror for a product type */
trait Product extends Mirror {
/** Create a new instance of type `T` with elements taken from product `p`. */
def fromProduct(p: scala.Product): MirroredMonoType
/** Create a new instance of type `T` with elements taken from the array `elems`. */
def fromArray(elems: Array[AnyRef]): MirroredMonoType =
fromProduct(new Product {
def canEqual(that: Any): Boolean = true
def productArity: Int = elems.length
def productElement(n: Int): Any = elems(n)
})
} There is then no need for overriding more stuff from That said, why are we blessing Arrays over other sequences? Why not accept all kinds of For |
So |
Yes, I also had that reasoning. I couldn't wrap my head around how either typeclass-derivation3 or scodec know that it is always a def asProduct(x: MirroredMonoType): Product = x.asInstanceOf[Product] or even better, we could refine type MirroredMonoType <: Product In the first case (in |
@milessabin ^ Do you think that makes sense? |
bc53a0b
to
64d9311
Compare
Since it looks like we're going to release an M2, I opened #10436 which deprecates the helpers, so that we can more easily remove them in RC1. I have also improved the replacements in the tests, compared to this PR. IMO the replacements are better than using the helpers, at this point. |
* `ArrayProduct` * `EmptyProduct` * `productElement`
64d9311
to
5c9aec4
Compare
Superseded by #10830 |
Draft PR for now to see what breaks in the community build.