Open matthewhammer opened 3 years ago
Yes, that's what you get when mixing prefix and postfix elimination syntax -- a problem well-known back from C.
We'd need to use some postfix alternative to await to fix this, but prefix await
is widely used standard practice. The only alternative I've seen is Rust's .await
, which is odd. Does anybody have a better idea?
In practice, I'd probably avoid inlining await
too much and rather let-bind its result to increase visibility of the interleaving point.
Actually, I don't think the parens around the arg to await are necessary.
buf.add((await (getVideoResult(vid)))!)
Try:
buf.add((await getVideoResult(vid))!)
Ah, okay.
The alternation of prefixed await
and postfixed !
remains, but it's perhaps not so bad, since that's also the order of the operations.
I'd probably avoid inlining await too much and rather let-bind its result to increase visibility of the interleaving point.
Add to a conventions spec somewhere? (For library authors?)
Are all of these parens really needed, or am I missing something? https://github.com/dfinity/cancan/blob/8c9034ccd0c799664e4aa5ce061f488a0430b3f0/service/CanCan.mo#L97