4 ms·
Well, tabs versus spaces is not a Python thing, that will bite you in any language eventually. Blame the VT-100 terminal. Here is the thing about indentation
by dbcurtis 8y ago
Well, tabs versus spaces is not a Python thing, that will bite you in any language eventually. Blame the VT-100 terminal.
Here is the thing about indentation versus curly-braces-and-semi-colons: It boggles me that people find it acceptable to use one mechanism to communicate block structure to the compiler, and a completely different mechanism to communicate block structure to humans, and have no way to automatically check that they have the same semantics. This is a frequent source of bugs, and is entirely preventable. When it comes to the ergonomics of computer-convenient versus human-convenient, humans should win. Therefore, significant white space is clearly preferable simply from the standpoint of eliminating the source of an entire class of bugs.
But the main thing that makes Rust harder to read is all the punctuation noise and short, cryptic keywords. While one friend once said: "A good programmer can write FORTRAN in any language.", I don't feel compelled to help them.
Readability matters.
- jononor 8y agoGCC will now warn about (some cases of) misleading indentation, which is a step forward. And clang format can autoformat based on the brackets, I believe. I still prefer whitespace to indicate blocks though.
- Tuna-Fish 8y ago> It boggles me that people find it acceptable to use one mechanism to communicate block structure to the compiler, and a completely different mechanism to communicate block structure to humans, and have no way to automatically check that they have the same semantics. This is a frequent source of bugs, and is entirely preventable. Strongly agree. The solution that Rust, Go and other new languages have adopted is shipping a formatting tool to consistently make the semantics of indentation and braces match. I personally can't help but think that this is a worse-is-better solution when compared to significant whitespace, but at least it works. Every Rust CI I am setting up will fail the build if `rustfmt --write-mode=diff` feels like you didn't run rustfmt before committing. > But the main thing that makes Rust harder to read is all the punctuation noise Given the decision to favor explicit casts, references and dereferences over implicit ones, this cannot really be helped. In some ways, once you get used to it, it helps readability, because it always communicates what the things being worked on are. > and short, cryptic keywords. I agree that this was probably a mistake. Cannot really be helped now, though. Overall, I think the readability argument against Rust is overstated. Sure, when you are starting out it looks like line noise, especially if compared to python. But it didn't take me more than a week or two before it basically became entirely clear and readable. The radical explicitness of the language helps readability in many ways that make it much better than C++. Of course, much better than C++ is a low bar to pass.
- village-idiot 8y agoI think Go shipping a single canonical formatting tool was an inspired decision that eliminates a massive point of contention in software teams. I expect the majority of new languages to ship a canonical format tool in the future.