312
I love Rust (lemmy.blahaj.zone)
submitted 1 month ago by rustyfemboy to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] PeriodicallyPedantic@lemmy.ca 2 points 1 month ago

Why did you even bring up AI? IDEs have been able to generate equality functions for decades without AI.

It's kinda neat to have this defined directly in the language so that compilers can implement it, but creating equality function is so low effort that this doesn't really seem like a big deal.

Like, you define the members in a class, then you tell your IDE to generate getters, constructor, equals, hashcode, etc all in like 5 seconds.
I like it, it's nice when the language itself defines reasonable defaults for things, but realistically you're saving yourself a few seconds of effort.

[-] shy_mia 7 points 1 month ago

Yeah but if the class changes you need to update everything, you got all that boilerplate taking up space for no real reason, etc...

The Rust way's just a lot cleaner imo.

[-] PeriodicallyPedantic@lemmy.ca 1 points 1 month ago

It's like 5 seconds to regenerate it. Boilerplate doesn't matter, just collapse it. The only real issue is remembering to update it, if you make a change.

Like I said, I prefer for rust does it, it's just not a big deal

[-] words_number@programming.dev 4 points 1 month ago

Isn't it obvious? More code to skim, scroll over and maintain if something changes. If you add a struct field, your manual EQ implementation still compiles and seems to work but is wrong and will lead to bugs. Yes, solving this for 99,999% of cases with an attribute is just far superior and does make a difference (while keeping it easy to manually implement it if needed). Hash and Ord and some other traits can be implemented in a similar fashion btw..

[-] PeriodicallyPedantic@lemmy.ca 1 points 1 month ago

I said it was better, just not much better.

The maintenance costs of equals is nearly zero. Scrolling over boilerplate seems like a real stretch, like saying a novel with a picture every chapter is harder to read.

I like that you can't accidentally forget to update it, which is kinda nice but is rarely a concern.
And it's a bit more readable, which is nice.
It's better, but folks are talking like it's Super Jesus and I think it's more like finding a dollar in the parking lot.

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

Who said it was superjesus? It's one of the smaller points on the long list of rusts advantages over other systems level PLs, but nonetheless notable. Especially if you consider that the feature that makes this possible is used for a ton of other useful stuff. And seriously, the boilerplate does matter, especially if you also add Ord, Hash and Debug impls. Your comparison with pictures in a noval makes no sense, since these add something valuable to the text and are easily distinguished from it. Heaps of boilerplate at a glance look just as meaningful as important sections of code, so being able to avoid it makes navigation significantly easier.

[-] PeriodicallyPedantic@lemmy.ca 1 points 1 month ago

I know the image post was hyperbole, but the way y'all are gushing over it is borderline religious, in an unsettling way.

Immediately, you call boilerplate a Big Deal and identify yourself as a zealot. Even in Java, a notoriously verbose and boilerplate laden language, it's a Small Deal unless you're doing something insane. Let me guess, your coding in VI or something.

Rust looks great. It's a bunch of small improvements over most languages. But True Believers of any lang need to chill the fuck out.

[-] ReversalHatchery@beehaw.org 2 points 1 month ago* (last edited 1 month ago)

I thought you were thinking an AI based code generator klike copilot) does it, when you said the IDE does it.

username checks out /s

[-] PeriodicallyPedantic@lemmy.ca 2 points 1 month ago

Yeah, I picked that username for a reason 😭

this post was submitted on 15 Nov 2024
312 points (100.0% liked)

Programmer Humor

32715 readers
437 users here now

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

Rules:

founded 5 years ago
MODERATORS