extension functions in Kotlin are the nicest I've ...
# announcements
v
extension functions in Kotlin are the nicest I've seen
r
vaskir: yes, they is
v
very lightweight syntax plus they can be defined locally. super nice.
and implicit
this
🙂
r
even further you can wrap Realm.transaction for extension function
i did something like this
inline fun Realm.transaction(body: Realm.() -> Unit) { beginTransaction() use { body() commitTransaction() } }
v
yeah, inline functions are a bit like template functions in, say, D.
r
fun insert(obj: MessageObject){ val realm = Realm.getInstance() realm.transaction { insertOrUpdate(obj) } }
👍
v
but the killer thing for me is coroutines. mind blown stuff. the best approach I've see.
r
Couroutine just like c# did
v
nooo.
r
I have experience in that field. C# have await async
And kotlin trying to mimic that, but in different flavors
v
in C# async/await is a lang feature, working only for asyncs. coroutines - general purpose feature, like computation expressions in F#, but integrated more seamlessly with the the rest of lang.
r
Yes, absolutely true
v
and the whole story with synchronous channels are just awesome.
r
Yes
Python, Golang also couroutine
v
I even wrote a small blog post on it today 🙂 https://vasily-kirichenko.github.io/fsharpblog/actors
👏 1
r
But, kotlin couroutine much concise
Thanks for sharing
v
🙂
I've just impressed. We have such stuff in F#, but it's cryptic. Really cryptic and hard to write. Kotlin looks 10x lighter and as powerful.
r
Yes, kotlin is the most mature language I ever seen after C#
Anyway, kindly follow me on medium