indent style for D

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Jan 29 19:49:56 PST 2012


On Mon, Jan 30, 2012 at 03:35:03AM +0000, Iain Buclaw wrote:
> On 30 January 2012 03:27, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> > On Mon, Jan 30, 2012 at 01:57:43AM +0100, Timon Gehr wrote:
[...]
> >> - And when saving, it automatically formats the source code in the
> >> deduced format.
> >
> > The problem with autoformatting on save is that it interacts badly
> > with revision control systems. You could end up with lots of noisy
> > diffs mostly involving changes in whitespace. By enforcing a fixed
> > formatting, whether it's everything-on-a-line or delete all
> > unnecessary whitespace but leave newlines intact, you ensure that
> > diffs generated by the revision control system will not include
> > whitespace noise.
> >
> 
> The flip side is that if you put everything on one line, no one will
> be able to understand the commits you make. :)
[...]

Well, that's no fault of mine; it's a relic of holding on to
visually-formatted plaintext format. ;-)

If all code was auto-formatted, you won't have this kind of problem,
since the diff utility would compare syntax trees instead of lines, and
would show you what *actually* changed syntactically. As opposed to
diffs where inserting a new function with a similar body to the
following adjacent function causes the diff to be a messy interlacing of
lines from both functions, 'cos it's "shorter" than a diff which simply
inserts the new function. (Which happens a lot with code that has lots
of boilerplate. But boilerplates are another issue. :-))


T

-- 
My program has no bugs! Only unintentional features...


More information about the Digitalmars-d mailing list