Hacker News new | ask | show | jobs
by jdvh 1590 days ago
My approach is really pragmatic. You're unlikely to mix enums that have nothing to do with each other. The only issue in those enums that you could possibly get mixed up. For those you can just use non-overlapping integers for the values. It also makes debugging easier "over the wire", because you're probably not encoding the enums as strings. There is really no reason to have all enums map to the same handful of integers. If you don't do that, it just works.