News for hackers. Stuff that matters.
Re:Ask HN: Go programming language is over ten years old. Wh... by TopInvestor on Sunday October 25, 2020 @08:21PM (#24891475)
I made this playground: https://play.golang.org/p/S1Yh0Oq24q-

There are a ways to do unique enums with implicit repetition. Like this: I 0 1 2 II 101 102 103 III 201 202 203 IV 10 20 40 80

Re:Ask HN: Go programming language is over ten years old. Wh... by cy_hauser on Monday October 26, 2020 @08:38AM (#24895461)
Yes and no. Most of the time my enums are well defined: ContactStatus, AwardLevel, JugeStatus, for example. I have not control over the names or values and all have a "Revoked" value. When they come in from an external system it's pretty easy to parse them and convert them to the wrong type if someone isn't paying close attention. Then they don't get caught for a week or so because the code compiles, runs, and appears to work correctly except for these occasional odd results.