The interface of `race` (`select`)
- Dominant language
- C++
- Stars
- 347
- Forks
- 47
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
The interface of `select` is not clearly documented, so it is difficult to figure out all the available signatures and return types. But judging from the rose in the documentation it is non-uniform.
The non-uniform interface of `select()` (spacial-case for all-void) is problematic and may cause unnecessary difficulties and surprises in generic contexts.
```c++
template // is T a void?
promise f(promise pt, promise pu)
{
auto r = co_await select(pt, pu);
r; // which interface should I use?
// variant or naked size_t?
}
```
Same goes for vector:
```c++
template // is T a void?
promise f(vector<> pv)
{
auto r = co_await select(pv);
r; // which interface should I use?
// pair or naked size_t?
}
```
Different interface calls for a different name. If `promise` is orders of magnitude more frequent than `promise` then offer name `selcetv` for funcitons returning `variant`/`pair`. also, having two different functions would make it easier to document them.
Second issue. Because the documentation is too scarce, I cannot figure out what is returned by the `select` that is given a zero-sized vector of promises.
Third. Why do you use `boost::variant2` rather than `std::variant`? I would expect a rationale in the docs.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.