this post was submitted on 15 May 2024
404 points (96.8% liked)

Programmer Humor

32557 readers
433 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

cross-posted from: https://lemmy.zip/post/15495372

top 19 comments
sorted by: hot top controversial new old
[–] BakerBagel@midwest.social 57 points 6 months ago (1 children)

Rrally should have the two trapdoors meet into a common tunnel before hitting the turbine. As is, you could easily jam the machine if two Rust programers fall in the doors at the same time

[–] nocteb@lemmy.ml 93 points 6 months ago (2 children)

Even the joke has mulithreading problems.

[–] PlexSheep@infosec.pub 17 points 6 months ago

Using Rust would have prevented this race condition

[–] CaptainBlagbird@lemmy.world 10 points 6 months ago

Angry upvote

[–] blackstampede@sh.itjust.works 46 points 6 months ago (3 children)

As a Rust programmer, I approve this message. Tumbling through a turbine repeatedly would be less stressful than working on a large python/js codebase.

[–] andrew@lemmy.stuart.fun 16 points 6 months ago

Plus you have plenty of time to tumble once or twice while your large codebase compiles.

[–] pete_the_cat@lemmy.world 9 points 6 months ago

I'm a Linux System Engineer and was the only one in my team that knew Go. I decided to update our mess of old shell scripts for post-provisioning and my boss suggested that I do it in Python so it can easily by edited/fixed by anyone on the team. I spent like two days attempting to do it in Python and then gave up because it would mean transferring a bunch of source code around, installing dependencies and just general annoyances.

In the end the Go project ended up being about 1300 lines of code across a few source files, but it could act as both the client and server (necessary for our hosts in our DMZ to hit our AWX server) with a single binary and no additional dependencies. It was also only like 10 MB.

[–] aluminium@lemmy.world 4 points 6 months ago (3 children)

Sounds better than coming up with the most mindfucking ways to please the borrowchecker in a large rust codebase

(Skill issue probably, i know)

[–] Ephera@lemmy.ml 7 points 6 months ago

Rule of thumb, which I feel gets you 80% there:

If you store data in a struct, you want that struct to have ownership of that data. So, avoid storing references in structs.
If you need to pass data into a function, you usually want to pass it as a reference.

This makes it so you have your data stored in some place with the ownership and from there you just pass data down into functions as references. It forces you to structure your program like a tree (which is often a very good idea to begin with).

[–] blackstampede@sh.itjust.works 5 points 6 months ago (1 children)

Yeah, it took me a bit to wrap my head around it. It's worth it to avoid subtle, weird, and hard to diagnose bugs later on.

[–] agressivelyPassive@feddit.de 1 points 6 months ago (1 children)

Rust needs some layer on top to make it more usable for the typical business apps.

I tried to build simple CRUD apps, but it's still a huge pain, because there's just so much stuff I need to do myself and so much low level overhead that I need to keep in mind.

Java is worse in many ways, but for cobbling together a mess that barely manages to do its thing, it's really great.

[–] UnRelatedBurner@sh.itjust.works 4 points 6 months ago (1 children)

Isn't that the point? It doesn't let you write bad code, thus when you did manage to get something compiled it's close to C speed. Also I kinda like that it tells me ebery lil mistake, it reminds me when I forgot to delete/change something

[–] agressivelyPassive@feddit.de 1 points 6 months ago (1 children)

Compared to Java, it makes me write the same data structures three or four times.

Just an example: if I want to be able to insert a struct via Diesel, I need to write the actual entity, an entity without the id for inserts and maybe some other structures for queries. Also, I need to write a schema file defining the DB plus an SQL statement for actually creating the needed tables.

Another example: explorative testing. Sometimes you need to disable chunks of code for testing purposes. Maybe that long running computation or a DB query, etc. Rust often forces you to write a bunch of "corrections" to make the code seem correct again.

I get that this is useful, but for my line of work, it's just a pain in the ass.

[–] UnRelatedBurner@sh.itjust.works 1 points 6 months ago

I can't relate to these, but Rust is lacking in some aspects that's no secret. That's why it barely has GUIs or object oriented coding. It's usable for both, but why would you. You don't have to use rust for what it's not ment to be used at.

it's trying it's best tho, lol. I wonder if in X years, it'll be like c++, a Frank Einstein of syntax to be usable for everything.

[–] someacnt_@lemmy.world 1 points 6 months ago

I heard this is why some people do ocaml instead

[–] 1stTime4MeInMCU@mander.xyz 15 points 6 months ago (1 children)

Turbine should connect to loudspeaker to make this a closer system lol

[–] genuineparts@infosec.pub 6 points 6 months ago

Still means it's not Black Start capable if the sun is not out.

[–] KingThrillgore@lemmy.ml 11 points 6 months ago (1 children)

You eventually would run out of Rust developers

[–] agressivelyPassive@feddit.de 34 points 6 months ago

They're recycled, look at the end of the dev duct.