indent style for D

Stewart Gordon smjg_1998 at yahoo.com
Sun Jan 29 17:39:40 PST 2012


On 29/01/2012 19:26, Marco Leise wrote:
<snip>
> Then again "tabs for indentation only" is a simple rule, that would have turned the tabs
> into spaces in this example - if editors supported it.

But when alignment spaces begin at the beginning of the line, or immediately after the 
indentation tabs, they can easily be mistaken by editors for indentation and changed to 
tabs.  It depends on how intelligent the software is.

void qwert(int yuiop, string asdfg, immutable(int)[] hjkl,
            Object zxcvb)

Here, the lines of parameters are aligned.  However, a naive editor might mistake the 
alignment spaces for indentation spaces and turn them into tabs.

void qwert(int yuiop, string asdfg, immutable(int)[] hjkl,
	Object zxcvb)

Here, there is a fixed indentation.

But one possibility for editors is to work on the principle that it's an indentation 
tab/run of spaces iff the syntactic structure ({}, control statements with a single 
statement as body, possibility [] used for array initialisers) dictates that there should 
be an indentation tab there.  While not perfect, it would still IMO be better than the 
current mess many editors are in.

Stewart.


More information about the Digitalmars-d mailing list