3 ms·
The complexity they brush under the rug is dangerous and has rough edge cases that have caused real damage in applications I and others have worked on. I'm tryi
by WorldMaker 2y ago
The complexity they brush under the rug is dangerous and has rough edge cases that have caused real damage in applications I and others have worked on. I'm trying to warn these others that think enums "greatly simplify" things that they don't really simplify things, especially by how much they can hurt. The modern alternatives are all just as simple, but far more reliable. Believe me or not, it is still a fair warning that enums aren't the syntactic "sugar" that they appear to be, they aren't as sweet as they look, and you may get a "salty" surprise (apologies if that sounds more vulgar than intended due to slang overloading) if you keep using them. You don't have to trust my warning on it (or any of the others in this and nearby threads), but that doesn't make it not worth making the warning and suggesting alternatives.
Yes, I've got eslint errors turned on disallowing any use of enums at this point, because I see it as a code smell/risk, but that doesn't mean I'm going to take away the feature from your codebase, that's up to you and your judgment.