Naming convention in Phobos

%u wfunction at hotmail.com
Tue Mar 8 02:00:51 PST 2011


> I don't think I understand your reasoning.  Enum members can't
have names which are also keywords, hence enums should be
capitalised?  You could equally well use this argument for *all* D
symbols...

Yes, we could (and in fact, I'd advocate for a D version of C#'s @
symbol for marking keywords as identifiers).

However, the thing is that this happens _so_ often with enums that I
think it's worth making it an exception. As soon as you start to
write some sort of code that has to do anything remotely with
programming, you can say something like:

enum TypeCode
{
    int,
    long,
    bool
}

as those are the most logical choices (and thinking around them is a
bit difficult.) But you don't often really name a variable "int", so
it's not so much as an issue with variables as with enums IMHO.


More information about the Digitalmars-d mailing list