Hey guys, got a question about typing in Kotlin - ...
# getting-started
k
Hey guys, got a question about typing in Kotlin - I don’t especially know what what this typing means
Int.() -> Unit
. I get it’s a function, but this
ClassName + dot
is strange for me
m
the full name of this is function literal with receiver
k
and the receiver has to be a specific type,
Int
in this example? How one pass such argument?
s
val foo : Int.() -> Unit = TODO(); 1.foo()
e
Type.()
limits the function to be member function of the
Type
k
Oh great, thanks @menegatti @edwardwongtl @spand
e
This is also the key of why it is so easy to create DSL using Kotlin