Two things I’ve wanted in Kotlin over the last yea...
# announcements
r
Two things I’ve wanted in Kotlin over the last year of tinkering: 1. function types that retain names and allow default arguments 2. a function on data classes that passes all the components as parameters to another function (like, a ‘destructure to target’)
Obviously these two things taken together could be very cool. 🙂
d
r
Yeah I like the sugar on it. 🙂 I’d be happy with something like:
Copy code
data class Thing(val first: Int, val second: String)

val thing = Thing(1, "two")

thing.withData { first: Int, second: String ->
//no parens needed to destructure
}
As in theory it would be trivial to add to the class generated by the ‘data’ keyword.
a
I'm not sure but maybe this would help for the 2 https://arrow-kt.io/docs/0.10/generic/product/#tupled
😍 1
r
Now just to get more (any?) of the arrow modules to be multiplatform compliant 😅
e
or maybe reuse the splat operator when passing the reference to a function call