Currently enums values don't have to begin with a capital. Namespaces, Classes, members, Enums names, etc must have the correct casing to avoid collisions, and Enum values wont collide with anything because they are in the scope of their enums name, but I think for...
1/ ensuring that it doesn't look like a shared member access, and
2/ enforcing consistency in naming
...they should be required to start with a capital, and since they are capitalized for use from other languages anyway, and stringified that way, they might as well be inside Cobra.
Currently Xxxx.yyyy could be an enum Xxxx with value yyyy, or it could be a class Xxxx with a shared member yyyy.
Forums
Capitization of enums values.
2 posts
• Page 1 of 1
Re: Capitization of enums values.
nevdelap wrote:Currently Xxxx.yyyy could be an enum Xxxx with value yyyy, or it could be a class Xxxx with a shared member yyyy.
Yeah, but is that a bad thing? You could change one to the other and not have to edit your code. In fact, I was thinking about this when I allowed the lower case.
But I do hear your other points. And this is different than other declarations which dictate lower or upper. Another interesting idea, if capitalization is required, is to allow a bare enum value where one is expected:
if color == Red, print 'Stop!'
Any opinions from anyone else on requiring enum members to be capped? If we made that change, a -legacy-lower-enum-members option would be provided for existing code bases.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 89 guests