-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Children factories as extensions on CoroutineScope #688
Comments
I want to propose again a previous consideration about the scope (3 in #410 (comment)) Is it possible to reconsider Moreover the Finally |
It is not. There is a lot of issues, e.g. what if you want to use
Not sure why it is useful.
True, there is some confusion between Scope is just a box around context with its own type because Moreover,
This is a grey area actually, I'm not sure we should. Anyway, this issue is a wrong place to discuss it, I expect it to be an umbrella for small syntactic improvements rather than the discussion about scopes design, let's keep it clear. |
@qwwdfsad thank for your patience.
Some library method requires a In my opinion It is possible to reconsider coroutineJob property. |
@qwwdfsad We should think twice before adding those (take a look and actual use-cases again), because those extensions are dangerous, see:
Now my parent job never completes and how am I supposed to debug that in the large piece of code? |
@fvasco |
Nice @elizarov
There is no rules about it in the official documentation, you should mention this intention. Moreover it will possible to define: val CoroutineScope.coroutineJob : Job get() = checkNotNull(coroutineContext[Job]) { "No Job founds in this coroutine scope"} So we can consider to deprecate: val CoroutineContext.isActive
fun CoroutineContext.cancel* Because it is not possible to assume any |
Decided not to implement as too dangerous and error-prone |
The current approach to structured concurrency forces to write a lot of boilerplate while building scoped hierarchies such as
val job = Job(corotineContext[Job])
.We should provide a more friendly way to create nested entities:
Also, we could (should?) assert that scope has a
Job
and maybe provide a way to extract dispatcher from the scope.The text was updated successfully, but these errors were encountered: