this post was submitted on 14 Mar 2024
70 points (100.0% liked)

Programmer Humor

22322 readers
1939 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
[–] [email protected] 12 points 1 year ago* (last edited 1 year ago) (2 children)

Rust is more like: unless you can mathematically prove to me that this is equivalent to a nut there is no ducking way I'll ever let you compiled this.

[–] [email protected] 4 points 1 year ago

And hot take, but that's good. I'm absolutely stupid enough for idiot gloves like that.

[–] [email protected] 0 points 1 year ago* (last edited 1 year ago) (1 children)
[–] [email protected] 1 points 1 year ago (2 children)

If you can make safe Rust segfault you're doing something wrong.

[–] [email protected] 1 points 1 year ago (1 children)

To be fair, you are doing something wrong if you're app segfaults no matter what anguage you wrote it in...

[–] [email protected] 1 points 1 year ago

Despite that, some languages make it easier to be wrong than others.

[–] [email protected] 0 points 1 year ago (5 children)

IME Rust programs crash at about the same rate as other languages. "Rewrite everything in Rust" hasn't made much of a difference for me, so far.

[–] [email protected] 1 points 1 year ago (1 children)

A crash is different to a SEGFAULT. I'd be very surprised to see a safe rust program segfault unless it was actively exploiting a compiler bug.

[–] [email protected] 0 points 1 year ago (2 children)

Sure. I haven't seen a proper segfault from any modern, post-C/C++ language in ages. I've never seen a Go program segfault, or a Nim one (although, there are comparatively few of those as a sample size).

So, it seems to me that - purely from the perspective of a user of programs - Rust still seems about as safe as any other modern language - since I've seen no other modern (say, created in the past decade) compiled language segfault. Even the C segfaults seem to be largely becoming rare occurrences, which I have to chalk up to better tooling, because I highly doubt that there's been some magical increase in general C programmer quality in the intervening years.

[–] [email protected] 1 points 1 year ago (1 children)

Go, Java, and Nim (in most cases) are all memory safe but are generally slower than C or C++ due to the ways they achieve memory safety.

Rust's memory safety approach is zero-cost performance wise, which makes it practical for low level, high throughput, and low latency applications.

[–] [email protected] 1 points 1 year ago (1 children)

Everything is slower than C (I haven't seen a benchmark yet where a language bests C; even hand-crafted ASM ceded the high ground decades ago when compilers got better than human assembly programmers), but then, C compiler technology has had literally 40+ years to mature.

Go and Java (once warm) do pretty well, but absolutely give up execution speed for coding simplicity and (in Go's case, anyway) speed. Nim is young; I'm curious to see how it matures. They're having a bit of a performance crisis at the moment, but assuming they get past that it seems like a fair middle ground between Go's simplicity and Rust's bare-metal performance. Then again, manual memory management was absolutely my least favorite thing about C and is what eventually drove me away; worst. Boilerplate. Ever. Even worse than Go's error handling (which they almost fixed and looks like will be addressed within the next free releases). Anyhoo, going back to that shit is going to be a hard pill to swallow.

Rust is still having its honeymoon, and is the hip language of the decade now. We'll see!

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Rust is roughly similar to C in most of these benchmarks and beats it in a few: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/rust.html

Arguably when LLVM gets a bit better, Rust can be even faster than C because rust can be optimised in more places safely than C code can. The issue is that LLVM wasn't written with that in mind, so some performance is left on the table.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Yes, the problems rust is solving are already solved under different constraints. This is not a spicy take.

The world isn't clamoring to turn a go app into rust specifically for the memory safety they both enjoy.

Systems applications are still almost exclusively written in C & C++, and they absolutely do run into memory bugs. All the time. I work with C almost exclusively for my day job (with shell and rust interspersed), and while tried and tested C programs have far fewer memory bugs than when they were first made, that means the bugs you do find are by their nature more painful to diagnose. Eliminating a whole class of problems in-language is absolutely worth the hype.

[–] [email protected] 0 points 1 year ago (10 children)

Rust programmers vastly overestimate how many bugs are caused by memory problems

load more comments (10 replies)
load more comments (3 replies)
[–] [email protected] 7 points 1 year ago (2 children)

StackOverflow: Question closed as duplicate. Someone else already asked whether or not something is a nut.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago)

How long to hard-boil an egg?

Seriously, i just googled how much energy would be needed to put 1Kg in LEO. Ofc there's a StakOverflow to it asking the same question and none of 4 answers answer the question and one is like "This seems like a complicated way of doing it. Instead of asking the minimum energy...".

[–] [email protected] 1 points 1 year ago

"Question closed as duplicate"

The question it's a duplicate of: "How to programmatically prove a hotdog is a sandwich?"

[–] [email protected] 4 points 1 year ago

"What Java said."

Okay, that one made me chuckle.

[–] [email protected] 4 points 1 year ago

Excel: 12th of Nutuary 1970

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (1 children)

C# should actually be "What Java said, except it's ICrackable".

[–] [email protected] 1 points 1 year ago (1 children)

No, actually C#'s answer should be: "What Java said - hold on, what Python said sounds good too, and C++'s stuff is pretty cool too - let's go with all of the above."

C#, or as I like to call it "the Borg of programming languages".

[–] [email protected] 0 points 1 year ago (1 children)

I got my first software developer role last year and it was the first time I’d written C#, I was more TypeScript. Now we use both but I must say I really like C# now that I’m used to it.

[–] [email protected] 1 points 1 year ago

I think most programmers would like C# if they spent time with it. It is getting a bit complex because the joke about it over borrowing from other languages is on the money. It is a nice language though and pretty damn fast these days all things considered.

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (4 children)

C can STRUCTurise classes tho

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

Yeah, you can technically write object oriented code in C. Or any other language. Just that actual OOP languages provide a nicer syntax and compile time checks.

Rust is kind of a good example of this. It's technically not an object oriented language, but the trait system brings it close.

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

Stop this or I'm gonna find you and I'm gonna kill your dog

[–] [email protected] 0 points 1 year ago (1 children)

I want my vs code to look like this

load more comments (2 replies)
[–] [email protected] 2 points 1 year ago (1 children)

Java: "Sorry, but the developers of Peanut didn't declare it to implement the Crackable interface, even though it has all the relevant methods, so if you want to treat it like a nut your choices are write a wrapper class or call those methods using Reflections"

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

Swift’s extensions system has spoiled me, and I feel the pain of this whenever I have to write Java

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Ditto, but Rust's traits. God those are so fun. It's like duck typing a la Python but you can just slap whatever methods you want on a foreign type without worrying about breaking anything because they're only visible to the current crate (or other crates that import the Trait)

[–] [email protected] 1 points 1 year ago

You should take a look at kotlin, pretty similar to swift and fully interoperable with java.

[–] [email protected] 1 points 1 year ago (1 children)
[–] [email protected] 1 points 1 year ago

It's incompatible with the version of this meme

[–] [email protected] 0 points 1 year ago

Ruby: No, it has been redefined as the number 5 so buckle your seatbelts, kiddos, cuz shit's about to get wild!

[–] [email protected] 0 points 1 year ago (2 children)

All those memes picturing C++ as unsafe and unstable yet the server that serves these memes is running mostly C/C++ and has an uptime of months.

[–] [email protected] 1 points 1 year ago

Also they're always treating C++ like it's some arcane enterprise variant that uses 1990s C++

Using modern C++ you can write much cleaner, more usable, and really safe code

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

Lemmy is written in Rust. There might be bits of C at the periphery behind bindings.

load more comments (2 replies)
load more comments
view more: next ›