this post was submitted on 17 Dec 2025
429 points (96.7% liked)
Programmer Humor
27920 readers
1657 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
what? what part of rust is ugly?
Maybe they're confusing the literal name with the language? Idk.
I grew up on Perl and holy fuck... Rust is fine.
I'm learning Perl - purely for fun - and yeah... it's a little funky.
Perl is ugly but great. It's like shell scripting with a more solid programming language. I'd never use it outside of simple scripts in my os, but whenever I do use it it's very fun. Anyway, yeah, rust looks fine to me. Maybe they are not very experienced with it? I know some of my programs used to have lines with just x.unwrap().unwrap().unwrap() or whatever, which is not pretty.
Enums and nested blocks. I understand the importance of
OptionandResult, but it's fucking infuriating when I have to check and destructure the result of every function call and either bubble the result up the stack from six levels of nestedif letblocks or risk Cloudflaring my program by using.unwrap(). And while I like being able to extract a return value from anif...elseexpression, the structure gets really convoluted when multipleifandmatchblocks are nested (of course each one returning a value), and it gets completely fucked once closures are introduced.I like Rust, but calling it pretty is delusional.
Sum types with associated values are worth it
Learn how to use enum error types, how error bubbling works, and how to convert between Options and Results.
It's Rust you are talking about, not Go.
This isn't about some feature of the language being good or bad. It's about Rust being ugly or not. The things I mentioned will always look ugly in the source code.
It's hilarious to me that people talk about "ugly" as if their opinions are objective.
I found Rust unpleasant to look at for the first two weeks of learning it, and now that I've been using it professionally for three years I loathe when I need to read code in other languages.
No other language can rival Rust in showing the exact information needed to understand the code
never too much and never too little
while being concise, correct, and handling all edge cases.
You can be more concise in other languages, but it will come the loss of handling every little possible bug. You can be prettier in other languages, but it will come at the price of adding a lot of useless boilerplate.
Of course there are cases where Rust can be verbose or confusing, but that's when you're doing very esoteric things that would be just as confusing in other languages.
Like any opinion on aesthetics, how someone feels about the prettiness of a language will have far more to do with familiarity than with any objective metrics.
I like to use
unwrap_or()to define fallback values. TheOptionAPI is quite expressive.I'll start using this one
You can also use let else.
But really it’s the exact same as other languages, it just forces you to handle it better. C-based languages will return 0/null/-1 and you’ll have to check all 3 of those because they might not mean the same thing. How is that better?
Enums are the best part of the Rust language IMO, so I'm not sure how you can view them as ugly. Having the choice to destructure something is fantastic. You generally aren't required to destructure every return value. Make sure you're using the
?operator as much as possible. If destructuring is getting in your way, it sounds like the code is not very idiomatic.I can't really comment on your issue with nested
ifandmatch. Too much nesting is bad in any language; try extracting more functions and let bindings to make it more readable.You can enable a clippy lint to deny
.unwrap()if you're worried about it.Most of the times you can just
let ... else(which is basically a custom?if you needif let ... elseit's because you actually need 2 branching code paths. In any other language you also doif ... elsewhen you have 2 different code branches. I don't see why this is a rust-specific issue.Literally every single bit of the syntax.
The majority of its syntax is very similar to many other languages. Can you give an example of a language with pretty syntax?
Key point being, similar to some random languages. JS and Python Syntax don't fit a typed and compiled language at all.
Pretty syntax would probably be something like C, where not every single character already widely reserved for specific keywords (like !, ', =) is reused in completely random ways.
Ah yes I also found macro syntax like
vec![andprintln!(to be a bit jarring at first. However I don't know if I would say that C's approach to macros is any nicer, with it's#definemagicBeing unable to give an actual example proves you're just a foaming-mouth hater with nothing to contribute.
From the first syntax examples on Wikipedia:
Now I'm slowly getting annoyed from typing on phone (at least in nvim), and my throat gets clogged with mucus again.
Remember, some of that are subjective preferences and opinions. And the core idea of Rust - fast but safe programs - is good, yet very obvious and not innovative at all, while the syntax and implementation (of cargo (yes I like to wait an hour for a simple webapp to compile because there aren't binary crates and cargo just doesn't multicore 99% of the time)) is subpar to something that's hailed as the savior for everyone and everything by such a large cult.
Types are not implicit, they're inferred by the compiler when there is no ambiguity about what the type needs to be. This is a huge benefit for refactoring code and reducing maintenance. I acknowledge that sometimes you might care to know the exact type of the variable, and sometimes that's not as easy for a human to infer as it is for the compiler, but every decent IDE will provide inline type hints for you. Interpreting code by reading it in plaintext is an exercise in masochism.
Python is actually the opposite on this, and it's one of Python's worst characteristics. The type is unknown until runtime unless you annotate it, and then the annotation isn't really enforced. It's the worst of every dimension.
C++11 introduced auto, and now the community is split between "almost always auto" and "never auto".
JavaScript needed a whole new compiled language (Typescript) to fix its type system problems, and Typescript is only an incremental improvement at best.
Rust has the best type system of any modern language by far. If you're tripped up by not always seeing the type declarations then you're either focusing on the wrong details in the code or you just need a little more practice. The key thing that needs to sink in for new Rust users is that the compiler is always providing safety rails. That means it's no longer your job to verify that every aspect of the code is correct. You can relax a little and actually have something akin to duck typing without all the pitfalls that usually come with it.
Sorry for intrusion, but mhm, nah. I get it there are people who want to play around and have language/compiler babysit them, but there are also people like me who want to see exactly what something is. So no, Rust, just like JavaScript, can be liked by some people, but it is in no way something that has "best type system"
There actually is no such thing as best type system, same way there is no such thing as best language
This is a false dichotomy when it comes to Rust. Despite everything I said and despite Lucy's complaint, there is nothing that actually stops someone from explicitly annotating the exact type when declaring a variable. It's just not required by the language, and most developers eventually realize that it's not actually useful.
You're right that these preferences are subjective, be although much of that subjectivity has more to do with how our past experiences have shaped what we're familiar with, rather than any intrinsic characteristics of person. By that I mean, someone who uses Rust enough will most likely come to like the way the general community styles its code, sooner or later. In the meantime you're welcome to do things in a way that suits your needs.
The only thing that Rust's type system is weak on is runtime reflection. There are ways to achieve it within Rust's type system, but it's considerably more work than what you get in Python and JavaScript. Imo the only reason to choose a language other than Rust for a greenfield project is if you have a strong need for runtime reflection all over the place and aren't very concerned about performance, threading, or avoiding entire categories of bugs that the Rust compiler protects you from.
or that I don't want to twist my brain with Rust way of things. But I agree with you on everything else :)
then go ahead and explicitly define the type of every variable. rust wont stop you from doing that
I can go ahead and just not use Rust to begin with, what is your point?
If you don't realize that
x = 10denotes an integer of some default length, and thaty = 10.0is a float, then the language isn't the problem.I am not gonna look for first x= expression when I want to know type
You betray so much of what your programming environment is like, with that comment. Because, you see, if you can't behold the first
x=expression on the same screen or, at very worst, the one above, then your code is majorly and deplorably fucked. It's utterly trashed and is in immediate need of repair. If scrolling back to the firstx=expression is overwhelming and exhausting work for you, then the codebase that you work in is mutilated beyond belief and any immediate hope. You need to drop what you're doing, and get to unfucking you code right away so that you can have it in a comprehensible state that isn't dependent on reminding the reader on every single line what stuff is like. You need to learn to split things in smaller things that humans can understand as their own self-contained units of meaning. When you reach the balance of formulating the code in self-contained units that can be comprehended easily, you won't need type reminders on every line.Not to mention that if you name your identifiers properly, you won't have to wonder what their type should be.
Lol. Thanks for the trip in your dreams, but that will be enough for me. Have a good day
Stage one: denial.
If you don't understand how having any statement be an expression is useful, you don't have enough experience to criticize programming languages.
In practice, type inference in Rust is not a problem since the language is so strongly typed. In fact, it is more strongly typed than both C and C++, and will force you to cast values explicitly in cases where C and C++ will happily mess up your variables without warning. The absence of type inference would also be a major pain, since nested types such as iterators can get quite complex and very verbose. If you've programmed using older C++ standards, then you know this pain
"not having mandatory parenthesis in if statements is hazardous, so I prefer to write C instead of rust, because I really care about safety" < that's how you sound.
Average Rust code:
This is on the level of the esolang I made at 8 y/o, with random characters denoting random actions everywhere, at random positions.
It's incredibly disingenuous to call this average Rust code and further erodes your credibility. I may as well point to hundreds of lines of preprocessor macros in a C++ header and call it average C++ code.
This is not what an average Rust developer is writing 99% of the time. If someone on my team submitted a PR with an implementation of
sumthat usesmacro_rules!I would almost certainly reject it.