indent style for D
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jan 29 14:32:48 PST 2012
On Sunday, January 29, 2012 14:27:29 H. S. Teoh wrote:
> On Sun, Jan 29, 2012 at 05:33:39PM +0000, Russel Winder wrote:
> > On Sun, 2012-01-29 at 09:17 -0500, bearophile wrote:
> [...]
>
> > > D2 style guide should *require* D2 to be edited using a mono-spaced
> > > font, and the D2 front-end should enforce this with a "-ms" compiler
> > > switch.
> >
> > Surely this is a level of fascism too far (*). Using monospace fonts is
> > just so 1960s, the era of typewriters and 80x25 terminals.
>
> I always code with tab stops set to 8 and line wrapping set to 80
> columns.
That's not going to work very well with D. You tend to get far too many levels
of indentation for that to fly. With static if (and potentiall multiple layers
of static if), classes, templates, etc. all on top of the normal if statements
and while loops and the like, and it can very quickly reach 3 - 4 indentation
levels on simple code, let alone what more complex code has. It's that much
worse when you use much in the way of functional-style programming and chain
function calls, since then not are the lines indented a fair ways, but they
tend to get long. I suspect that you'll find 8 character tabs and 80 character
columns to be a frustrating combination, but you can do whatever you want.
Phobos uses 4 character tabs with a soft limit of 80 characters (on average, a
line should fit within 80 characters, but it doesn't have to) and a hard limit
of 120 characters (a line should _never_ exceed 120 characters). And that
seems to be working fairly well for us.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list