5 ms·
Not many people just come out and say it, but I think Rust is an ugly programming language. That's a good enough reason for me.
by andrewmcwatters 6y ago
Not many people just come out and say it, but I think Rust is an ugly programming language. That's a good enough reason for me.
- cuddlecake 6y agoCould you try to explain why you think rust is an ugly programming language?
- pornel 6y ago• Rust is focused on being explicit rather than pretty/elegant. So there's sigilisitic code like `&/&mut`, `move||`, `Arc<T>` for details that are implied in higher-level languages. • Rust wants to have easy-to-parse unambiguous syntax. This makes turbofish required when you have a type in expression context. You need `->` for the return type. • Rust uses generics, and angle brackets are ugly. It also mandates `{}` in blocks, but allows skipping `()`, which gives you a high ratio of ugly brackets to the nice round ones :) • Rust wants to make up for the cost of explicitness by adding abbreviations. So you have `fn` that's both explicit and terse. Instead of verbose `switch/case/default`, Rust's `match` uses patterns and `_ =>`. Rust designers pay a lot of attention to the syntax, but it's designed from a very practical point of view (it is clear? unambiguous? easy to write? composes with other syntax?), and "does it look neat?" is very low on the priority list.
- feoren 6y agoYou sound like the kind of guy who prefers CoffeeScript over JavaScript; YAML over JSON. Every single programming language has punctuation -- the "punctuation-free" languages have all just decided that their punctuation should be invisible.
- cxr 6y agoI took a lot of heat for that in a recent thread. There's really no convincing Rust's most vocal fans what a mistake it was to focus on fixing so few of C++'s problems when they had the opportunity to fix the its-grammar-is-dogshit problem (and slow compiles times) in the same stroke but completely failed to do so. (Votes were all over the place. At one point that comment was up 10–15 points IIRC even with some opposition, until the Aucklanders woke up and buried it in downvotes. And that was when I was being a lot more polite about it than I am now.) C++ programmers seem to have a permanently altered sense of what constitutes "tastefulness". Every time I think of the ugliness of Rust, I'm reminded of the comments from Stallman where he acknowledges the elegance of Java as an evolution of C's syntax, even though he never reached for Java for himself, having always stuck to C and Lisp instead. Then he goes on to trash C++.
- adamnemecek 6y agoAre you saying Rust didn't fix the grammar problem?
- adamnemecek 6y agoI would call the design "rugged". The syntax is well thought out actually.
- ziml77 6y agoThat's a good way to describe the feel. I think it only truly gets ugly when you do something like Arc<Mutex<Box<HashMap<String, Vec<String>>>>>. But the beauty of "(almost) everything is an expression" makes up for that.
- adamnemecek 6y agoSure however compare it with cpp.
- blub 6y agoI think that is correct, but I also find Rust to be an unfriendly language and this is a very widespread problem in software engineering: our tools are generally over-complicated and people are expected to just deal with it as a sort of hazing ritual. We've also come to associate one's worth as a programmer with how many of these arcane and opaque tools they can master. It's much easier to invent a complicated tool and come up with excuses about why all the complexity was required than to invent a tool which makes people happy and productive. Of course some people are rather weird and they're happy with baffling tools, but I'm talking here about the majority. Garbage collection is the kind of invention which freed countless programmers from having to painstakingly worry about memory management. It's not perfect, as it doesn't handle all resources, but it is doubtlessly a step in the right direction. Now if you look at Rust, their solution to memory management is to force the programmer to add countless annotations so that the unintelligent compiler can figure out what's happening. This is a step in the wrong direction and I certainly hope that this is only a local optimum that will be surpassed, otherwise the future of system programming looks quite sad.
- mplanchard 6y agoFWIW, I’ve written lots of Rust, and I’ve only had to use lifetime annotations (which is what I assume you’re talking about) a few times. The vast majority of the time the compiler allows you to elide lifetimes.