Is there an established convention on how to propa...
# coroutines
n
Is there an established convention on how to propagate structured concurrency in a hierarchy of classes (with progressively smaller lifecycle)? When using functions this comes for free. With objects, you have a handful of options, • pass parent job to the constructor, object can define its private scope using job as a parent • have object implement CoroutineScope, parent should cancel() it • have object expose a cancel/release function • probably more The first seems less error prone to me, but also something I have rarely seen in other people's code.
👍 1
👀 1