this post was submitted on 21 Apr 2024
881 points (97.9% liked)

Programmer Humor

19564 readers
582 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 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] kevincox@lemmy.ml 64 points 6 months ago (2 children)

IDE is one thing, Go refuses to compile. Like calm down, I'm going to use it in a second. Just let me test the basics of my new method before I start using this variable.

Or every time you add or remove a printf it refuses to compile until you remove that unused import. Please just fuck off.

[–] FizzyOrange@programming.dev 16 points 6 months ago

Yeah I think it's trauma due to C/C++'s awful warning system, where you need a gazillion warnings for all the flaws in the language but because there are a gazillion of them and some are quite noisy and false positives prone, it's extremely common to ignore them. Even worse, even the deadly no-brainer ones (e.g. not returning something from a function that says it will) tend to be off by default, which means it is common to release code that triggers some warnings.

Finally C/C++ doesn't have a good packaging story so you'll pretty much always see warnings from third party code in your compilations, leading you to ignore warnings even more.

Based on that, it's very easy to see why the Go people said "no warnings!". An unused variable should definitely be at least a warning so they have no choice but to make it an error.

I think Rust has proven that it was the wrong decision though. When you have proper packaging support (as Go does), it's trivial to suppress warnings in third party code, and so people don't ignore warnings. Also it's a modern language so you don't need to warn for the mistakes the language made (like case fall through, octal literals) because hopefully you didn't make any (or at least as many).

[–] treechicken@lemmy.world 12 points 6 months ago* (last edited 6 months ago) (1 children)

VSCode with Go language support: removes unused variable on save "Fixed that compilation bug for ya, boss"

[–] kevincox@lemmy.ml 4 points 6 months ago (1 children)

Like actually deletes them from the working copy? Or just removes them in the code sent to the compiler but they still appear in the editor?

[–] FizzyOrange@programming.dev 17 points 6 months ago (1 children)

Yeah IIRC it deletes them, which is as mad as you would expect. Maybe they've fixed that since I used it last which was some years ago.

[–] jose1324@lemmy.world 4 points 6 months ago

Bruh that's insane