John Guerra
09/18/2020, 9:32 PMoverride fun onEnable() {
plugin.server.onlinePlayers.forEach(::join)
}
Rather than
override fun onEnable() = plugin.server.onlinePlayers.forEach(::join)
nanodeath
09/18/2020, 9:34 PMonEnable(): Unit = ...
if you go with the latterJohn Guerra
09/18/2020, 9:36 PMRuckus
09/18/2020, 9:42 PMfun ... =
. From my experience, those who just view it as short hand / sugar tend to be okay with it, whereas those who view it as a form of assignment (semantically of course, not literally) tend to take issue. I'm not sure the reasoning or if I've just got some severe sample bias.nanodeath
09/18/2020, 9:45 PMval ... =
and fun ... =
John Guerra
09/18/2020, 9:46 PMJakub Pi
09/19/2020, 3:06 AM: Unit
then in some rare cases, the type inference may fail. I've seen it happen once or twice in real code (though probably not with Unit as the return type - some heavy generics involved).