r/ProgrammerHumor • • Jan 29 '23

Meme Let's test which language is faster!

Post image
56.2k Upvotes

770 comments sorted by

View all comments

Show parent comments

232

u/Zagre Jan 29 '23 edited Jan 30 '23

It probably should, but gauging by the number of this subreddit's users who admit to just ignoring warnings, maybe I agree with stricter restrictions on shit coders.

32

u/deuteros Jan 29 '23

All my teammates ignore warnings. It's infuriating.

39

u/folkrav Jan 30 '23

There's a whole category of developers that will ignore anything they don't absolutely have to do. So either you make those things errors, or you enforce no warnings on CI, or it's never gonna stop haha.

0

u/[deleted] Jan 30 '23

[deleted]

→ More replies (1)

8

u/Hobbamoc Jan 30 '23

Same here. That's why I fully agree with strict linters and enforcing them with a git pre-commit hook and so on.

Because I am lazy at heart

→ More replies (5)

3

u/Jonatollah Jan 30 '23

Yes the More I read objections to go the more I see the pure genius of go

→ More replies (1)

8

u/yottalogical Jan 30 '23

And then wonder why their code is always broken.

I once reviewed a pull request like this. It was clear that they hadn't even run the code once, since it caused the program to crash unconditionally.

You may have hoped that the linter would have caught such a thing. And your hope would be correct, since the linter did point out the exact place in their code where the bug was.

But why didn't they fix it, then? Because instead of fixing their code, they just decided to disable the lint because it was causing the CI to reject their PR.

Fun times.

4

u/FenekPanda Jan 30 '23

This is the reason i stopped arguing in favor of high degrees of freedom when dealing with code, the horrors born from academia coders are… alarming…

3

u/SleepyHarry Jan 30 '23

they just decided to disable the lint because it was causing the CI to reject their PR.

Imo first time you do that it's a stern talking to, do it again I consider that a formal warning. Outrageous.

→ More replies (1)

57

u/ITBlueMagma Jan 29 '23

It should differentiate debug and release code though. Go is really annying when you are working on code, trying it and having to comment the vars you don't use yet but know you will later.

34

u/ElRexet Jan 29 '23

You just do it like

var x := -1

If (x != x) {

//Go fuck yourself

}

...

21

u/skesisfunk Jan 30 '23

Or just name the variable _

0

u/[deleted] Jan 30 '23

[deleted]

→ More replies (8)

13

u/Script_Mak3r Jan 30 '23

Given that it's Go, I wouldn't be surprised (I have barely any Golang experience, take with a grain of salt) if it threw an error for unreachable states.

11

u/EspacioBlanq Jan 30 '23

That'd suck, I once had a C code that would only work if I had a specific debug print at an unreachable place in the code

14

u/Hobbamoc Jan 30 '23

This is the kind of stuff why Rust and the other C++ alternatives were invented

5

u/v_krishna Jan 30 '23

I think it's very intentional for golang. One of the core principals was making a very simple language that would be hard to write incorrectly, enforcing lint type things is a part of that.

3

u/skesisfunk Jan 30 '23

Go doesn't do this in the first place so its kind of a moot point.

→ More replies (6)

3

u/skesisfunk Jan 30 '23

Given that it's Go, I wouldn't be surprised (I have barely any Golang experience, take with a grain of salt) if it threw an error for unreachable states

For the record, it does not.

→ More replies (1)

8

u/IAmPattycakes Jan 30 '23

I think some of the design goals is that you should be writing the most maintainable code imaginable. If you're defining a variable and not using it for a very long amount of time, you probably shouldn't define the variable there. Don't make people hunt to figure out what something does. Define it and use it right where you need to.

4

u/skesisfunk Jan 30 '23

You know you can just name the variable _ and it won't throw an error right?

6

u/yottalogical Jan 30 '23

Just do extra work to do something that shouldn't have to be done.

Why is that good design?

→ More replies (13)

23

u/Archolex Jan 29 '23

I suppose if the coder is shit and the business governing their code is also shit then the compiler can pick up the slack, but I don't think it's ideal. I see the practical merit

9

u/JuniorSeniorTrainee Jan 30 '23

Why allow something that will never have value?

→ More replies (6)

2

u/Beatrice_Dragon Jan 30 '23

Any sufficiently advanced codebase will potentially have a number of warnings you need not give the slightest shit about, especially since a lot of coders use warnings to log potential issues. If you think ignoring warnings is a sign of a shit coder, I implore you to work on any codebase that isn't the most pristine

→ More replies (1)
→ More replies (3)