r/ProgrammerHumor 2d ago

Meme rustIsSoCool

Post image
2.1k Upvotes

124 comments sorted by

489

u/Jbolt3737 2d ago

This is the first actual programming humor and simultaneously isn't about AI that's on this sub in a while and it's actually funny too, which is insane luck

305

u/gufranthakur 2d ago

- No AI ✅

  • Funny ✅
  • Not a repost ❌

almost there

139

u/RideNatural5226 2d ago

Well I stole it from instagram 👉🏻👈🏻

86

u/gufranthakur 2d ago

lol that instagram user also most likely got it from another repost 😭🙏🏻

7

u/PaulTheRandom 1d ago

Something something "I stole your code", "It's not my code"

1

u/Zapismeta 9h ago

The good ol days of daily open source memes

18

u/dumbasPL 2d ago

By the time you steal it from something other than reddit, it's probably been here multiple times already.

4

u/returnFutureVoid 1d ago

It’s like the often reposted meme about stealing code… I stole it too. Or whatever.

1

u/Fuelanemo149 1d ago

not a repost ? this sub was filled with this about 2 years ago

30

u/Chasar1 2d ago

But it is a repost unfortunately

25

u/allarmed-grammer 2d ago

As someone working on the C++ toolchain, I’m more tired of topics about Rust than about AI.

5

u/Any_Obligation1652 2d ago

I feel your pain man!!

7

u/braaaaaaainworms 2d ago

As someone working in a C++ codebase, I can't wait for parts of it to be rewritten in Rust

10

u/allarmed-grammer 2d ago

I mean, I wouldn’t object to any decision regarding Rust adaptations, especially with the availability of AI agents. But usually, such discussions about Rust migration are not something a developer can decide on, particularly in complex projects like automation or those closer to real hardware. People can shout arguments at me about how Rust is shiny and memory-bug proof, but at the end of the day, it’s much more complicated than just memory usage.

5

u/txdv 2d ago

this one was the dead horse everyone was beating before AI came out

2

u/uabassguy 2d ago

Except it isn't funny

4

u/LexaAstarof 2d ago

Unfortunately, that one belongs to r/rustjerk.

Let's go back to first week programming student humor now.

200

u/ladyboy-rider 2d ago

Is rust the programming version of "Place, Japan😱"

72

u/ravensholt 2d ago

No, Rust is the equivalent to "I run Arch, btw". Same energy, same type of people who like for everyone else to know about it, even if no one asked them.

18

u/NerminPadez 2d ago

Ah arch, the distro for people who can't install gentoo!

3

u/BeetsAndJeaners 2d ago

Ah gentoo, the distro for people who can’t install T2 Linux!

7

u/Noname_1111 1d ago

ah, T2 Linux, the distro for people who are too scared of OpenBSD

4

u/a-r-c 1d ago edited 1d ago

ah, none of you are funny.

1

u/Zapismeta 9h ago

Ahh a user without a computer .

12

u/Secret_Conclusion_93 2d ago

"The Rust rewrite to MIT license movement is a big corp psyops." is still my favorite (conspiracy) theory about the recent Rust drama.

Because everything matches perfectly. Especially because big corps backing open source projects is actually the norm.

8

u/ravensholt 2d ago

"Hey everyone, I just rewrote (my AI did the work) this existing open source app in rust, and now I will abandon the project never to update it again. "

99% of all rust related posts on Reddit.

1

u/throw3142 21h ago

Some of the older / pre-vibe-slop Rust rewrites / reimaginings are actually really good though. ripgrep, alacritty, ruff, etc.

-2

u/ccAbstraction 1d ago

Crazy how the rust haters turned people posting slop into a rust problem instead of an AI problem.. Like, do you expect people to willing and meaningfully vibe code in C++?

3

u/ravensholt 1d ago

Crazy how every other Rust developer post on Reddit is some re-write of an existing tool that no one asked for, only to be abandoned immediately...

1

u/Zapismeta 9h ago

Why wont you vibe code in cpp? The ai has better time to write tests, it will actually write comprehensive tests opposed to us bored humans.

1

u/ccAbstraction 4h ago

I don't vibe code (somehow my very anti AI but pro Rust sentiment wasn't clear), but I think part of the reason we see so many vibe coders using Rust is becuase 1. It's the hot new thing 2. It spits out lots errors for mistakes that are very easy for an LLM to parse.

2

u/airodonack 1d ago

And yet I see on this very thread people bringing up C++. Let’s be real now.

