Hacker News new | past | comments | ask | show | jobs | submit login

> I do agree go's enums suck

There's not much more you can do with them. A enumeration is literally assigning a number to something. That is all. Enums suck, fundamentally.

Other language features, like value constraints, can help improve the experience of using enums, but, really, if we are inventing a language, why have enums at all? If you think you have a use case for enums, a more advanced type system will offer a better model for your problem.

Sure, enums were a clever hack in the days of yore when we didn't have a good grasp of type theory, but are pointless in a modern language. Of course, Go is purposefully trying to be a language of yore, so it stands to reason that it would have them and all the suckiness that goes along with it, but, again, if we want it to be a modern language then you don't need to hack on top of enums with new features to make them nicer. You can get rid of them entirely.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: