3 ms·
None of the above. It's compiler magic. It's a keyword that says 'await on this awaitable object' (currently only a Future can be await-ed). You can read the O
by eximius 7y ago
None of the above. It's compiler magic. It's a keyword that says 'await on this awaitable object' (currently only a Future can be await-ed).
You can read the OP which contains links to more blog posts on the reasoning. I think this is a bad decision precisely because of the questions you're asking. At least making it a 'magic method' (i.e., Future::await(...) or future.await()) with no implementation would have been better in basically every way. A 'dot' operator already exists and this just makes it confusing.
- asark 7y agoI've been planning to try out Rust for a side project, and this decision is so principle-of-most-surprise that it's got me reconsidering, wondering what other unpleasant weirdness lurks in the language. Looking down their other options in one of the linked articles, they seem to reject a couple fine ones outright and then went with one I'd have rejected outright as being too hostile to anyone who's not quite familiar with the manual, having memorized exceptions to ordinary behavior like this. I'm struggling to understand why anyone liked this one at all, let alone enough to push it to the top of the pile.
- oconnor663 7y ago> struggling to understand why anyone liked this one at all The reason this process took so long, is that most people feel exactly like you do, except that they don't agree about which proposal they hate.
- staticassertion 7y agoYeah, this is really one of the only big warts, and hopefully not a trend. But the rest of the language is really good so don't let this scare you off. Most of rust feels very well thought out and reasonable.
- asark 7y agoOK, if the exceptions are quite exceptional and hoping, as you note, this doesn't represent a trend, I'll keep it in consideration. Thanks for the insight.
- eximius 7y agoTo reinforce what others are saying, this is the only Rust decision that gives me even a moments pause. Everything else is pretty pleasant. Honestly, I hope that this backfires and gets fixed in a future Rust Edition. It's a very silly thing.