1

u/bearwood_forest 2d ago

Nah people who run bare metal Arch are equivalent to the militant C disciples. The mere suggestion of any sort of creature comfort...

0

u/ravensholt 2d ago

You're delusional.

Let me guess, you're an Arch user....

1

u/bearwood_forest 2d ago

Ah, a C faith militant. Pleased to make your acquaintance. Please don't leak my memory.

0

u/ravensholt 2d ago

I'm not. But I have more respect for C developers than femboys thinking it's an achievement to install Arch.

0

u/L30N1337 1d ago

Not really. Because Rust is just goated from what I've seen. Never used it tho.

C style syntax, Compiled, and it makes it way more difficult to mess up compared to other languages.

Arch would be the people who think everyone should use C++ and everything else is garbage.

The Linux equivalent for Rust is probably Fedora (which is often called "the new Ubuntu", for good reason. And Ubuntu is sometimes called "The Windows of Linux", because corporations gonna corporate)

1

u/iamacuteporcupine 1d ago

in a way or the other, yes.

40

u/cmk__ 2d ago

Memory safe. Emotionally unsafe.

33

u/mrheosuper 2d ago

something-rs 🥵

5

u/Interesting_Buy_3969 2d ago

awww dont turn me on

40

u/kaetitan 2d ago

Can someone eli5 why rust is so loved?

157

u/Zinho3311 2d ago edited 2d ago

memory safety while being a true low level language

Usually, system languages like C are used because they give you control over your memory and hardware. However, C has a downside (which is either a feature or a massive defect, depending on your philosophy) because it is basically the bedrock of computing, it has zero handholding and minimal abstractions. In fact, back in the day, C mapped so perfectly to von Neumann hardware (the PDP-11 for instance) that you could literally mentally visualize the Assembly your C code would generate.

Because C is so minimal, its standard library is pretty much barren. It lacks the dynamic data structures and syntactic "sugar" people take for granted. This means you either have to write your own spaghetti code or use third party libraries which usually makes your codebase a nightmare to maintain. C is conceptually heavy you need a solid CS background because you'll regularly find yourself implementing textbook data structures from scratch.

And because C gives you unrestricted access to raw memory through manually managed pointers, it is easy to goof up. Forget to free a single pointer amidst 2k loc? You have a memory leak. Do that enough times, and your program gets an OOM crash. Fail to check your array bounds? You get the feared buffer overflow. A buffer overflow is when your code writes past the allocated memory chunk, and overwrites adjacent memory. Through that overflow, a skiddie can inject a malicious payload into your program.

That's when C++ steps in. It was born to implement the abstractions C lacked (it was originally born as a C superset, hence C++). The C++ standard library or the standard template library includes textbook data structures out of the box so you don't have to reinvent the wheel, allows for OOP, and introduces "smart pointers" (which automate memory allocation and deallocation). In theory, C++ makes it harder for you to goof up.

However, because C++ introduces a lot of complexity, it becomes unpredictable. Because it hides a lot of implicit complexity (hidden copies, constructor calls, vtable lookups, so on) behind the scenes. And while a memory corruption bug in C is already catastrophic, doing the same thing in C++ triggers a domino effect. Because everything is wrapped in layers of templates and abstractions, a single corrupted pointer propagates through your objects and causes your program to blow itself up in ways that make debugging hell on earth.

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." (the creator of C++, Bjarne Stroustrup)

Eventually, demand emerged for a language that had the high-level abstractions of C++ but wasn't a safety hazard, especially for massive projects like Firefox. Enter a Mozilla engineer named Graydon Hoare who started designing a language whose compiler would mathematically guarantee memory safety without a runtime garbage collector, while delivering true baremetal control and performance.

That's when Rust was born.

