cccl icon indicating copy to clipboard operation
cccl copied to clipboard

implement `indeterminate_domain` from P3826R2

Open ericniebler opened this issue 1 month ago • 9 comments

Description

my focus recently has been shoring up std::execution's algorithm customization mechanism ahead of the C++26 release. in that mechanism, the domains on which an operation starts and completes are used to dispatch to the correct algorithm implementation.

a thorny issue has been: what to do when an operation can complete on domain A or domain B? that can sometimes happen. without the ability to pick one domain, the customization mechanism gives up, and no custom implementation is used.

during last week's committee meeting i had a happy thought. most domains do not customize most algorithms. it shouldn't be an error if then(sndr, fn) can complete on domain A or domain B if neither domain customizes the then algorithm.

this led me to the idea of using a set of domains as a domain. indeterminate_domain<A, B> captures the fact that a sender completes on one of two domains.

dispatching with indeterminate_domain<A, B> proceeds as follows:

  • compute the types of D().transform_sender(set_value, sndr, env) for D in A, B, and default_domain.
  • if the 3 transformed sender types are the same, then we use the default_domain transform.
  • otherwise, it is a hard error.

Checklist

  • [x] New or existing tests cover these changes.
  • [x] The documentation is up to date with these changes.

ericniebler avatar Nov 14 '25 02:11 ericniebler

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

copy-pr-bot[bot] avatar Nov 14 '25 02:11 copy-pr-bot[bot]

/ok to test 0d7d3c5

ericniebler avatar Nov 14 '25 02:11 ericniebler

😬 CI Workflow Results

🟥 Finished in 3h 06m: Pass: 85%/120 | Total: 4d 06h | Max: 3h 05m | Hits: 24%/220316

See results here.

github-actions[bot] avatar Nov 14 '25 05:11 github-actions[bot]

/ok to test eeb7182

ericniebler avatar Nov 14 '25 20:11 ericniebler

/ok to test ed7d4fd

ericniebler avatar Nov 14 '25 20:11 ericniebler

/ok to test feb88e5

ericniebler avatar Nov 14 '25 21:11 ericniebler

😬 CI Workflow Results

🟥 Finished in 1h 02m: Pass: 97%/120 | Total: 18h 35m | Max: 49m 26s | Hits: 98%/229382

See results here.

github-actions[bot] avatar Nov 14 '25 22:11 github-actions[bot]

/ok to test ab34e42

ericniebler avatar Nov 15 '25 00:11 ericniebler

🥳 CI Workflow Results

🟩 Finished in 56m 32s: Pass: 100%/42 | Total: 9h 10m | Max: 40m 27s | Hits: 81%/20478

See results here.

github-actions[bot] avatar Nov 15 '25 01:11 github-actions[bot]

Question: If only Domain A and NOT Domain B specializes an algorithm, is the result an error?

miscco avatar Nov 17 '25 08:11 miscco

Yes

ericniebler avatar Nov 17 '25 14:11 ericniebler

Yes

I am not sure whether that is a correct approach. I dont know enough about domains, but I could imagine that specializing algorithms for a specific domain is a valid use case.

With the proposed design, how would I as Domain A author specialize algorithms, if I have no access / knowledge about Domain B? In the end It is the user connecting those domains?

miscco avatar Nov 18 '25 07:11 miscco