from Hacker News

Go Enums Suck

by mikecarlton on 2/29/24, 12:52 PM with 2 comments

  • by quantified on 2/29/24, 1:37 PM

    I'm still acquiring the finer points of golang development. Why would the enum need to be based on an integer? Why not just make it a string? The type-safety of using any old string as an Operation value remains an issue. The other conversion issues seem to more or less disappear.

    When Oracle's patent on enums as objects expires, sufficiently motivated language designers can start to incorporate them. I doubt golang will get them.

  • by 0xjnml on 2/29/24, 4:42 PM

    Go enums cannot suck because Go has no enum types, full stop.