Re:The Rust module system is too confusing
by MoSal on Wednesday January 11, 2017 @06:41PM
(#13378537)
> in practice the closure syntax and logical or do not lead to confusion (imho, ymmv).
That's true. But put your self in the mind of a C developer looking at Rust code for the first time:
if a || b {
println!("True");
}
Cool.
Then:
thread::spawn(|| println!("Hello from a thread!"););
What? What is the logical or doing there?
----
IIRC, there are also cases where you have to write `& &`
instead of `&&` to not confuse the compiler. That's
a design/practical issue.
Both those issues would have been avoided if literal `and`/`or` were used.
I find it interesting how the only thing that momentarily confused me, as a C developer, about Rust syntax, was caused by Rust authors not wanting to syntactically deviate too much from C.
That's true. But put your self in the mind of a C developer looking at Rust code for the first time:
Cool.Then:
What? What is the logical or doing there?----
IIRC, there are also cases where you have to write `& &` instead of `&&` to not confuse the compiler. That's a design/practical issue.
Both those issues would have been avoided if literal `and`/`or` were used.
I find it interesting how the only thing that momentarily confused me, as a C developer, about Rust syntax, was caused by Rust authors not wanting to syntactically deviate too much from C.