DStyle: Braces on same line

Joseph Rushton Wakeling via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 13 09:45:04 PDT 2014


On 13/07/14 16:52, H. S. Teoh via Digitalmars-d-learn wrote:
> I had my own style before, but after I started contributing to Phobos, I
> found it a pain to keep switching back and forth between styles (and to
> convert styles before submitting PR's), so eventually I decided to just
> adopt Phobos style for all my D code, including my personal projects.
> That way I never have to worry again about which project is in what
> style, but everything is consistently the same style.

Same here. :-)

> It also helps that my previous supervisor at my work also used a similar
> style, which was different from my own, so I already had to adapt my
> style to his in the past. That was what convinced me that other inferior
> styles than my own had any merit at all. ;-)

Two consequences of adapting myself to Phobos style were that I realized (i)how 
little most of these things really matter, and (ii) pretty much any stylistic 
choice carries both benefits and drawbacks.

E.g. in this case, "Egyptian"-style braces definitely make your code more 
compact, but separate-line opening braces definitely make it easier to see where 
scopes begin and end.



More information about the Digitalmars-d-learn mailing list