4 ms·
If something is to replace C (or C++), I hope it's not Rust, because Rust is even more complicated than C++. People should not have to bend their mind to satis
by blub 9y ago
If something is to replace C (or C++), I hope it's not Rust, because Rust is even more complicated than C++.
People should not have to bend their mind to satisfy some tool like the borrow checker, the tool should do the right thing and allow them to express their ideas in code with as little effort as possible.
- pygy_ 9y agoThe borrow checker is currently stricter than it should be (it rejects valid programs), which requires workarounds. Once non-lexical lifetimes land, the borrow checker will be less of an issue.
- steveklabnik 9y agoThis is true of most sound static analysis; the goal is to reject as few programs as possible, but there's always some things that exist in the world that your system can't take into account.
- icen 9y agoFor good reason! This is Rice's theorem.
- aneutron 9y agoIf it serves the purpose, it is worth the price of changing the way one thinks. You do realise than functional, imperative and procedural programming all coexist in this world. But using functional programming with trees for example makes your job way easier. Except you'll have to change your perspective on programming. It's the same thing with memory safety. If Rust is going to give you a guarantee about the memory safety, then changing your mindset is probably worth. I still consider myself a beginner/novice though, so this is just my opinion.
- kibwen 9y ago> Rust is even more complicated than C++ Example? In my experience, those saying this have either never used Rust, or never used C++. A strict compiler does not a complicated language make. To wit, if the response is "lifetimes", note that lifetime tracking is also critically important in C++ (not to mention C), it's just that C++ compilers give one far less help in doing so than Rust does.
- blub 9y agoTake for instance http://cglab.ca/~abeinges/blah/too-many-lists/book/README.html http://cglab.ca/~abeinges/blah/too-many-lists/book/README.ht.... I could feel the frustration when reading those compiler errors. I mean it's a list, one of the simplest data structures to implement, I was doing that stuff in high-school. But it's not just about a particular example, instead I get a general feeling of inaccessibility when reading Rust code. It's not enough to know C or C++, one has to understand the Rust way. This might seem unfair to complain about, but I didn't have any such issues when learning e.g. Swift or Objective-C, to give an example of non-GC languages.
- steveklabnik 9y agoSide note, we have completely re-done the format of compiler errors since that was published. To take a random example from 2.1: src/first.rs:1:1: 4:2 error: illegal recursive enum type; wrap the inner value in a box to make it representable [E0072] src/first.rs:1 pub enum List { src/first.rs:2 Empty, src/first.rs:3 Elem(T, List), src/first.rs:4 } error: aborting due to previous error is now error[E0072]: recursive type `List` has infinite size --> src/main.rs:1:1 | 1 | pub enum List { | ^^^^^^^^^^^^^ recursive type has infinite size 2 | Empty, 3 | Elem(i32, List), | ----- recursive without indirection | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `List` representable Users have reported a lot less frustration after these changes, and we're always trying to make them better. For more on this effort https://blog.rust-lang.org/2016/08/10/Shape-of-errors-to-come.html https://blog.rust-lang.org/2016/08/10/Shape-of-errors-to-com...
- marcosdumay 9y agoI'd like to thank you a lot for those error messages. As somebody learning the language, they are incredibly helpful.
- steveklabnik 9y agoI will tell that to the people who actually did said work, I'm sure they will appreciate it :D
- steveklabnik 9y agoWe spent years iterating on Rust's design; I hope somebody comes along and makes a language that is even easier than Rust is while satisfying its requirements. That's currently an open question though, and we need to write programs today.
- glandium 9y ago> Rust is even more complicated than C++ You haven't seen template metaprogramming, have you?
- pjmlp 9y agoRust also has ways of doing the same kind of meta-programming, with macros, compiler plugins and a few nightly features.
- bjz_ 9y ago> I hope it's not Rust, because Rust is even more complicated than C++. Erm, have you ever used Rust, and had much experience with C++? Rust's semantics are far clearer, simpler, and well defined than C++'s, and there are orders of magnitude less rules of thumb that you need to learn in order to avoid. If it looks complex, it's because it needs to be in order to adequately express the essential complexity of systems programming. Hopefully we will have languages that do a better and more elegant job in the future, but at the moment Rust is the best we have.