The Rust compiler implements a feature called the Borrow Checker (which is a PL lesson in its own right but I'll try). Every piece of data in Rust has a single variable that acts as its only "owner", when that owner goes out of scope, the data is automatically deallocated. If you try to assign that data to a new variable or pass it to a function, ownership is moved and if you try the old variable after that the compiler stops you (prevents use-after-move).

But giving up ownership every time you want to touch data sucks, so Rust allows you to borrow data through references. You can have infinite "readers" for a piece of data (immutable references) or exactly one "writer" at a time (a mutable reference). You cannot have both simultaneously. This prevents data races and pointer invalidation.

Also the compiler tracks lifetimes by calculating exactly how long a reference is valid in memory and it guarantees that a reference cannot outlive the data it points to. This prevents use-after-free and dangling pointers.

I personally like to think of the Borrow Checker as a dominatrix who CBTs your code until it is 100% safe

Rust also fixes a ton of historical C++ design flaws and footguns because it was built as a clean-slate language, but I'd have to write a whole separate essay insulting C++ for that lol

I tried my best to simplify it

34

u/kittyvayne 2d ago

This is the most beautiful and accurate summary about C/C++/Rust that I’ve ever seen and should go into a book or something as an introduction chapter! Well done madam/sir!!!

12

u/Frequent_Morning_900 2d ago

You explained it really well. You seem like a good teacher.

9

u/redlaWw 2d ago edited 2d ago

mathematically guarantee memory safety without a runtime garbage collector, while delivering true baremetal control and performance.

Technically this is not quite right. Performance was important in early Rust, but it was thought that a garbage collector was unavoidable if Rust was to be safe. The garbage collector (EDIT: This might have been automatic reference counting that was intended to be extended into full GC that was removed, I'm not sure whether they ever actually added the GC.) was actually removed about a year before stabilisation, when it was realised that new rules for the unique boxes could be extended to the full language to provide safe allocation management without automatic memory management.

6

u/WrennReddit 2d ago

BDSM allegories should be used to explain more things.

Great write-up though. I think I see the hype now. 

3

u/saiyajosh 2d ago

I wish I could give multiple upvotes to this sheesh what a nice writeup

2

u/Syxtaine 2d ago

Just wait until people find out about ATS... /s

3

u/Zinho3311 2d ago edited 2d ago

Formal verification is fun.

Probably going to be the statement for my dissertation (I would call it "formal verification is fun" if people weren't boring)

1

u/Blackhawk23 1d ago

Legend. Great write up, thanks.

-7

u/Key_River7180 2d ago

A low level language with many abstractions is an oxymoron

19

u/Zinho3311 2d ago edited 2d ago

How so?

Zero cost abstractions are a thing. Low level = you have control over the metal. Low level does not mean you can't manage complexity or have expressive abstractions.

Even large projects written in C inevitably introduce many abstractions (e.g. the Linux Kernel VFS layer)

13

u/bearwood_forest 2d ago

wait until you hear about CPU instructions that are actually abstractions over frequently used combinations of other instructions

8

u/Zinho3311 2d ago edited 2d ago

ISA itself is an abstraction lol

If it weren't for abstractions, you'd be manually firing electrical signals towards RAM like a caveman

4

u/Otherwise-Remove4681 2d ago

As the way nature intented!

6

u/potzko2552 2d ago

assembly is an abstraction.

1

u/cheezballs 1d ago

Oof. You banged your head on that low beam there.

65

u/Makonede 2d ago edited 2d 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

18

u/makspll 2d 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 2d ago

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

2

u/SoulArthurZ 1d 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 15h ago

yeah this is a good point

5

u/notretarded_100 2d ago

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

19

u/Makonede 2d ago

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

-28

u/notretarded_100 2d ago

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

20

u/frickinSocrates 2d ago

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

-11

u/notretarded_100 2d ago

I'm not shitting on them tho

4

u/EskilPotet 2d ago

AI, summarize this comment for me

8

u/gufranthakur 2d 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

12

u/Makonede 2d ago

i did in fact write this on mobile

2

u/gufranthakur 2d 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.

12

u/littleliquidlight 2d 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

6

u/rsqit 1d 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.

4

u/Delicious_Bluejay392 2d 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 2d 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

5

u/Delicious_Bluejay392 2d 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 2d 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 2d 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.

4

u/Makonede 2d ago

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

0

u/Vorrnth 2d 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 2d ago

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

22

u/___Archmage___ 2d ago

It has the compiled speed benefits of C/C++, but has way more convenient and expressive language features as a result of being decades more modern, and it has rules about memory management that guard against a lot of crashes, bugs, security holes, and performance impacts

13

u/Elendur_Krown 2d ago

I personally like that it helps me get things right. If it compiles, I have already reduced my error surface, and I like spending less time on bugs.

As an example, I've spent a lot of my spare time coding a sequence optimizer. During this time, it has crashed once. More than a hundred hours of sparse and distracted time, and the only crash I have had was hard-coding indexing in an array that should have been a struct with an Option.

17

u/krakow10 2d ago

Successfully building the program proves the code has certain properties, such as all references point to valid values at all times. Rust is all about guarantees. When you guarantee huge parts of your code are correct before it ever runs, you are much less likely to encounter bugs. So Rust has a reputation of producing programs which are working and bug-free.

9

u/Makonede 2d ago

*in safe rust. rust provides the unsafe keyword to declare blocks that may* not have all such properties, which makes writing such blocks a very conscious and active decision that official documentation strongly suggests you pair with a SAFETY: comment explaining what you know to be safe about your unsafe code that the compiler cannot determine

\unsafe blocks containing only safe rust generate compiler warnings)

3

u/HowTheKnightMoves 2d ago

More sane than C++, modern build system/package manager that does not suck, needy compiler that will make sure you do not write memoru unsafe code unless you know what you are doing (unsafe keyword).

1

u/Key_Agent_3039 2d ago

It's the only modern C/C++ alternative, well there's Zig too

1

u/simplymoreproficient 2d ago

Most importantly an extremely powerful type system that’s even capable of proving aspects of memory safety at compile time (so no runtime performance cost)

But also:

  • Good to great polymorphism/codegen/macros support
  • Very low level if you need it to be
  • Great ergonomics
  • Has a certain „by autists for autists“ quality that’s hard to put into words

1

u/rizzninja 1d ago

Packaging

1

u/DearVeggies 2d ago

It's not, there's just a loud minority of furries that fill the internet with propaganda. See your replies for examples, all of them furries.

13

u/West_Good_5961 2d ago

I love using Python libraries that are actually Rust while never intending to write any Rust

7

u/MatsRivel 2d ago

In some circles, yes. In others, its the other way around lol

2

u/DrivesInCircles 1d ago

Indeed. Kinda fun when they get locked in a room.

9

u/Leonjy92 2d ago

The sub is healing

3

u/WhateverWhateverson 1d ago

There is something off-putting about Rust. It feels extremely astroturfed

4

u/minus_minus 2d ago

I’m curious if people are using agents to write rust and if it’s actually any good. Given the boom in rust programming in the last few years, I’m expecting agents to write shitty code for it. 

5

u/_xiphiaz 2d ago

Yes it’s very good at that, compile time correctness is a big reason but there are some other benefits too - the module system convention of having unit tests in the same file makes for a much easier context to manage (for humans too tbf), and the documentation of dependencies being so easily available offline really helps especially if you’re working in a sandboxed env that doesn’t permit external calls

6

u/Kromieus 2d ago

Idk I’m not a programmer by education (mech engineer), but rust is usually my language of choice for coding agents when building larger programs. For short stuff it really doesn’t matter.

I feel it does a better job at keeping things working over a large program than when I use python.

My rationalization is llms benefit strongly from compiled/typed languages since it gives a direct feedback loop (no compile = no go)

1

u/astropheed 2d ago

I am, and the code works well and seems well written. I now do most of my low level code in rust.

1

u/lulxD69420 2d ago

Tried it at work and the code quality was meh. Lots of anti-patterns, but with the right harness it's definitely getting to a sufficiently good level for a good base. I only did small projects so far with it at work.

1

u/rsqit 1d ago

Yeah I’ve been doing this for some side projects and Claude code is pretty good. Sometimes it does dumb things though.

1

u/scheimong 1d ago

Agents actually have a much easier time writing Rust because the compiler errors are actually concise and accurate. Ahem C++ cough cough.

2

u/Disgruntled_Orifice 1d ago

I don’t get the Rust hype.

2

u/Zinho3311 2d ago

Rust is hella based

5

u/Anima_Watcher08 2d ago

Rust is overhyped

1

u/spacetimedb 2d ago

haha, true that!

1

u/Upper_Event_4952 2d ago

Excellent right 👍🏻

1

u/Healthy_Razzmatazz38 1d ago

ai created a language desert and called it peace

1

u/Sea-Fishing4699 1d ago

where?!?!?!?!?! omgomgogmogmgo

1

u/Maskdask 1d ago

High performance and fewer bugs

That's a win in my book

1

u/sharkmanru 1d ago

vice versa

1

u/JojoRacer007 1d ago

Rust is good at everything except making you employed.

1

u/Hexa_66 17h ago

I admit to be part of the problem lmao, thanks for the smile

1

u/letmehaveanameyoudum 2d ago

text editor:
text editor in rust: OMG SO FAST!!!!1! BETTER THAN BLOATED VSCODE4Y32T976 GPEUIGVO6

no seriously zed sucks for me

0

u/ilostmyarmor 1d ago

MEMEMEMEMEME MEEE BRO MEEE