Async-std: Can not use async block or async fn in `async_std::future::select!`.

Created on 24 Oct 2019  路  5Comments  路  Source: async-rs/async-std

I would expect this to work:

async fn foo() {
}

async_std::future::select!(foo(), async { });
questiofeedback

Most helpful comment

@paulocsanz Yes, but this is also heavily experimental and as such a compatibility hazard. It's fine, I believe the future can be found there, but let's talk once that became accepted practice.

All 5 comments

I see your point. The select macro is sadly limited by virtue of being a plain macro, let's see if we can fix this somehow.

I'd like to avoid using proc_macro_hack like futures does for this.

The same is true for join macros.
I thought the same thing, so I am very interested in how this is solved.

What we've been talking about for a while now is to change the select! macros into regular methods. Unlike join! they don't have polymorphic output, which means it's mostly about maintaining parity with join. And to me that's started to become less appealing as an argument recently.

Proc-macros compiled to web-assembly can help with this too without significant costs.

https://github.com/dtolnay/watt

@paulocsanz Yes, but this is also heavily experimental and as such a compatibility hazard. It's fine, I believe the future can be found there, but let's talk once that became accepted practice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cole-acepph picture cole-acepph  路  5Comments

Darksonn picture Darksonn  路  7Comments

matthewrobertbell picture matthewrobertbell  路  7Comments

Licenser picture Licenser  路  8Comments

yoshuawuyts picture yoshuawuyts  路  6Comments