Are there some property delegates for computing something expensive, preferably using suspending fun?
m
Mike
07/22/2019, 3:45 PM
Is 'lazy' what you're looking for? Computes value once on first usage. See built in delegates in docs. I'm afk or I'd provide direct link.
m
Marko Mitic
07/22/2019, 3:45 PM
Something thread-safe like
lazy
but actually eager
Marko Mitic
07/22/2019, 3:46 PM
Considering it's expensive to compute, I'd like to preload it before anyone needs it and avoid blocking clients
c
Casey Brooks
07/22/2019, 3:48 PM
a suspended delegate doesn’t really make sense. Property access is synchronous, suspense is not. You’d have to block the property access to run a suspending calculation in the getter. Access to that property should be put behind a suspending getter-type function, and clients just need to manage the coroutine themselves