This is probably subjective, but the last example looks like a script to me, maybe a bit like Perl (which I don’t know much of, but to me represents a symbolful language).
Understanding the last example seems easier once you know what ?
and #
(maybe even knowing only one of them is enough to guess the other). But on the other hand, not knowing both seems to be the worst case here. Clearly ?
is not the ternary operator and #
is not a comment marker, but whatever they do affecting the control flow would be the most surprising to me. I think this is what the “weirdness budget” is.
On a prefix with no sugar syntax it could look like this:
async fn example(db: DB, hash: Sha256Hash) -> Result<String, Error> {
let response = (await get("rust-lang.org"))?;
let original_body = (await response.body)?
let body = await add_footer(original_body);
let db_operation = db.store_body_if_hash_eq(&body, hash)?;
(await db_operation)?;
body
}
Which is not worse IMO.