this post was submitted on 15 May 2024
47 points (100.0% liked)

Programmer Humor

32557 readers
311 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 14 comments
sorted by: hot top controversial new old
[–] [email protected] 13 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

[–] [email protected] 27 points 6 months ago (2 children)

Even the joke has mulithreading problems.

[–] [email protected] 12 points 6 months ago

Using Rust would have prevented this race condition

[–] [email protected] 6 points 6 months ago

Angry upvote

[–] [email protected] 10 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.

[–] [email protected] 7 points 6 months ago

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

[–] [email protected] 3 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.

[–] [email protected] 1 points 6 months ago (2 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)

[–] [email protected] 3 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).

[–] [email protected] 1 points 6 months ago

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.

[–] [email protected] 5 points 6 months ago (1 children)

You eventually would run out of Rust developers

[–] [email protected] 8 points 6 months ago

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

[–] [email protected] 2 points 6 months ago (1 children)

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

[–] [email protected] 3 points 6 months ago

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