I'm not sure whether the authors who can answer your question check this list. It might be a good idea to file an issue here: https://github.com/cplusplus/sender-receiver/issues

On Fri, Feb 28, 2025 at 11:23 AM Daniel Eiband via Std-Proposals <std-proposals@lists.isocpp.org> wrote:

Hi,

 

I might have a use case for an environment query in sender/receiver that is not a forwarding query. While looking into the implementation of various get_env() I came across two cases that just look wrong to me:

 

1. While default-impls​::​get-env only forwards forwarding queries (see https://eel.is/c++draft/exec.snd.expos#35), impls-for<when_all_t>​::​get-env seems to forward all queries: https://eel.is/c++draft/exec.when.all#6.3. I would expect when_all() to not forward non-forwarding queries.

 

2. The default implementation of as_awaitable() only makes forwarding queries available (see https://eel.is/c++draft/exec.as.awaitable#4.4). I would expect it to forward all queries.

 

Usually as_awaitable() is not visible to users of a coroutine. To my understanding it is intended to be used in await_transform(). Therefore, to me it is surprising that non-forwarding queries are not available in a coroutine body. Consider

 

co_await read_env(get_non_forwarding);

 

Even if the environment of the coroutine promise supports the get_non_forwarding query, the above read_env() expression would not be able to access the value (even though nothing is between me and the coroutine). Note that for my own sender I could customize as_awaitable() and get access to my non-forwarding query which is even more confusing.

 

Is this all intended?

 

Regards,

Daniel

 

--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals


--
Brian Bi