Inconsistent coding style in code examples

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 10 12:57:39 PST 2015


This PR:

	https://github.com/D-Programming-Language/phobos/pull/2973

introduces a code example with 2-space indentation, whereas the rest of
Phobos and dlang.org uses 4-space indentation.

I don't like this. It's inconsistent, and is detracting from the
professional look of D. It's bad enough that we are inconsistent from
one page to another, it's even worse that this PR introduces a style
inconsistency within a *single* doc page. It makes D look amateurish and
unprofessional.

Walter's reason for this is that 4-space indentation makes it look bad
on Kindle and other small-screen readers. Which is a good point, but it
shouldn't be reason for inconsistent code style throughout dlang.org.
If we decide that 4-space indentation is no good, then we should switch
*wholesale* to whatever it is we deem good. We should not be introducing
arbitrary style differences on an ad hoc basis.

So, what will it be? What coding style should we use for official
language docs? Should we use 4-space indentation or 2-space indentation?
Should we reduce the maximum line length in code samples so that they
don't look horribly on narrow-width readers? Or something else
altogether?

(Note also, that the code example in question is part of a ddoc'd
unittest, which means it is also inconsistent with the rest of Phobos
code. This is a smaller issue than inconsistency in public-facing docs,
but nonetheless, it's an annoying one.)


T

-- 
Любишь кататься - люби и саночки возить. 


More information about the Digitalmars-d mailing list