Hacker News new | ask | show | jobs
by robert_tweed 4376 days ago
That is what's known as a straw man argument. Nobody said verbosity always improves readability, just that it's easy to get too terse, just as Java demonstrates it's possible to get too verbose.

I'm pretty comfortable writing complex regular expressions, but I don't know many other developers that are and I certainly don't like trying to grok anything longer than about 10-15 characters that I didn't write in the preceding 15 minutes. This is a perfect example of where terseness is fine for simple problems, but it does not scale.

I already mentioned Go because it has a pretty terse syntax, but one that is very carefully optimised for readability. One of the things the designers of Go are careful about is not adding too many operators, keywords, or usage rules to the language, which keeps everything nice and simple.

Rust OTOH seems to have a metric boatload of operators that work in different ways depending on the specific context. That's a recipe for a ton of cognitive load, which isn't helpful for writing code, but reading suffers even more.

I don't yet know enough about Rust to say whether this is as bad as operator overloading in C++. As I said, I will reserve judgement until 1.0 because it's entirely possible things will change drastically before then.

2 comments

> Rust OTOH seems to have a metric boatload of operators that work in different ways depending on the specific context.

What operators does Rust have that Go does not? I believe Rust has no more operators than Go.

This is just my impression based on those tutorials I've looked at so far; I've decided to put off learning it properly until 1.0, whereas I know Go pretty well. IIRC, the move semantics and lifetime annotations were one area that stuck out as pretty heavy on context-specific operators.
If anything Rust has been busy removing operators. As far as I can recall, move semantics have no operators at all (someone who remembers better can probably correct me on this), and lifetime annotations are just 'lifetime (I suppose you could consider ' an operator?). Rust is also LL(1), so it was a very explicit design decision to have as few context-specific operators as possible (indeed, a few suggestions for possibly more intuitive syntax have been decided against for this reason). So what you're saying really hasn't been my experience with Rust at all. In fact, the only really hard thing about Rust, from my perspective, is the semantics, not the syntax :)
Exactly why I'm reserving judgement for now.
Move semantics don't have operators; they happen automatically invisible. Lifetime annotations are not part of operators; they're part of types. The only operator is the same as in Go, &.
> That is what's known as a straw man argument. Nobody said verbosity always improves readability,

You're right.