this post was submitted on 14 Aug 2023
1321 points (98.0% liked)

Programmer Humor

25253 readers
812 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] HiddenLayer5@lemmy.ml 74 points 2 years ago* (last edited 2 years ago) (11 children)

Sometimes I think Go was specifically made for Google to dictate its own preferences on the rest of us like some kind of power play. It enforces one single style of programming too much.

[–] philm@programming.dev 17 points 2 years ago (5 children)

Is this a hard error? Like it doesn't compile at all?

Isn't there something like #[allow(unused)] in Rust you can put over the declaration?

[–] flame3244@lemmy.world 27 points 2 years ago (2 children)

Yes it is a hard error and Go does not compile then. You can do _ = foobar to fake variable usage. I think this is okay for testing purposes.

[–] nomadjoanne@lemmy.world 6 points 2 years ago (1 children)

Ew, that's awful. Go is not one of my programming languages but I had always held it in high esteem because Ken Thompson and Rob Pike were involved in it.

[–] flame3244@lemmy.world 1 points 2 years ago

Honestly, it does not happen often that I have a ln unused variable that I want to keep. In my mind it is the same thing when wanting to call a function that does not exists. Also my editor is highlighting error Long before I try to compile, so this is fine too for me.

[–] AstridWipenaugh@lemmy.world 5 points 2 years ago* (last edited 2 years ago)

The underscore is used in production code too. It's a legitimate way to tell the compiler to discard the object because you don't intend to use the pointer/value.

load more comments (2 replies)
load more comments (7 replies)