Open nrc opened 2 years ago
A tiny improvement w.r.t. footguns could be to:
if guard
mandatory for non-FusedFuture
s#[unfused]
annotation or an .unfused()
zero-cost adapter, or something along these lines.I wrote an in-depth analysis of select! {}
in my "Futures Concurrency III: Select" blog post. To summarize my conclusion: the select! {}
is difficult to use, would be hard to bring bring into the stdlib or language, and the same modes of concurrency can be exposed through alternative APIs. The AsyncIterator::merge
family of APIs seems like the most promising alternative, and I would recommend we shift our focus to exploring those further instead.
Both Tokio and futures-rs provide a
select
macro, they provide roughly the same functionality but have different implementations, APIs (in the mini-language supported), and constraints (notably, futures-rs requires futures to be fused).There seems to be a lot of demand for select (and it is runtime-agnostic), so it is a good candidate for inclusion in std, rather than it being supplied with a runtime. However, there seem to be a lot of questions:
race
andcomplete
macros, or other alternatives)?select
with cancellation. Looking at cancellation again is one of the goals of the ongoing async work (see, roadmap)Note that since it is a macro, select is likely to be insta-stable. Also note that if we don't require fusing in
select
, then there is probably no reason forFusedFuture
to exist at all.Previous discussion: