this post was submitted on 16 Sep 2025
291 points (97.1% liked)

Programmer Humor

26539 readers
3336 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 50 comments
sorted by: hot top controversial new old
[–] edinbruh@feddit.it 71 points 1 week 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 20 points 1 week ago (2 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 14 points 1 week ago

I can imagine;

[–] LeFantome@programming.dev 10 points 1 week ago (1 children)

I have built single pass compilers that do everything in one shot without an AST. You are not going to get great error messages or optimization though.

[–] Kazumara@discuss.tchncs.de 3 points 1 week ago

Oh! Okay, that's interesting to me! What was the input language? I imagine it might be a little more doable if it's closer to hardware?

I don't remember that well, but I think the object oriented stuff with dynamic dispatch was hard to deal with.

[–] LeFantome@programming.dev 50 points 1 week ago* (last edited 1 week ago) (3 children)

GCC is adding cool new languages too!

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

Honestly, now that I can see the "business productivity" through-line from COBOL, to BASIC, and most recently, Python, I should probably just learn COBOL.

[–] parlaptie@feddit.org 66 points 1 week ago (2 children)
[–] LeFantome@programming.dev 17 points 1 week ago* (last edited 1 week ago) (3 children)

I guess I should have put a /s but I thought it was pretty obvious. The 68 in Algol 68 is 1968. COBOL is from 1959. Modula-2 is from 1977.

My point exactly was that all the hot new languages are built with LLVM while the “new” language options on GCC are languages from the 50’s, 60’s, and 70’s.

I am not even exaggerating. That is just what the projects look like right now.

[–] brotundspiele@sh.itjust.works 5 points 1 week ago

If Algol68 is from 1968, shouldn't Modula-2 be from 1898?

[–] sukhmel@programming.dev 4 points 1 week ago (1 children)

I would guess those languages are added for preservation and compatibility reasons, and it's also an important thing

[–] LeFantome@programming.dev 2 points 4 days ago

I think some are getting used actually, particularly COBOL. I think Modula-2 still gets used in some embedded contexts. But these languages are not exactly pushing the state-of-the-art.

Algol 68 is interesting. It is for sure just for academic and academic enthusiast purposes. Historical and educational value only as you say.

load more comments (1 replies)
[–] Skullgrid@lemmy.world 10 points 1 week ago

It's new to gcc!

[–] davidagain@lemmy.world 6 points 1 week ago
BEGIN    
    BEGIN
        Wow, 
        Modula 2! 
    END;    
    I remember Modula 2.
END.
[–] davidagain@lemmy.world 33 points 1 week ago (2 children)

Great optimisation, awwwful compile times.

[–] davidagain@lemmy.world 23 points 1 week 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 10 points 1 week ago* (last edited 1 week 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 7 points 1 week ago* (last edited 1 week ago) (2 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 10 points 1 week ago (17 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 8 points 1 week ago (3 children)

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).

load more comments (3 replies)
[–] firelizzard@programming.dev 3 points 1 week ago (2 children)

Garbage collection is analyzing the heap and figuring out what can be collected. Reference counting requires the code to increment or decrement a counter and frees memory when the counter hits zero. They’re fundamentally different approaches. Also reference counting isn’t necessarily automatic, Objective-C had manual reference counting since day one.

[–] BatmanAoD@programming.dev 6 points 1 week ago

"Garbage collection" is ambiguous, actually; reference counting is traditionally considered a kind of "garbage collection". The type you're thinking of is called "tracing garbage collection," but the term "garbage collection" is often used to specifically mean "tracing garbage collection."

[–] CanadaPlus@lemmy.sdf.org 3 points 1 week ago (6 children)

It's still mentioned as one of the main approaches to garbage collection in the garbage collection Wikipedia article.

load more comments (6 replies)
load more comments (15 replies)
[–] frezik@lemmy.blahaj.zone 4 points 1 week ago (1 children)

I wish more languages used ref counting. Yes, it has problems with memory cycles, but it's also predictable and fast. Works really well with immutable data.

[–] davidagain@lemmy.world 3 points 1 week ago (1 children)

Roc uses immutable data by default. It performs opportunistic in-place mutation when the reference count will stay 1 (eg this code would satisfy the borrow checker without cloning or copying if it were rust - static code analysis).

[–] frezik@lemmy.blahaj.zone 2 points 1 week ago* (last edited 1 week ago) (1 children)

Thanks, this looks really interesting. I've thought for a while that Rust's borrow checker wouldn't be such a pain in the ass if the APIs were developed with immutable data in mind. It's not something you can easily slap on, because the whole ecosystem fights against it. Looks like Roc is taking that idea and running with it.

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

I think that roc and rust are both aiming for fast memory safety, but rust is aiming to be best at mutable data and rpc best at immutable data.

I heard of someone trying to do exactly that - immutable functional programming in roc, but they gave up for the same reason you said - the whole ecosystem is working on the opposite assumption.

As far as I'm aware most of the roc platforms are currently written in rust or zig. Application-specific code is written in roc calling interface/io/effectful functions/api that the platform exposes and the platform calls into the roc code via the required interface.

I do think it's really interesting, and once they have a desktop gui app platform (which must compile for windows for me to be able to use it for work), I'll be giving it a good go. I think it's one of the most interesting new languages to arrive.

[–] lena@gregtech.eu 14 points 1 week ago (2 children)

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

[–] firelizzard@programming.dev 5 points 1 week ago

TinyGo isn’t that much slower and it uses LLVM

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

That would work!

[–] tatterdemalion@programming.dev 13 points 1 week ago (1 children)

Isn't Zig working on their own backend?

Also, pretty excited about the cranelift project.

[–] vpol@feddit.uk 8 points 1 week ago (1 children)

Yes, and it’s now default for x86_64

[–] brucethemoose@lemmy.world 14 points 1 week ago

I'll make my own LLVM, with blackjack and hookers.

load more comments
view more: next ›