Which features attract you to use Kotlin?
# getting-started
k
Which features attract you to use Kotlin?
I like coroutines.
s
closures like in functional languages, native compiler, tail call optimisation
k
Shared code between jvm and ios (combination of performance and ease of use).
y
The ability to declare functions outside of classes. I mean come on Java
s
Honestly my favorite "feature" is that i seem to find myself thinking "oh man i have to do X small yet annoying thing" just to find out "oh no i don't, theres an ext function for that!" Also TornadoFX is fun.
c
that its not java and can be used in the same places
loose functions, closures
extension methods
s
the combination of extension functions, ext functs with receiver, lambdas, and what i thought was a weird feature of putting the last function parameter on the outside of the
()
inside of
{}
instead ...that come together to make the various DSLs is quite nice.
c
yeah i still find that one odd
s
It's one of those things that sounds really arbitrary and useless until you see it in action. So if you've used .apply {} or .let {} or any of the DSLs like tornadofx or ktor it starts to click.
n
combine that with extension functions with receiver object inside your DSL objects/class and you get the power of the DSL, you can quite possibly model any arbitrarir nested configuration in a typesafe and readable way
then add generics to the receivers and you get somewhere
i should probably make some sample that showcases what i mean
c
yeah only starting to do stuff with a DSL now
but before then, it seems like extra syntax for no reason
i kinda feel the same about the implicit
it
in lambda expressions as well
k
But kotlin need remember more things then java.
n
do you mean when writing kotlin or the kotlin compiler ?
s
data class, null safety, less verbose code