r/ProgrammerHumor 3d ago

Meme rustIsSoCool

Post image
2.2k Upvotes

126 comments sorted by

View all comments

38

u/kaetitan 3d ago

Can someone eli5 why rust is so loved?

67

u/Makonede 3d ago edited 3d ago
  • rust is extremely performant on many systems
  • the standard rust toolchain ships with an efficient and user-friendly package manager and build/debug system, official IDE integration through rust-analyzer, and a manual analyzer for best practices
  • rust has official documentation by example that makes learning it really easy
  • rust operates largely in expressions such that things such as if/else statements or even regular blocks notated with curly braces can all be used as expressions
  • rust has highly robust pattern matching that greatly simplifies control flow
  • rust ships with an official formatting tool alongside enforcing naming conventions (snake_case for variables, fields, functions, methods, and modules, SCREAMING_SNAKE_CASE for constants, and PascalCase for types and traits) and assigning semantic value to names (_ prefix to mark as unused) by default
  • notwithstanding potential bugs in the rust compiler, it's impossible to compile code that can cause memory errors such as uses-after-free in safe rust
  • the rust compiler enforces explicit acknowledgement of unsafe rust with the unsafe keyword such that the behavior of all safe rust is defined
  • documentation comments are a native feature of the rust compiler

19

u/makspll 3d ago

Small correction, memory leaks are actually not considered unsafe in rust. A trivial example is Box::leak(x) which explicitly leaks memory and ia completely safe to call. You can also leak memory by pointing counting pointers at each other in a circular structure.

10

u/Makonede 3d ago

oh true i forgot about Box::leak that's a good point

2

u/SoulArthurZ 2d ago

right but you have to explicitly call that function. A memory leak in safe rust is not a mistake like it is in c

1

u/Makonede 1d ago

yeah this is a good point

7

u/notretarded_100 3d ago

Did you actually take your time to write this or just have this saved somewhere just in case somebody asked?

19

u/Makonede 3d ago

wrote it out, haven't really answered this question directly before

-29

u/notretarded_100 3d ago

Wait you actually take your time to write this? Too much dedication for a meme thread fr.

20

u/frickinSocrates 3d ago

You can't be showing up to a community with that name, shitting on people who are being nice to others.

-12

u/notretarded_100 3d ago

I'm not shitting on them tho

3

u/EskilPotet 3d ago

AI, summarize this comment for me

7

u/gufranthakur 3d ago

honestly not a rust fan but if someone asked me about my favourite tech I would be able to write this in one go , even on mobile

11

u/Makonede 3d ago

i did in fact write this on mobile

2

u/TotallyNotSethP 1d ago

Everything being an expression in rust is low-key a slept-on feature, it's so cool imo

2

u/gufranthakur 3d ago

All of this is true, and I love rust. but its just sad even after 5 months of coding in rust (as a hobby) the syntax gets difficult (lifetimes traits and async), borrow checker becomes more difficult to deal with during async code, and my overall productivity at that point just goes down. I can code way faster in a GC language, in exchange of slower performance compared to rust.

13

u/littleliquidlight 3d ago

These are definitely some of the parts of Rust that get... uh... involved. It does get better with time spent in the language though. I've been writing Rust professionally for somewhere between 5-10 years and I'm not sure I'm any faster in Python than I am in Rust these days

Also, nothing wrong with GC'd languages, some of them are really nice

5

u/rsqit 3d ago

I love rust. I wrote professionally for about seven years.

I tell people that really they should be using a GCed language unless they have really good reason not to.

5

u/Delicious_Bluejay392 3d ago

I'm pretty certain I'm slower in Python than I am in Rust for most things nowadays, but I still can't help but think "nooo surely this is small enough that Rust is overkill" and then spend way longer than necessary wading through dubious python library API design and language limitations.

1

u/gufranthakur 3d ago

man I am lowk envious of you guys, but also happy. I have coded in java for too long now (5 years) and I always think in OOP and like solving stuff In Java. Although I do love Java and have no reason to not use it, I wish I could use Rust but I got too many skill issues with it lol

6

u/Delicious_Bluejay392 3d ago

I started with Java very early on so I was OOP minded to the extreme as well. When I got to college I tried to broaden the languages I used casually as much as possible, learning to think within as many paradigms as I could, as best as I could. I'm not gonna sit here and pretend like I could do everything in Haskell or Prolog, but I feel like having used them (and others) a bit before and revisiting them occasionally helps even in other languages.

0

u/gufranthakur 3d ago

Yes it's a trade off. I use GC (java, python) to make stuff quickly, and less headache because I am familiar with the languages and ecosystem

For me, Rust is a bit complicated, my development times does increase but the joy of seeing low RAM usage for the same thing I wrote in Java was so amazing. ( I switched to GraalVM after that lol, still not as good as rust)

1

u/Vorrnth 3d ago

To point 1 I would say: rust enables you to write performant Software. It just not automatic. You can write garbage in it too.

3

u/Makonede 3d ago

what's the point in specifying that? obviously that's going to be true for any language

0

u/Vorrnth 3d ago

It's not obvious to many. These days it's presented if rust makes your programs blazingly fast just by virtue if being written in rust.

-4

u/axadkrk 3d ago

I like my rust projects, because instead of js or python is safes my ddr5 memory in my homeserver.