Notes on the Phobos style guide

bearophile bearophileHUGS at lycos.com
Mon Aug 16 15:59:14 PDT 2010


Jonathan M Davis:

> Obviously, in my own code, I'm just going to code the way that I like, and I see 
> no point in any kind of standard D style guide with regards to braces and other 
> visual elements to relate primarily to how the code looks rather than what it 
> does.

Often you need to modify legacy C/C++/Java code, or you need to work in a team, in such very common situations it's often better to follow some style standard.

And even if you write D code on your own, you are not truly alone, you are part of the D community of programmers. If you write a good module you may want to give it to the D community. Part of the success of Python comes from the ease to find free (as in beer) already written modules able to do almost everything that you can just add to your own programs, usually with little or no troubles.

So your Python program comes from the collection of many modules written by other people. So even if you are writing code on your own, it's a bit like your 'team' is the whole Python (and in future hopefully D2 too) community. This is why the uniform style of writing Python code is good for the development of the whole community. I think Walter has written the D style page (see below) because he has understood this some years ago.


> And I'm not aware of any official anything 
> anywhere that talks about what is and isn't considered good practice in D.

http://www.digitalmars.com/d/2.0/dstyle.html

Bye,
bearophile


More information about the Digitalmars-d mailing list