C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Non-forwarding environment queries in sender/receiver

From: Daniel Eiband <daniel.eiband_at_[hidden]>
Date: Wed, 19 Mar 2025 07:48:11 +0000
Hi Brain,

Thank you for your reply! I was wondering the same, but I didn’t want to re-post my question right away.

In the meantime, I‘m not so sure about which behavior I want regarding my second point. The first one still seems to be inconsistent to me and I will file an issue.

Regards,
Daniel

From: Brian Bi <bbi5291_at_gmail.com>
Sent: Wednesday, March 19, 2025 2:25 AM
To: std-proposals_at_[hidden]
Cc: Daniel Eiband <daniel.eiband_at_[hidden]>
Subject: Re: [std-proposals] Non-forwarding environment queries in sender/receiver

You don't often get email from bbi5291_at_[hidden]<mailto:bbi5291_at_[hidden]>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
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_at_[hidden]<mailto:std-proposals_at_[hidden]>> 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_at_[hidden]<mailto:Std-Proposals_at_lists.isocpp.org>
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals


--
Brian Bi

Received on 2025-03-19 07:48:15