You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CoroutineDispatcher.invoke, a function used as such:
Dispatchers.IO {
stuff
}
is a shorter version of withContext that only works with dispatchers.
Does this function need to exist? It seems to predate structured concurrency and is so terse that it offers no indication as to its underlying behavior. Does it launch a new coroutine? Does it move the current coroutine? Does the supplied block honor structured concurrency?
I personally have a hard time finding a reason for this function to continue to exist.
kevincianfarini, FunkyMuse, veyndan, roomscape, zach-klippenstein and 5 more
Activity
CLOVIS-AI commentedon Jul 29, 2024
For context, it was originally added in #428 as an experiment. As far as I know, it is very rarely used (if at all) in the ecosystem.
dkhalanskyjb commentedon Aug 1, 2024
Very few usages found:
https://grep.app/search?q=.IO%20%7B&case=true&filter[lang][0]=Kotlin
https://grep.app/search?q=Dispatchers.Default%20%7B&case=true&filter[lang][0]=Kotlin
https://grep.app/search?q=Dispatchers.Main%20%7B&case=true&words=true&filter[lang][0]=Kotlin
I personally find this to be non-idiomatic modern Kotlin.
Thing { }
looks to me like a builder of some sort. So, I'm for this.qwwdfsad commentedon Aug 1, 2024
We can try and proceed with it in RC2 along with other deprecations
dkhalanskyjb commentedon Aug 1, 2024
I'm not sure what I expected, but the deprecation doesn't look pretty in the IDE!

Given how rare this is, I don't think this should stop us, though.
dkhalanskyjb commentedon Aug 1, 2024
2024-08-01-135455_1613x586_escrotum.webm
Deprecate CoroutineDispatcher.invoke
JakeWharton commentedon Aug 1, 2024
Finding some good IntelliJ bugs/feature requests at least!