Skip to content

Commit 1a591df

Browse files
authored
Merge pull request #253 from cplusplus/read_env
rename `read` to `read_env`
2 parents 7e50fb9 + 4d3e68c commit 1a591df

File tree

1 file changed

+14
-43
lines changed

1 file changed

+14
-43
lines changed

Diff for: execution.bs

+14-43
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ struct dynamic_buffer { //
388388
sender_of<dynamic_buffer> auto async_read_array(auto handle) { // 2
389389
return just(dynamic_buffer{}) // 4
390390
| let_value([handle] (dynamic_buffer& buf) { // 5
391-
return just(std::as_writeable_bytes(std::span(&buf.size, 1)) // 6
391+
return just(std::as_writeable_bytes(std::span(&buf.size, 1))) // 6
392392
| async_read(handle) // 7
393393
| then( // 8
394394
[&buf] (std::size_t bytes_read) { // 9
@@ -3196,29 +3196,16 @@ execution::sender auto just_stopped();
31963196
Returns a sender with no [=completion scheduler|completion schedulers=], which
31973197
completes immediately by calling the receiver's `set_stopped`.
31983198

3199-
### `execution::read` ### {#design-sender-factory-read}
3199+
### `execution::read_env` ### {#design-sender-factory-read}
32003200

32013201
<pre highlight="c++">
3202-
execution::sender auto read(auto tag);
3203-
3204-
execution::sender auto get_scheduler() {
3205-
return read(execution::get_scheduler);
3206-
}
3207-
execution::sender auto get_delegation_scheduler() {
3208-
return read(execution::get_delegation_scheduler);
3209-
}
3210-
execution::sender auto get_allocator() {
3211-
return read(execution::get_allocator);
3212-
}
3213-
execution::sender auto get_stop_token() {
3214-
return read(execution::get_stop_token);
3215-
}
3202+
execution::sender auto read_env(auto tag);
32163203
</pre>
32173204

32183205
Returns a sender that reaches into a receiver's environment and pulls out the
32193206
current value associated with the customization point denoted by `Tag`. It then
32203207
sends the value read back to the receiver through the value channel. For
3221-
instance, `get_scheduler()` (with no arguments) is a sender that asks the
3208+
instance, `read_env(get_scheduler)` is a sender that asks the
32223209
receiver for the currently suggested `scheduler` and passes it to the receiver's
32233210
`set_value` completion-signal.
32243211

@@ -3228,7 +3215,7 @@ onto it.
32283215

32293216
<pre highlight="c++">
32303217
execution::sender auto task =
3231-
execution::get_scheduler()
3218+
execution::read_env(get_scheduler)
32323219
| execution::let_value([](auto sched) {
32333220
return execution::starts_on(sched, <i>some nested work here</i>);
32343221
});
@@ -3237,7 +3224,7 @@ onto it.
32373224
</pre>
32383225

32393226
This code uses the fact that `sync_wait` associates a scheduler with the
3240-
receiver that it connects with `task`. `get_scheduler()` reads that scheduler
3227+
receiver that it connects with `task`. `read_env(get_scheduler)` reads that scheduler
32413228
out of the receiver, and passes it to `let_value`'s receiver's `set_value`
32423229
function, which in turn passes it to the lambda. That lambda returns a new
32433230
sender that uses the scheduler to schedule some nested work onto `sync_wait`'s
@@ -5325,7 +5312,7 @@ template&lt;class Initializer>
53255312
<td>allow the specialization of the provided sender algorithms</td>
53265313
<td>
53275314
<ul>
5328-
<li>sender factories (e.g., `schedule`, `just`, `read`)</li>
5315+
<li>sender factories (e.g., `schedule`, `just`, `read_env`)</li>
53295316
<li>sender adaptors (e.g., `continues_on`, `then`, `let_value`)</li>
53305317
<li>sender consumers (e.g., `start_detached`, `sync_wait`)</li>
53315318
</ul>
@@ -6001,10 +5988,6 @@ namespace std::execution {
60015988
3. `forwarding_query(get_allocator)` is a core constant expression and has value
60025989
`true`.
60035990

6004-
4. `get_allocator()` (with no arguments) is expression-equivalent to
6005-
`execution::read(get_allocator)` ([exec.read]).
6006-
6007-
60085991

60095992
### `get_stop_token` <b>[exec.get.stop.token]</b> ### {#spec-execution.get_stop_token}
60105993

@@ -6024,9 +6007,6 @@ namespace std::execution {
60246007
3. `forwarding_query(get_stop_token)` is a core constant
60256008
expression and has value `true`.
60266009

6027-
4. `get_stop_token()` (with no arguments) is expression-equivalent to
6028-
`execution::read(get_stop_token)` ([exec.read]).
6029-
60306010
### `execution::get_env` <b>[exec.get.env]</b> ### {#spec-execution.environment.get_env}
60316011

60326012
1. `execution::get_env` is a customization point object. For a subexpression
@@ -6057,9 +6037,6 @@ namespace std::execution {
60576037
3. `forwarding_query(execution::get_domain)` is a core constant
60586038
expression and has value `true`.
60596039

6060-
4. `get_domain()` (with no arguments) is expression-equivalent to
6061-
`execution::read(get_domain)` ([exec.read]).
6062-
60636040
### `execution::get_scheduler` <b>[exec.get.scheduler]</b> ### {#spec-execution.get_scheduler}
60646041

60656042
1. `get_scheduler` asks a queryable object for its associated scheduler.
@@ -6074,9 +6051,6 @@ namespace std::execution {
60746051
3. `forwarding_query(execution::get_scheduler)` is a core constant
60756052
expression and has value `true`.
60766053

6077-
4. `get_scheduler()` (with no arguments) is expression-equivalent to
6078-
`execution::read(get_scheduler)` ([exec.read]).
6079-
60806054
### `execution::get_delegation_scheduler` <b>[exec.get.delegation.scheduler]</b> ### {#spec-execution.get_delegation_scheduler}
60816055

60826056
1. `get_delegation_scheduler` asks a queryable object for a scheduler that can be
@@ -6093,9 +6067,6 @@ namespace std::execution {
60936067
3. `forwarding_query(execution::get_delegation_scheduler)` is a core
60946068
constant expression and has value `true`.
60956069

6096-
4. `get_delegation_scheduler()` (with no arguments) is expression-equivalent to
6097-
`execution::read(get_delegation_scheduler)` ([exec.read]).
6098-
60996070
### `execution::get_forward_progress_guarantee` <b>[exec.get.forward.progress.guarantee]</b> ### {#spec-execution.get_forward_progress_guarantee}
61006071

61016072
<pre highlight="c++">
@@ -7521,23 +7492,23 @@ namespace std::execution {
75217492
}
75227493
</pre>
75237494

7524-
#### `execution::read` <b>[exec.read]</b> #### {#spec-execution.senders.read}
7495+
#### `execution::read_env` <b>[exec.read.env]</b> #### {#spec-execution.senders.read.env}
75257496

7526-
1. `read` is a sender factory for a sender whose asynchronous operation
7497+
1. `read_env` is a sender factory for a sender whose asynchronous operation
75277498
completes synchronously in its start operation with a value completion
75287499
result equal to a value read from the receiver's associated environment.
75297500

7530-
2. `read` is a customization point object. For some query object `q`,
7531-
the expression `read(q)` is expression-equivalent to
7532-
<code><i>make-sender</i>(read, q)</code>.
7501+
2. `read_env` is a customization point object. For some query object `q`,
7502+
the expression `read_env(q)` is expression-equivalent to
7503+
<code><i>make-sender</i>(read_env, q)</code>.
75337504

75347505
3. The exposition-only class template <i>`impls-for`</i> ([exec.snd.general])
7535-
is specialized for `read` as follows:
7506+
is specialized for `read_env` as follows:
75367507

75377508
<pre highlight="c++">
75387509
namespace std::execution {
75397510
template&lt;>
7540-
struct <i>impls-for</i>&lt;<i>decayed-typeof</i>&lt;read>> : <i>default-impls</i> {
7511+
struct <i>impls-for</i>&lt;<i>decayed-typeof</i>&lt;read_env>> : <i>default-impls</i> {
75417512
static constexpr auto <em>start</em> =
75427513
[](auto query, auto& rcvr) noexcept -> void {
75437514
<i>TRY-SET-VALUE</i>(rcvr, query(get_env(rcvr)));

0 commit comments

Comments
 (0)