3 ms·
I have to say, I don't consider "{} + {}".format!("foo", "bar") to be better than format!("{} + {}", "foo", "bar") Similarly with `result.try!()`, that
by eridius 7y ago
I have to say, I don't consider
"{} + {}".format!("foo", "bar")
to be better than
format!("{} + {}", "foo", "bar")
Similarly with `result.try!()`, that does not look as nice to me as `result?`.
And postfix-macro syntax for await! would lead to code like
let result = sendRequest().await!()?.getBody().await!()?.Root;
or if we used this for `try!()` as well then it would be
let result = sendRequest().await!().try!().getBody().await!().try!().Root;
which just looks very noisy to me.
- staticassertion 7y ago> to be better than I do, especially in terms of writing. It's quite annoying to 'wrap' things, in my opinion. This is why chaining is desired to begin with - people consistently prefer to append new code than to wrap. > Similarly with `result.try!()`, that does not look as nice to me as `result?`. I also prefer ?. 'try' is so common it's worth optimizing down to a single character. My point is to compare to the prefix try, not the question mark, as a motivator for where postfix macros are a reasonable concept. > let result = sendRequest().await!()?.getBody().await!()?.Root; It's an additional 3 character per 'await' vs the other syntax, which I think is fine - a small price to pay for a syntax that makes sense. If await were so common, I would once against think a sigil is the way to go, but I don't believe that await justifies that level of optimization at this point.