Skip to content
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

Add execution::invoke() algorithm #303

Open
lewissbaker opened this issue Nov 18, 2024 · 0 comments
Open

Add execution::invoke() algorithm #303

lewissbaker opened this issue Nov 18, 2024 · 0 comments
Labels
enhancement New feature or request good-first-issue Something to try if you're new to the project P1

Comments

@lewissbaker
Copy link
Collaborator

It seems reasonably common to want to invoke a function with some arguments on some execution context as an asynchronous operation, representing this operation as a sender.

Several examples currently build this sort of operation out of a combination of just() and then(), possibly combined with starts_on() to do the scheduling.

The pattern of writing then(just(), [] { do_something(); }) just to wrap up a call to some lambda in a sender seems like an overly complicated (and also compile-time-expensive) way of writing this.

It would be more concise and also should be much simpler in terms of implementation (e.g. computing completion-signatures) to just have an algorithm that takes an invocable and that returns a sender that completes with the result of invoking that function/lambda when the sender is started.

e.g. execution::invoke([] { do_something(); }) instead of the just+then expression above.

This could then be composed with starts_on() to execute do_something on a particular scheduler's context.

@lewissbaker lewissbaker added enhancement New feature or request P1 good-first-issue Something to try if you're new to the project labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good-first-issue Something to try if you're new to the project P1
Projects
None yet
Development

No branches or pull requests

1 participant