https://kotlinlang.org logo
o

orangy

01/11/2018, 7:56 PM
I might need to remind, that many functional languages are based on sequential composition (tuples, params, etc), while Kotlin and other OOP-style languages are using nominal composition. It’s confusing to mix the two (and we have reports when people try to do
val (width, height) = point
and such), so if possible, I wouldn’t add more confusion here. E.g. given
fun f(a: String, b: String)
, how do you use PA to bind first or second parameter to some value?
k

karelpeeters

01/11/2018, 8:02 PM
What do you mean with your point example? I just checked to make sure, and
val (x, y) = Vec2(5.0, 6.0)
definitely works.
o

orangy

01/11/2018, 8:05 PM
making stupid mistakes like getting width & height from point 🙂 because this is positional construct, there is no check.
k

karelpeeters

01/11/2018, 8:05 PM
Ah, gotcha, didn't get the sequential vs nominal thing at first, thanks!
2 Views