cplusplus / sender-receiver

Issues list for P2300
Apache License 2.0
20 stars 4 forks source link

[execution.senders.adaptors.bulk] wording should indicate that f is called with i = [0, ..., shape-1] #102

Open ericniebler opened 11 months ago

ericniebler commented 11 months ago

Issue by lewissbaker Tuesday Dec 28, 2021 at 07:04 GMT Originally opened as https://github.com/NVIDIA/stdexec/issues/340


The current wording says:

If the function selected above does not return a sender which invokes f(i, args...) for each i of type Shape from 0 to shape when the input sender sends values args..., or does not propagate the values of the signals sent by the input sender to a connected receiver, the program is ill-formed with no diagnostic required.

and

When execution::set_value(r, args...) is called, calls f(i, args...) for each i of type Shape from 0 to shape, then calls execution::set_value(out_r, args...). If any of these throws an exception, it catches it and calls execution::set_error(out_r, current_exception()).

The wording here seems to imply that f is called once for each i in range 0 to shape inclusive, but this would result in shape + 1 calls to f. Whereas I assume that the intent is that f should be called shape times. i.e. for i from 0 to shape - 1.

lewissbaker commented 4 months ago

This wording is still an issue in P2300R10.

Current wording says:

The expression connect(out_sndr, rcvr) has undefined behavior unless it creates an asynchronous operation ([async.ops]) that, when started:

  • on a value completion operation, invokes f(i, args...) for every i of type Shape from 0 to shape, ...

This is still ambiguous whether range is inclusive or exclusive in the upper-bound of shape.

lewissbaker commented 1 month ago

A resolution to this issue has been proposed in https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3396r0.html