4 ms·
In my experience, Rust code is relatively easy to read, even by developers with no Rust experience. Of course, you can write hard to read code. But that's not
by cjg 5y ago
In my experience, Rust code is relatively easy to read, even by developers with no Rust experience.
Of course, you can write hard to read code. But that's not typically what comes out of a process of writing production software.
That's not to say that someone with no experience will fully understand the ownership transfer & borrowing that's happening, but that's just stuff you need to do for the compiler. Reading code that already compiles, you can mostly ignore that and focus on the program logic.
- cogman10 5y agoYeah, readability is high, it's writing that can be a bit harder IMO. Especially for someone unfamiliar with rust, it can be hard to really know why someone is using self, &self, or &mut self. Yet the code reads the same. That's the funny thing about rust.
- zozbot234 5y agoThe compiler is supposed to tell you when you get it wrong. This does leave design issues on the table, but it's also good for those to be addressed explicitly, by the more senior people on the project.
- Thaxll 5y agoRust is one the hardest language to read. Take two people that never used Go or Rust and make them read code, good luck with Rust.
- timeon 5y agoSo I have opened golang.org: v1, ok1 := <-c1 Not sure what is difference between := and = and what is that arrow. But if I'm going to do something with the language - I guess it will be easy to find out. Like with Rust.
- rob74 5y agoSure - except that in Go there are (my impression after taking a look at various Rust resources) far fewer things you have to find out this way than in Rust. Which, of course, some view as a limitation, others view as a plus for Go.
- davidkunz 5y agoIt depends on what you're trying to read. If you want to understand every technical detail (e.g. who owns this variable) then Rust is great. If you want to understand the business logic behind it (e.g. under what circumstances is a customer allowed to return that product) then Rust is not so great as you would have to mentally filter out all the technical noise.
- dpifke 5y agoI'm a newcomer to Rust, and find it relatively easy to read, at least at the level of "what is this code doing?" (Not necessarily "why did they need to specify lifetime there?") The major exception to this are cases where authors use macros to invent their own DSL inside Rust code. This sort of thing seems common in the Servo codebase, amomg others. It reminds me of C macros or Python metaprogramming magic, both of which directly led to some incredibly difficult past debugging experiences.