Alejandro Rios
02/22/2022, 12:49 PMMyFunction.invoke()
instead of MyFunction()
?Joffrey
02/22/2022, 12:51 PMinvoke
, for instance if the function instance is nullable and you want to use the safe-call operator: myFunction?.invoke()
.
But otherwise in general I would say it's a matter of style/preference.Alejandro Rios
02/22/2022, 12:52 PMephemient
02/22/2022, 2:57 PMFoo()
resolves to the constructor and Foo.invoke()
resolves to the invoke
operator on Foo.Companion
, https://kotlinlang.slack.com/archives/C0B8MA7FA/p1645273130231929