this post was submitted on 16 Sep 2025
147 points (98.0% liked)

Programmer Humor

26373 readers
1131 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

founded 2 years ago
MODERATORS
 
top 16 comments
sorted by: hot top controversial new old
[–] tatterdemalion@programming.dev 2 points 2 hours ago

Isn't Zig working on their own backend?

Also, pretty excited about the cranelift project.

[–] LeFantome@programming.dev 6 points 4 hours ago* (last edited 4 hours ago) (1 children)

GCC is adding cool new languages too!

They just recently added COBOL and Modula-2. Algol 68 is coming in GCC 16.

[–] parlaptie@feddit.org 2 points 45 minutes ago

cool new languages

COBOL

[–] edinbruh@feddit.it 21 points 11 hours ago (1 children)

That's like... It's purpose. Compilers always have a frontend and a backend. Even when the compiler is entirely made from scratch (like Java or go), it is split between front and backend, that's just how they are made.

So it makes sense to invest in just a few highly advanced backends (llvm, gcc, msvc) and then just build frontends for those. Most projects choose llvm because, unlike the others, it was purpose built to be a common ground, but it's not a rule. For example, there is an in-developement rust frontend for GCC.

[–] Kazumara@discuss.tchncs.de 3 points 3 hours ago (1 children)

that’s just how they are made.

Can confirm, even the little training compiler we made at Uni for a subset of Java (Javali) had a backend and frontend.

I can't imagine trying to spit out machine code while parsing the input without an intermediary AST stage. It was complicated enough with the proper split.

[–] BuboScandiacus@mander.xyz 3 points 3 hours ago

I can imagine;

[–] davidagain@lemmy.world 18 points 14 hours ago (2 children)

Great optimisation, awwwful compile times.

[–] davidagain@lemmy.world 10 points 13 hours ago (2 children)

New kid on the block, roc, has it right by splitting application code from "platform"/framework code, precompiling and optimising the platform, then using their fast surgical linker to sew the app code to the platform code.

Platforms are things like cli program, web server that kind of thing. Platforms provide an interface of domain specific IO primitives and handle all IO and memory management, and they also specify what functions app code must supply to complete the program.

It's pretty cool, and they're getting efficiency in the area of systems programming languages like C and Rust, but with none of the footguns of manual memory management, no garbage collection pauses, but yet also no evil stepparent style borrow checker to be beaten by. They pay a lot of attention to preventing cache misses and branch prediction failures, which is his they get away with reference counting and still being fast.

A note of caution: I might sound like I know about it, but I know almost nothing.

[–] CanadaPlus@lemmy.sdf.org 4 points 12 hours ago* (last edited 12 hours ago) (1 children)

That sounds pretty great. My impression is that relatively little code actually runs that often.

but with none of the footguns of manual memory management, no garbage collection pauses, but yet also no evil stepparent style borrow checker to be beaten by.

That part sounds implausible, though. What kind of memory management are they doing?

[–] davidagain@lemmy.world 3 points 11 hours ago* (last edited 11 hours ago) (1 children)

Reference counting.

They pay a lot of attention to preventing cache misses and branch prediction failures, which is how they get away with reference counting and still being fast.

[–] CanadaPlus@lemmy.sdf.org 2 points 5 hours ago (2 children)

Oh, you just mean it's a kind of garbage collection that's lighter on pauses. Sorry, I've had the "my pre-Rust pet language already does what Rust does" conversation on here too many times.

[–] BatmanAoD@programming.dev 4 points 5 hours ago

To be fair, the drop/dealloc "pause" is very different from what people usually mean when they say "garbage collection pause", i.e. stop-the-world (...or at least a slice of the world).

[–] davidagain@lemmy.world -1 points 2 hours ago

It's a post rust language.

Dude, do you think rust doesn't free up memory for you? That would be the biggest memory leak in history! No! Rust does reference counting, it just makes sure that that number is always one! What did you think the borrow checker was for?

In roc, because the platform is in charge of memory management, it can optimise, so that a web server can allocate an arena for each client, a game loop can calculate what it needs in advance etc etc.

But like I say, they do a lot of work on avoiding cache misses and branch mispredictions, which are their own source of "stop the world while I page in from main memory" or "stop the pipeline while I build a new one". If it was doing traditional garbage collection, that would be an utterly pointless microoptimisation.

Rust isn't a religion. Don't treat it like one.

When it was very new a bunch of C programmers shit on its ideas and said C was the only real systems programming language, but rust, which was pretty much Linear ML dressed up in C style syntax came from hyper weird functional programming language to trusted systems programming language. Why? Because it does memory management sooooo much better than C and is just about as fast. Guess what roc is doing? Memory management soooooo much better than C, and sooooo much less niggly and hard to get right than the borrow checker and is just about as fast.

Plenty of beginners program in rust by just throwing clone at every error the borrow checker sends them, or even unsafe! Bye bye advantages of rust, because it was hard to please. Roc calculates from your code whether it needs to clone (eg once for a reference to an unmodified value, each time for an initial value for the points in a new data structure), and like rust, frees memory when it's not being used.

Rust does manual cloning. Roc does calculated cloning. Rust wins over C for memory safety by calculating when to free rather than using manual free, totally eliminating a whole class of bugs. Roc could win over rust by calculating when to clone, eliminating a whole class of unnecessary allocation and deallocation. Don't be so sure that no one could do better than rust. And the devXP in rust is really poor.

[–] lena@gregtech.eu 9 points 14 hours ago (1 children)

Yeah, I think Go's compiler is so fast partially because it doesn't use LLVM

[–] davidagain@lemmy.world 1 points 13 hours ago

That would work!