Re: Re: Let's discuss enums!
| From: | Rowan Collins | Date: | Fri, 18 Sep 2015 20:59:47 +0000 |
| Subject: | Re: Re: Let's discuss enums! | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88357@lists.php.net to get a copy of this message | ||
On 18 September 2015 03:58:57 BST, Stephen Coakley <me@stephencoakley.com> wrote:
>On 09/17/2015 06:06 PM, Rowan Collins wrote:
>> member THURSDAY, FRIDAY, SATURDAY, SUNDAY; // don't force people
>to
>> write each entry on its own line; maybe even the "member" keyword is
>too
>> much?
>
>Member is even a little too much IMO. A comma-separated list syntax
>would be better, simply because its shorter and more similar to enum
>syntax on other languages.
The keyword just felt like it fitted better with the rest of the language, and made the list look
less like it's floating when there are other things in the braces (fields, methods, etc). But
as you say it's common in other languages to simply have a comma separated list at the start of
the declaration, before anything else.
I didn't want to get too bogged down in the syntax, though, more to gauge reaction to the
general direction, which can be summed up as "an enum is an immutable object, with an easily
available name but no other default properties, and a mechanism for decorating with additional
properties and methods as desired".
Regards,
--
Rowan Collins
[IMSoP]