Sorry for not replying to this idea, I’m a little bit afraid of posting to many posts here.
Personally I found the proposal of having a type in the unapply object with a tuple of names a much simpler approach.
Do you mean like:
object User:
type Unapply = ("name", "age", "city")
der unapply: Some((String, Int, String)) = ???
Which seems quite doable. Unapply
could be defined in a trait of User
. I wonder what a creative mind would do with this mechanism.
Or do you mean more like named tupples?
object User:
der unapply: Some((name: String, age: Int, string: String)) = ???