392
top 46 comments
sorted by: hot top controversial new old
[-] parlaptie@feddit.org 139 points 1 month ago

Hang on, this is just a C++ joke slapped onto Rust.

[-] puchaczyk 142 points 1 month ago

You could say they have rewritten the joke in Rust

[-] dave@feddit.uk 18 points 1 month ago

But you get the joke faster now.

[-] davidagain@lemmy.world 8 points 1 month ago

No, it's just impossible for it to leak out of a hole in the back of your head that you didn't realise was growing under your pony tail.

[-] Laser@feddit.org 84 points 1 month ago
[-] enemenemu@lemm.ee 13 points 1 month ago

To me it just looks like you do not need the braces at all

[-] merc@sh.itjust.works 5 points 1 month ago

A funny, but incredibly subtle joke to do would be to do a post like this, but get the indentation subtly wrong somewhere, so something that's supposed to be inside a loop is outside according to indentation, but is inside according to braces.

[-] duckythescientist@sh.itjust.works 79 points 1 month ago

I'm good at Python, and I don't know Rust. This looks fine to me. I've fully missed the joke.

[-] logi@lemmy.world 162 points 1 month ago* (last edited 1 month ago)

Same. Until you notice the column of curly braces and semi colons in the right margin.

[-] Arcka@midwest.social 21 points 1 month ago

Oh, so Rust is like JavaScript!

[-] barsoap@lemm.ee 7 points 1 month ago

No, Rust lacks the semicolon elision rules of Javascript which make everyone always use semicolons in javascript because they're so horribly broken.

Rust is like ML, quite literally, not just by ancestry: The syntax is palpably ugly, but at least it's sane, regular, and concise where it matters.

[-] F04118F@feddit.nl 2 points 1 month ago

Undervalued comment right there. This is better than the OP

[-] duckythescientist@sh.itjust.works 9 points 1 month ago

Oh... Oh god

[-] dgriffith@aussie.zone 71 points 1 month ago* (last edited 1 month ago)

rustfmt

is stopping me from writing code like this, and I have never been more happier using it after viewing this.

[-] killeronthecorner@lemmy.world 60 points 1 month ago

I'm going to write a tool that automatically adds the braces and semicolons to the column as you edit the code.

I will call it rustfml

[-] Irelephant@lemm.ee 11 points 1 month ago

Crap, thats what I was thinking.

[-] verstra@programming.dev 10 points 1 month ago

It could be run after git checkout and then rustfmt before commit.

[-] killeronthecorner@lemmy.world 5 points 1 month ago

Slow down satan

[-] nintendiator@feddit.cl 1 points 1 month ago

Please do, I'm waiting for it to get ported to other languages.

[-] TheAgeOfSuperboredom@lemmy.ca 59 points 1 month ago

Then some jerk runs rustfmt and ruins all your hard work!

[-] wise_pancake@lemmy.ca 27 points 1 month ago

Can't you fix the default format to this?

[-] Feathercrown@lemmy.world 50 points 1 month ago

It took me way too long to notice the horror on the right

[-] mostlikelyaperson@lemmy.world 33 points 1 month ago

My medication mostly.

[-] PhobosAnomaly@feddit.uk 29 points 1 month ago

I hate it with every fibre of my being but also secretly calmed by that column of statement terminators and brackets.

It's like the code representation of the Vancouver riots kiss photo.

[-] lena@gregtech.eu 1 points 1 month ago

Why would that cause the same feeling?

[-] PhobosAnomaly@feddit.uk 3 points 1 month ago* (last edited 1 month ago)

I'm not sure if you're taking the piss or not but I'm going to choose to believe you're asking in good faith!

The code just feels... messy, unfamiliar, almost chaotic - but the semicolons and curly brackets in a neat little row, formatted in a satisfying way, is like an island of calm and order in the middle of a formatting clusterfuck.

A moment of serenity in the middle of a riot, one may think.

[-] lena@gregtech.eu 3 points 1 month ago

Ohhhh thanks for the explanation, I'm a bit stupid :3

Also, I didn't mean it in a bad way, a genuine question. Thanks for assuming it's in good faith ^^

[-] notabot@lemm.ee 16 points 1 month ago

This makes my deeply uncomfortable, like an itch I can't quite scratch.

[-] bitcrafter@programming.dev 3 points 1 month ago

More like a scratch you just can't itch.

[-] villainy@lemmy.world 12 points 1 month ago

DwangoAC and the TASBot crew are maniacs in the best possible way. I would like to continue having a high opinion of him, hence I will pretend that this post does not exist.

[-] mariusafa@lemmy.sdf.org 10 points 1 month ago

This is why python has to be putdown

[-] Reptorian@programming.dev 1 points 1 month ago

I dislike Python as well, but it has it place. I only use it for quick code tests before doing it in other languages.

[-] poireCartable@lemm.ee 10 points 1 month ago

My eyes! My eyes!!!!

[-] CanadaPlus@lemmy.sdf.org 10 points 1 month ago

Wow, so this is possible.

Formatting is so damn arbitrary. Somebody has to have tried storing just the parse tree on disk, right?

[-] Lightfire228@pawb.social 2 points 1 month ago

If you do that, you lose formatting and comments every time you load the source from disk

[-] CanadaPlus@lemmy.sdf.org 3 points 1 month ago* (last edited 1 month ago)

Losing formatting other than what you've set in your deparser would be the point. Losing comments would be bad, but that seems easily fixable just by giving each comment block a symbol that points to it's contents.

[-] djehuti@programming.dev 3 points 1 month ago

Or by including comments in the parse tree. (& Yes, it is done various places for various languages and formats.)

[-] CanadaPlus@lemmy.sdf.org 1 points 1 month ago* (last edited 1 month ago)

Do you have some examples?

(That is what I meant by giving them a symbol, maybe I worded it poorly)

[-] djehuti@programming.dev 1 points 1 month ago

The best example I have is a closed source one and I can't be more specific on what it is than to say that it's probably installed on at least one of your Apple devices (assuming you have any).

Implementation-wise, the syntax tree nodes have additional attributes that hold pre- and/or post-element text. What's on disk is the serialized tree. You edit a text version, and it's parsed on every edit so it doesn't have to be parsed again at evaluation time, and what's stored is the parse tree with enough whitespace and comment hints to reconstruct the text for editing.

This is a case where looking at the textual code is rare, but hundreds of results must get updated in realtime on every change. This might be enough of a hint as to what program it is.

[-] brisk@aussie.zone 2 points 1 month ago

The closest thing I've seen is Combobulate

[-] tonytins@pawb.social 9 points 1 month ago

Oh... Oh! Well, that is creative.

[-] stefenauris@pawb.social 8 points 1 month ago
[-] BigMikeInAustin@lemmy.world 7 points 1 month ago

I’ll allow it!

[-] bitcrafter@programming.dev 6 points 1 month ago

My humanity.

[-] GourmetLizard@sh.itjust.works 1 points 1 month ago
this post was submitted on 27 Feb 2025
392 points (100.0% liked)

Programmer Humor

22272 readers
1812 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