3 ms·
I disagree, magic is magic. If there's sometime done by the compiler that is impossible to do yourself in the language-- that's magic. Everything async/await is
by leshow 7y ago
I disagree, magic is magic. If there's sometime done by the compiler that is impossible to do yourself in the language-- that's magic. Everything async/await is doing you could do by yourself. There's no magic in the Future trait, or any part of Rust's async solution.
You can't call it magic just because you haven't read what it desugars into. Otherwise anything you don't know could be called "magic".
- Jweb_Guru 7y agoWell, there's nothing you couldn't write yourself, sure... but async/await does generate unsafe code in some cases, so it is at least somewhat magical that you can do it in safe code. Since async/await has unsafe code that is really fiddly to get right otherwise (c.f. the rules for `Pin`), I think this is a pretty good tradeoff and a great use of magic.