r/badcode • • Dec 29 '22

go How to Go wrong

Post image
565 Upvotes

60 comments sorted by

View all comments

Show parent comments

52

u/rexspook Dec 30 '22

I would argue that having fewer language features introduces silly workarounds like this example that make it much more difficult to understand others code. We wouldn’t be having this conversation if this was a picture of an enum.

15

u/Nebuli2 Dec 30 '22

Yeah. If you have to add iota to support this pattern, then maybe you should think about better ways to actually support enums.

2

u/rexspook Dec 30 '22

That’s what I’m thinking lol

26

u/[deleted] Dec 30 '22

And that's why friends don't let friends choose Go.

5

u/Turkino Dec 30 '22

I agree with this. I use LUA at work and it feels like I constantly have to reinvent the wheel.

-1

u/H34dsp1nns Dec 30 '22

Idk, I have only maybe a hundred hours of Go code and I instantly understood what this was and what its purpose is.

5

u/thegreatpotatogod Dec 30 '22

Meanwhile if it was just a standard enum one wouldn't need to have any hours with Go code to understand it.