News for hackers. Stuff that matters.
Re:Fast Rust Builds by zozbot234 on Sunday September 05, 2021 @08:55PM (#28429225)
? is not "syntactic noise". Having an indication in the code of which operations might throw is very useful, and it enables a further simplification of using ordinary variant records as opposed to a special-cased "checked exception" construct.
Re:Fast Rust Builds by catern on Sunday September 05, 2021 @09:22PM (#28429340)
Compare it to unsafe functions. An unsafe function can be called in an unsafe block or an unsafe function. Rust could require annotating each call to an unsafe function, even inside unsafe functions. Why don't we do that? That seems like it's also very useful for the exact same reasons.

A proper language needs to allow the programmer to choose between implicit effects and explicit effects on a case-by-case basis. The reason ? is so tragic is because Rust tried to go with explicit effects only, but found that people wanted implicit effects, and ? is the closest that Rust can get. That's why it's syntactic noise: The programmer wants to get rid of it, they don't regard it as informative for this case, but they can't get rid of it.

(And checked exceptions can be perfectly well implemented with regular data, you don't need any special cases - in fact, you can do it with the same infrastructure that's already been added in a special-cased form for async/await support...)

Re:Fast Rust Builds by GolDDranks on Sunday September 05, 2021 @11:06PM (#28429838)
Didn't downvote you because I presume you are arguing in good faith, but I have very different opinion about the ? operator, it is one of the best syntactic things in Rust. In my experience, many Rustaceans agree. It's a minimal nuisance, while still being explicit in a good way.

Also, being able to call unsafe code inside unsafe functions is now considered a design mistake, and there is ongoing work to revert the default – requiring unsafe blocks even in unsafe functions: https://rust-lang.github.io/rfcs/2585-unsafe-block-in-unsafe...

Re:Fast Rust Builds by drran on Monday September 06, 2021 @06:33AM (#28432323)
But `foo()?"A context message for a human".bar();` is even better. Currently, we must use anyhow's `foo().context("Message")?.bar()` [1] for that.

[1]: https://docs.rs/anyhow/1.0.42/anyhow/trait.Context.html

Re:Fast Rust Builds by p4lindromica on Sunday September 05, 2021 @11:09PM (#28429854)
The compiler does have a lint to force being explicit about unsafe in the way you describe. It is an allow by default lint called `unsafe_op_in_unsafe_fn`.