Yes - Rust can be complicated. However it doesn't have to be. There's nobody forcing you to use Pin. Even async code doesn't do, if you just stick to using library functions, don't write any Future implementation manually and just stick to async-trait. There's even nobody forcing you to use async code. In fact it might be the wrong choice for > 99% of use-cases, since it adds complexity and limits on which functions…
Yes - C++ can be complicated. However it doesn't have to be. There's nobody forcing you to use templates......
Tell HN: Rust Is Complex
51–60 of 102 posts
Re: Tell HN: Rust Is Complex
#52Re: Tell HN: Rust Is Complex
#53Re: Tell HN: Rust Is Complex
#54The problem with go is not it's simplicity, it's it's inconsistency . As a small-minded programmer my hobgoblin is tripping over having to remember that X works this way but not Y, which looks vaguely like x. It feels like the designers of go tripped over themselves to make things simple for some definition of simple and then ran into some feature they wanted and then just bolted the feature on without thinking about…
Do you have more examples? I’ll admit that Go is full of weird quirks, but nothing feels bolted on. Generics were agonized over for so long because they had to fit it within the existing language
#![allow(unused)]
pub fn main() {
let mut x = vec![1, 2, 3];
let y = &mut x;
let z: &mut _ = y;
println!("{:?}", y)
}
This does not: #![allow(unused)]
pub fn main() {
let mut x = vec![1, 2, 3];
let y = &mut x;
let z = y;
println!("{:?}", y)
}Re: Tell HN: Rust Is Complex
#55I think I understand that await causes the half of function to be rewritten into a state machine that returns immediately to caller and the promise object implements the rest of the control flow.
I don't understand waiters, pollers.
Re: Tell HN: Rust Is Complex
#56Earlier quoted context omitted.
Do you have more examples? I’ll admit that Go is full of weird quirks, but nothing feels bolted on. Generics were agonized over for so long because they had to fit it within the existing language
Rust is full of weird quirks that defenders explain by saying that "the compiler isn't smart enough yet." They often seem like consequences of a "compiler-defined" implementation. One random example -- this compiles and runs: #![allow(unused)] pub fn main() { let mut x = vec![1, 2, 3]; let y = &mut x; let z: &mut _ = y; println!("{:?}", y) } This does not: #![allow(unused)] pub fn main() { let mut x = vec![1, 2, 3];…
That being said, I was quite surprised this doesn't compile... (I understand why, but I expected the compiler to have all required information to perform reborrowing).
Re: Tell HN: Rust Is Complex
#57Question: How much of Rust’s type system complexity is due to async? It seems Pin is mostly related to async and the official examples for GAT are for async. Given the complexities of async and how other alternatives such a Java Loom’s virtual threads, in about 10 years I am not sure that we won’t see Rust going all in on async as a mistake.
Since we’re comparing Go and Rust, I think Go really nailed it with goroutines and channels. It’s much easier to get your head around than async.
Re: Tell HN: Rust Is Complex
#58Re: Tell HN: Rust Is Complex
#59Earlier quoted context omitted.
It's a RWLock. Not a mutex. As long as no one is writing to it, readers are not blocked.
I know, but the RWLock itself also did not work. Complaining about safety and the only solution seemed to wrap the value itself into mutex inside rwlock. If I still had to go back to this, I would just write the function in C and go from there. Rust is productive when you can work with the highest level of abstraction and when it can copy values freely. When you want to work with copy-free or shared memory, is when r…
In my case, after fighting for literally days, the crate OnceCell did the job (kind of), but I felt awkward retorting to an external crate to deal with a simple static-global-initialize-once-never-touch-again piece of data.
Re: Tell HN: Rust Is Complex
#60I get the sentiment, but one thing that probably needs to be underlined here is that one only needs to face that complexity if you really want to, however. Otherwise you can just wrap everything in Arc, Cow and similar helpers and call it a day. Even lazy Rust code can still be incredibly performant, testable and fault tolerant. The lower level you go, the more you need to know about Rust and how what it does maps to…
… which is how we got slow, bloated legacy C++ codebases today, should we make the same mistake with Rust? If you are wrapping everything in ref-counted smart pointers it might probably be better to just use a garbage-collected language like Java or C# instead…