[Discussion] Alternative syntax for async iteration: `for async i in stream`?
soplwang:
Just as
async fndescribes a function that yields a future,for asyncdescribes a loop that consumes an asynchronous producer.
I hope you see the contraddiction here: the former yields while the other consumes (just like .await)
soplwang:
my proposal focuses on async pattern matching/binding at the item level
The issue here is that streams are not Iterator<Item = impl Future> where you can just await each item. You have to instead await getting the item itself. For this reason they cannot be fit into the existing for machinery, and adding a new kind of binding won't change this.
soplwang:
Thanks for the insightful feedback! You’ve hit on the core semantic tension here.
Can we please avoid generating posts/answers using LLMs? Or if you really want to do so at least remove the blatant parts.
Discussion in the ATmosphere