Are value-consuming generators useful?
- Lingua principale
- C++
- Stelle
- 347
- Fork
- 47
- Merge medio
- 3g 8h
- PR unite (30g)
- 1
Descrizione
The two-argument variant of `async::generator`, one that is able to consume values from the resumer, seems to have no practical use case. At least none has been provided in the docs or examples. I personally question its utility because of the shape of the interface. The coroutine sees it this way:
```
auto value_from_resumer = co_yield value_from_coroutine;
```
Where a natural reading is that `value_from_resumer` is *in response to* the yielded `value_from_coroutine`. But the resumer sees it this way:
```
auto next_value_from_coroutine = co_await some_genertor(value_from_resumer);
```
Here the resumer has to prepare and inject the value before it asks the coroutine to generate its next value. This is in contradiction to the previous expectation.
I presented my intuition. It may be wrong. But the documentation does not offer any other. I believe that the value consuming interface of `async::generator` should be either removed, or justified in the docs.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.