Skip to content

Consider deprecation cycle for CoroutineDispatcher.invoke #4199

@JakeWharton

Description

@JakeWharton
Contributor

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.

Activity

CLOVIS-AI

CLOVIS-AI commented on Jul 29, 2024

@CLOVIS-AI
Contributor

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

dkhalanskyjb commented on Aug 1, 2024

@dkhalanskyjb
Contributor
qwwdfsad

qwwdfsad commented on Aug 1, 2024

@qwwdfsad
Member

We can try and proceed with it in RC2 along with other deprecations

dkhalanskyjb

dkhalanskyjb commented on Aug 1, 2024

@dkhalanskyjb
Contributor

I'm not sure what I expected, but the deprecation doesn't look pretty in the IDE!
Screenshot_20240801_134245
Given how rare this is, I don't think this should stop us, though.

dkhalanskyjb

dkhalanskyjb commented on Aug 1, 2024

@dkhalanskyjb
Contributor
2024-08-01-135455_1613x586_escrotum.webm
added a commit that references this issue on Aug 1, 2024
33b285f
JakeWharton

JakeWharton commented on Aug 1, 2024

@JakeWharton
ContributorAuthor

Finding some good IntelliJ bugs/feature requests at least!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @JakeWharton@qwwdfsad@CLOVIS-AI@dkhalanskyjb

        Issue actions

          Consider deprecation cycle for `CoroutineDispatcher.invoke` · Issue #4199 · Kotlin/kotlinx.coroutines