indent style for D

Timon Gehr timon.gehr at gmx.ch
Sun Jan 29 13:05:55 PST 2012


On 01/29/2012 06:52 PM, Sean Cavanaugh wrote:
> On 1/29/2012 5:36 AM, Trass3r wrote:
>>> http://www.d-programming-language.org/dstyle.html in regard to
>>> indent-style, can someone shed some light what is recommended practice
>>> for it within D community?
>>
>> Everyone thinks his way is the best.
>
> Thats because it is :)
>
>
>
> curley braces on the same line as conditionals is a refactoring landmine
> IMO
>
> I've never seen an editor that would enforce only leading characters on
> a line as tabs,

makefile-mode in GNU emacs highlights leading spaces and points out 
their existence on saving. But that is not the right behavior for all 
languages:

void main(){
\t  auto x = ["abcd",
\t  .........."defg",
\t  .......... ...
\t  .........];
}

> and until all of them do it, spaces is the only thing
> that makes sense to me, since they are never 'wrong'.
>

You mean invisibly wrong for some tab-settings.

void main(){
.int i;
..int j = 2;
...for(;i<j;i++){}
....return 0;
}

> The codebase I use at work is full of tabs and I can tolerate them, but
> not knowing how many times to hit backspace on some chunk of code
> containing whitespace in the middle of it is really annoying. Yes there
> is undo but it starts infringing on my flow (replacing zen with anger,
> the emperor would be pleased . . .)
>

That is an editor-specific problem. In my editor, hitting backspace 
always deletes one character (and converts the remaining portion of a 
tab to spaces).


More information about the Digitalmars-d mailing list