https://kotlinlang.org logo
#announcements
Title
# announcements
k

kevinmost

07/25/2017, 3:16 PM
stuff(): Job = launch(UI) { ... }
k

kingsley

07/25/2017, 3:17 PM
Haha. True. I was looking for more complicated return types like
Deferred<MutableList<SomeClass>>
I’d rather omit that than do away with
fun
u

uhe

07/25/2017, 3:21 PM
my rule is to never omit return types for public funs
k

kingsley

07/25/2017, 3:22 PM
Yea. There is that possibility. Which can be enforced by code styles for instance. But I like that the syntax is lenient
u

uhe

07/25/2017, 3:23 PM
I like it too, but for public funs there are consequences
e.g. if you do stuff like
fun publicFun() = privateFun()
and then change the implementation of
privateFun
so it returns something different
k

kingsley

07/25/2017, 3:24 PM
Also, I can write a
fun a() = b
and do a quickfix to apply the type. Forcing me to put the type beforehand in return forces me to think too deeply about it
k

kevinmost

07/25/2017, 3:36 PM
Even in Java you can make your function
public void a() { return someObject; }
and use the quickfix to change the return to the proper type. So I don't think that'd be an issue
k

kingsley

07/25/2017, 7:14 PM
Well. In Kotlin, both versions will be syntactically correct. But of course, not a big issue. Just pointing it out 😉