<@U9DPCUAB0> Moving discussion to coroutines, othe...
# coroutines
@ursus Moving discussion to coroutines, otherwise too many offoptic for this thread https://kotlinlang.slack.com/archives/C09222272/p1544765551091900?thread_ts=1544517238.067400&amp;cid=C09222272
Vlastimil Brecka [2 hours ago] and I also want lazy with arguments from local scope Andrey Mischenko [35 minutes ago] @thelgis But all 3 features are just libraries, I don’t think that you need 2.0 for that Andrey Mischenko [34 minutes ago]
and I also want lazy with arguments from local scope
imo it looks as anti-patern singleton with params. Why do you need this? Vlastimil Brecka [4 minutes ago] @gildor basically caching some synchronous calculation for example loading bitmap. Successive calls of the function if need to !! in the else branch, just ugly.. Andrey Mischenko [3 minutes ago] You don’t need lazy for that also just use coroutines and Deferred (edited) Vlastimil Brecka [3 minutes ago] hmm neverheard of it Vlastimil Brecka [2 minutes ago] oh cooroutines, nah, its synchronous code Vlastimil Brecka [2 minutes ago] val _bitmap = if bitmap == null loadBitmap(some param) else bitmap!!
Just for context
This is exatly what I’m talking about You can easily of course do exactly the same behavior without coroutines
But worst thing with such primitive is that you never can predict will it be blocking or not, so you cannot even use it for UI or any other non-blocking code
@ursus See what I mean https://pl.kotl.in/rJq-qallN
This is a way to encapsulate heavy operation and use it safe from any thread