indent style for D

Iain Buclaw ibuclaw at ubuntu.com
Sun Jan 29 19:35:03 PST 2012


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:
>> More practical than requiring all source files to be saved without
>> formatting:
>>
>> - Upon opening a file, the editor looks for a style sheet in the
>> same directory. If there is no such style sheet, it automatically
>> deduces the style from the code, falling back to the local
>> preferences.
>>
>> - Then it acts as you propose.
>>
>> - 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. :)


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list