From 4d3e68c40cc97a61c4b9ef933f92f3779ad05442 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Wed, 26 Jun 2024 19:35:47 -0700 Subject: [PATCH] rename `read` to `read_env` --- execution.bs | 57 +++++++++++++--------------------------------------- 1 file changed, 14 insertions(+), 43 deletions(-) diff --git a/execution.bs b/execution.bs index 4be6918..0b15fb3 100644 --- a/execution.bs +++ b/execution.bs @@ -388,7 +388,7 @@ struct dynamic_buffer { // sender_of auto async_read_array(auto handle) { // 2 return just(dynamic_buffer{}) // 4 | let_value([handle] (dynamic_buffer& buf) { // 5 - return just(std::as_writeable_bytes(std::span(&buf.size, 1)) // 6 + return just(std::as_writeable_bytes(std::span(&buf.size, 1))) // 6 | async_read(handle) // 7 | then( // 8 [&buf] (std::size_t bytes_read) { // 9 @@ -3196,29 +3196,16 @@ execution::sender auto just_stopped(); Returns a sender with no [=completion scheduler|completion schedulers=], which completes immediately by calling the receiver's `set_stopped`. -### `execution::read` ### {#design-sender-factory-read} +### `execution::read_env` ### {#design-sender-factory-read}
-execution::sender auto read(auto tag);
-
-execution::sender auto get_scheduler() {
-  return read(execution::get_scheduler);
-}
-execution::sender auto get_delegation_scheduler() {
-  return read(execution::get_delegation_scheduler);
-}
-execution::sender auto get_allocator() {
-  return read(execution::get_allocator);
-}
-execution::sender auto get_stop_token() {
-  return read(execution::get_stop_token);
-}
+execution::sender auto read_env(auto tag);
 
Returns a sender that reaches into a receiver's environment and pulls out the current value associated with the customization point denoted by `Tag`. It then sends the value read back to the receiver through the value channel. For -instance, `get_scheduler()` (with no arguments) is a sender that asks the +instance, `read_env(get_scheduler)` is a sender that asks the receiver for the currently suggested `scheduler` and passes it to the receiver's `set_value` completion-signal. @@ -3228,7 +3215,7 @@ onto it.
     execution::sender auto task =
-      execution::get_scheduler()
+      execution::read_env(get_scheduler)
         | execution::let_value([](auto sched) {
             return execution::starts_on(sched, some nested work here);
         });
@@ -3237,7 +3224,7 @@ onto it.
     
This code uses the fact that `sync_wait` associates a scheduler with the -receiver that it connects with `task`. `get_scheduler()` reads that scheduler +receiver that it connects with `task`. `read_env(get_scheduler)` reads that scheduler out of the receiver, and passes it to `let_value`'s receiver's `set_value` function, which in turn passes it to the lambda. That lambda returns a new sender that uses the scheduler to schedule some nested work onto `sync_wait`'s @@ -5325,7 +5312,7 @@ template<class Initializer> allow the specialization of the provided sender algorithms @@ -6001,10 +5988,6 @@ namespace std::execution { 3. `forwarding_query(get_allocator)` is a core constant expression and has value `true`. -4. `get_allocator()` (with no arguments) is expression-equivalent to - `execution::read(get_allocator)` ([exec.read]). - - ### `get_stop_token` [exec.get.stop.token] ### {#spec-execution.get_stop_token} @@ -6024,9 +6007,6 @@ namespace std::execution { 3. `forwarding_query(get_stop_token)` is a core constant expression and has value `true`. -4. `get_stop_token()` (with no arguments) is expression-equivalent to - `execution::read(get_stop_token)` ([exec.read]). - ### `execution::get_env` [exec.get.env] ### {#spec-execution.environment.get_env} 1. `execution::get_env` is a customization point object. For a subexpression @@ -6057,9 +6037,6 @@ namespace std::execution { 3. `forwarding_query(execution::get_domain)` is a core constant expression and has value `true`. -4. `get_domain()` (with no arguments) is expression-equivalent to - `execution::read(get_domain)` ([exec.read]). - ### `execution::get_scheduler` [exec.get.scheduler] ### {#spec-execution.get_scheduler} 1. `get_scheduler` asks a queryable object for its associated scheduler. @@ -6074,9 +6051,6 @@ namespace std::execution { 3. `forwarding_query(execution::get_scheduler)` is a core constant expression and has value `true`. -4. `get_scheduler()` (with no arguments) is expression-equivalent to - `execution::read(get_scheduler)` ([exec.read]). - ### `execution::get_delegation_scheduler` [exec.get.delegation.scheduler] ### {#spec-execution.get_delegation_scheduler} 1. `get_delegation_scheduler` asks a queryable object for a scheduler that can be @@ -6093,9 +6067,6 @@ namespace std::execution { 3. `forwarding_query(execution::get_delegation_scheduler)` is a core constant expression and has value `true`. -4. `get_delegation_scheduler()` (with no arguments) is expression-equivalent to - `execution::read(get_delegation_scheduler)` ([exec.read]). - ### `execution::get_forward_progress_guarantee` [exec.get.forward.progress.guarantee] ### {#spec-execution.get_forward_progress_guarantee}
@@ -7521,23 +7492,23 @@ namespace std::execution {
         }
         
-#### `execution::read` [exec.read] #### {#spec-execution.senders.read} +#### `execution::read_env` [exec.read.env] #### {#spec-execution.senders.read.env} -1. `read` is a sender factory for a sender whose asynchronous operation +1. `read_env` is a sender factory for a sender whose asynchronous operation completes synchronously in its start operation with a value completion result equal to a value read from the receiver's associated environment. -2. `read` is a customization point object. For some query object `q`, - the expression `read(q)` is expression-equivalent to - make-sender(read, q). +2. `read_env` is a customization point object. For some query object `q`, + the expression `read_env(q)` is expression-equivalent to + make-sender(read_env, q). 3. The exposition-only class template `impls-for` ([exec.snd.general]) - is specialized for `read` as follows: + is specialized for `read_env` as follows:
     namespace std::execution {
       template<>
-      struct impls-for<decayed-typeof<read>> : default-impls {
+      struct impls-for<decayed-typeof<read_env>> : default-impls {
         static constexpr auto start =
           [](auto query, auto& rcvr) noexcept -> void {
             TRY-SET-VALUE(rcvr, query(get_env(rcvr)));