Re: Let's discuss enums!
| From: | Rowan Collins | Date: | Fri, 18 Sep 2015 14:48:24 +0000 |
| Subject: | Re: Let's discuss enums! | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88329@lists.php.net to get a copy of this message | ||
Bob Weinand wrote on 18/09/2015 15:23:
Well, I think we should*either* have an ordinal*or* a name. But not both. Currently, after thinking about it, I'm in favor of just a name. And no ordinal. Having both is, I think, unnecessary.Yeah, that was my instinct. It's a bit like surrogate keys on database tables - if your table has a natural Primary Key, there's no need to add an auto-increment field. :) And the name kind of has to exist anyway, or you can't reference the enum value at all. You could make it inaccessible, but then not being able to get a string representation for debugging, or to do a dynamic Weekdays::getByName($_GET['day']), would be annoying. Regards, -- Rowan Collins [IMSoP]