3 ms·
> I figure the reason the proposed syntax looks gross is because other languages have been using a prefixed await for many years. The Rust decision seems well
by slezyr 7y ago
> I figure the reason the proposed syntax looks gross is because other languages have been using a prefixed await for many years. The Rust decision seems well thought out though, enough to make me wonder if perhaps other languages have been doing it wrong.
Lua[1], C++/Boost[2] also use "yield" it's not that uncommon and there is nothing new.
[1] https://www.lua.org/pil/9.1.html https://www.lua.org/pil/9.1.html
[2] https://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/overview/core/spawn.html https://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/ov...
- int_19h 7y agoIt's not the question of keyword chosen, but rather where it should go. I wrote a lot of async/await code in C#, where it's a prefix operator, and I think what they did makes more sense. C# syntax works great when all you're doing is awaiting on a single call per line, but as soon as you start doing e.g. method chaining, you have to put parentheses everywhere, and it gets real messy real fast. This looks cleaner.