Inconsistent coding style in code examples

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 10 13:35:55 PST 2015


On 2/10/15 1:20 PM, Walter Bright wrote:
> On 2/10/2015 12:57 PM, H. S. Teoh via Digitalmars-d wrote:
>> Walter's reason for this is that 4-space indentation makes it look bad
>> on Kindle and other small-screen readers.
>
> My Kindle 3 has a 37 character screen width when using a monospace font
> (i.e. code font). Trying to read code formatted to 80 columns on it is
> just awful. While I don't expect anyone to read Phobos source code on a
> Kindle, I do expect the ereader version of the documentation to be read
> on the Kindle (or phone or whatever ereader).
>
> Vertical space is also far more important on the small screen.
>
> Having a different whitespace convention for documentation makes sense.
>
> (Such constraints also come in to play when writing books and articles.)
>
> At one point I had done this for all the examples in the D language
> spec, but I've never done it for the Phobos docs.

It's a good reason (e.g. TDPL uses 3 spaces throughout). We just can't 
start doing it randomly in one unrelated diff. -- Andrei


More information about the Digitalmars-d mailing list