-
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
Extensions on CoroutineScope to improve its mental model #828
Comments
I don't see see compelling use-cases for the first 4 extensions (
So I'd suggest to call it |
It is possible to avoid launch { // note: this: CoroutineScope
// ... other code
job.cancel()
} Personally I consider this path cleaner (and shorter). |
@fvasco
|
@elizarov, I agree with you on first point, the above functions can become an extensions on Regarding the second point, I not agree yet (#410 (comment)). |
In case of
Maybe a migration could inspect code, searching for potential conflicts leading to unintended behavior still? |
Or maybe there could be a "light" implementation of job that just cancels.. The whole idea is to make things simpler, if you have to check for nulls (or know when to do that for beginners), you lost part of the advantage. |
We've decided to start with an experimental |
We do have |
We see a lot of confusion around the fact that the library has two very similar entities exposed in various ways (e.g. all builders are extensions on CoroutineScope, but have CoroutineContext argument)
While they, in fact, have different semantics, the question is how to educate the users in a most natural way without forcing them to read a lot of documentation in the guide.
As a first step, we could add following extensions to CorouineScope (and mark them with
DslMarker
to help autocompletion):The text was updated successfully, but these errors were encountered: