logoalt Hacker News

TZubiriyesterday at 1:32 PM1 replyview on HN

"Enum to string"

We've come full circle huh?

Why do you need this, logging? In that case I would rather reflect the logging statement to pribt any variable name, or hell, just write out the string.

If saving for db, maybe store as string, there's more incentive for an enum in the db, if that's a string you might as well. At any rate it doesn't seem a great idea to depend on a variable name, imagine changing a variable name and stuff breaks.


Replies

SuperV1234yesterday at 2:51 PM

Logging, debugging, auto-generation of UIs/editors, etc... This is an extremely common operation and for a good reason.