Alessandro Diaferia
02/12/2019, 3:49 PMsearch
function and this function depends on a series of initialization steps that the instance has to perform before being able to actually search and return results.
How would you handle this using coroutines? Would you have an initialize
function that returns a Job
or would you simply mark search
as suspend
and “hide” the suspension as an implementation detail waiting internally for the initialization job to complete? Or would you tackle this issue in a completely different way?withoutclass
02/12/2019, 3:54 PMDeferred
and then if search
is called, make sure your search function await
on those stepsdewildte
02/12/2019, 4:02 PMactor
and pass the actor the return Channel
to send the results too.Dico
02/12/2019, 8:38 PMJob
instance and join it