Jordan Foo
03/18/2021, 3:19 PMfun Bar.newFunction() {}
What exactly does this do?
fun Bar.() {}
Marc Knaup
03/18/2021, 3:21 PMJordan Foo
03/18/2021, 3:22 PMMarc Knaup
03/18/2021, 3:22 PMJordan Foo
03/18/2021, 3:23 PMJordan Foo
03/18/2021, 3:23 PMchristophsturm
03/18/2021, 3:24 PMMarc Knaup
03/18/2021, 3:24 PMApplication
instance to be passed as receiver (this
).christophsturm
03/18/2021, 3:24 PMval x: Bar.() -> Unit = {}
christophsturm
03/18/2021, 3:24 PMJordan Foo
03/18/2021, 3:25 PMJordan Foo
03/18/2021, 3:25 PMMarc Knaup
03/18/2021, 3:25 PMval foo1 = fun Bar.() {}
fun Bar.foo2() {}
Is roughly the same. Just that the former is an extension lambda and the second a real extension function.Jordan Foo
03/18/2021, 3:26 PMMarc Knaup
03/18/2021, 3:26 PMthis
. Bar
in this case.Zach Klippenstein (he/him) [MOD]
03/18/2021, 5:52 PMfun () {}
) and “lambdas” which don’t use the fun
keyword, but yea they’re effectively the same thing