[phobos] Initial Phobos style guide proposal

Jacob Carlborg doob at me.com
Thu Mar 31 11:39:59 PDT 2011


On 31 mar 2011, at 19:30, Jonathan M Davis wrote:
> The current style used in Phobos is an underscore before the name. It's also 
> likely to be frequent that a member variable has a property which goes with 
> it, meaning that it _has_ to be named slightly differently. How much the exact 
> naming scheme matters though depends on how much consistency we want within 
> Phobos. It's _not_ part of the public API, so it's purely a matter of 
> consistency in coding style. If we don't care all that much in keeping all of 
> Phobos' internal stuff consistent in style, then this sort of rule isn't 
> necessary. If we want obe consistent though, a choice needs to be made, and 
> the underscore before is currently what's being used (it's also what I, 
> personally, prefer - as does Andrei, I believ). But really, the main question 
> is whether we _want_ to be this exacting about private names.

What about public members? Wouldn't it be a little inconsistent to have public members named with camel case and private members with a leading underscore or is that the whole point?

> I would love that and think that it would be a _big_ improvement, but there 
> are some folks (Andrei in particular) who seem to really not like code going 
> beyond 80 characters. I do know that there are other Phobos devs who _do_ want 
> longer line lengths though, so maybe we can change this. Where this really 
> gets to be a problem is with lines with several levels of indentation, and 
> trying to restrict the line length (particularly to something short like 80 
> characters) tends to encourage overly short and non-descriptive variable and 
> function names, which is _not_ good.

Can't everyone that likes to keep the horizontal length to 80 characters use word wrapping?

-- 
/Jacob Carlborg



More information about the phobos mailing list