Review of std.net.isemail part 2

Jonathan M Davis jmdavisProg at gmx.com
Wed Mar 30 10:23:25 PDT 2011


On 2011-03-30 04:23, Don wrote:
> Jonathan M Davis wrote:
> > On 2011-03-30 01:27, Jacob Carlborg wrote:
> >> On 3/30/11 1:30 AM, Jesse Phillips wrote:
> >>> Jacob Carlborg Wrote:
> >>>> I've made a few minor changes:
> >>>> 
> >>>> * Renamed EmailStatusCode.Off ->  None and On ->  Any
> >>>> * Added and clarified the documentation for EmailStatusCode.Any and
> >>>> None * Updated the documentation
> >>>> 
> >>>> Github: https://github.com/jacob-carlborg/phobos/tree/isemail
> >>>> Docs: http://dl.dropbox.com/u/18386187/isemail.html
> >>>> 
> >>>> --
> >>>> /Jacob Carlborg
> >>> 
> >>> I believe enum values are to be named lowercase first.
> >>> EmailStatusCode.any
> >> 
> >> I don't know what the style guide says about enum members but if that's
> >> the case I'll change the names to begin with lowercase.
> > 
> > All names are camelcased.
> 
> That's not true. ALLCAPS is relatively common in Phobos.
> There is absolutely no way PI is going to become pi.
> 
> > All type names begin with an uppercase letter, and
> > all variables begin with a lowercase letter (with the possible exception
> > of private member variables beginning with _ - but what's private to a
> > class or struct isn't as critical as the public API regardless).
> 
> That part is clear.
> 
>  > enum values fall in the same camp as variables.
> 
> I never heard that before, and it doesn't seem to be true throughout
> Phobos. Grepping for all enum declarations (there isn't very many of
> them actually), I found some which were like that, some which start with
> uppercase, and some which are all caps.
> 
> I think you're assuming more concensus on style than has ever actually
> been discussed.

I'd have to go digging through the mailing list to find posts on it, but 
Andrei made it clear that that was what was the intended naming convention and 
pretty much all of the newer stuff in Phobos follows that convention. Older 
stuff definitely doesn't follow that convention, but the newer stuff does. In 
particular, all caps was viewed as bad for enums because of how often they get 
used in D, and having variables which are all caps used frequently is 
ugly/annoying. I don't think that there was a huge discussion about it, and I 
believe that the push for the style I described came primarily from Andrei, 
but what discussion that there was agreed on treating enum values identically 
to normal variables as far as their naming coventions go. And all of the newer 
stuff follows that convention. And since you have to use the enum's name with 
all of the enum values anyway, it's not like you need a drastic difference in 
naming to distinguish enums other than manifest constants.

- Jonathan M Davis


More information about the Digitalmars-d mailing list