On Wednesday, 18 June 2014 at 21:58:48 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
Sent: Wednesday, June 18, 2014 at 11:02 PM
From: "Brad Anderson via Digitalmars-d-learn"
<digitalmars-d-learn@puremagic.com>
To: digitalmars-d-learn@puremagic.com
Subject: Re: '!' and naming conventions
There is a style guide on the website:
http://dlang.org/dstyle.html
Personally I just consider this a Phobos contributor style
guide and not like a PEP8 style guideline.
It was written with the hope that it would be generally
followed by the D
community, and that's part of the reason that it specifically
focuses on the
API and not the formatting of the code itself. So, ideally,
most D projects
would follow it (particularly if they're being distributed
publicly) so that
we have consistency across the community (particularly with
regards to how
things are captitalized and whatnot), but by no means is it
required that
every D project follow it. It's up to every developer to choose
how they want
to go about writing their APIs. We're not fascists and don't
require that all
code out there be formatted in a specific way or that all APIs
follow exact
naming rules (we couldn't enforce that anyway). But still, I
would hope that
most public D librares would follow the naming guidelines in
the D style
guide.
Now, for Phobos, it's required, and there are even a couple of
formatting
rules added to the end specifically for Phobos, but outside of
official D
projects, it's up to the developers of those projects to choose
what they want
to do.
- Jonathan M Davis
I think it's a pretty good basic style guide overall and I follow
it quite a bit, mostly due to coincidence (it overlaps with my
own style I've developed over the years quite a bit). Really, the
main thing I do differently is I use all lowercase, underscored
names for variables instead of camelcasing. I don't care for the
look of camelcase so I only use it for globals and other
infrequently used things where I want it to stand out a bit from
my regular variables.
What we really need is a D Idiom Guide but that's a much more
difficult and controversial subject.