4 ms·
I'm curious as to why the mandatory prefix syntax wasn't chosen (`await {...}`). It's less magic than a magic field and it fits into preexisting syntax better.
by lachlan-sneff 7y ago
I'm curious as to why the mandatory prefix syntax wasn't chosen (`await {...}`). It's less magic than a magic field and it fits into preexisting syntax better.
- frenchy 7y agoI think it has to do with "ergonomics", and the existance and interaction with the "?" keywords played a big part of that.
- bvinc 7y agoI'm not sure why it wasn't chosen, but I can give you some arguments against it. The braces introduce line noise. They introduce a new scope. I believe that rustfmt will currently put a newline after the opening brace. And it has the general problem that it can't be read from left to right. (P.s. I'm not trying to start a debate, just trying to answer the question.)
- int_19h 7y agoTry writing a chain of async member accesses and calls with . and ? like that.