You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
template <typename T, typename U> // is T a void?
promise<void> f(promise<T> pt, promise<U> pu)
{
auto r = co_awaitselect(pt, pu);
r; // which interface should I use?// variant or naked size_t?
}
Same goes for vector:
template <typename T> // is T a void?
promise<void> f(vector<<promise<T>> pv)
{
auto r = co_awaitselect(pv);
r; // which interface should I use?// pair or naked size_t?
}
Different interface calls for a different name. If promise<void> is orders of magnitude more frequent than promise<anything_else> 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.
The text was updated successfully, but these errors were encountered:
akrzemi1
changed the title
The interface of select
The interface of race (select)
Nov 9, 2023
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.Same goes for vector:
Different interface calls for a different name. If
promise<void>
is orders of magnitude more frequent thanpromise<anything_else>
then offer nameselcetv
for funcitons returningvariant
/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 thanstd::variant
? I would expect a rationale in the docs.The text was updated successfully, but these errors were encountered: