[Rosettacode] D code line length limit

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 8 08:13:48 PDT 2014


On Thursday, 8 May 2014 at 14:34:27 UTC, H. S. Teoh via 
Digitalmars-d-learn wrote:
> FWIW, for very long function signatures I write it this way:
>
> 	const(T)[] myVeryLongFunction(T)(const(T)[] arr,
> 	                                 int        x,
> 	                                 int        y,
> 	                                 int        z,
> 	                                 ExtraArgs  extraArgs)
> 		pure @safe nothrow
> 		if (is(T : int) &&
> 		    someOtherLongCriteria!T &&
> 		    yetMoreVeryLongCriteria!T)
> 	{
> 		...
> 	}

I like this one with only exception that I prefer to keep 
parameter list to fill the line and always match brackets:

const(T)[] myVeryLongFunction(T)(const(T)[] arr,
     int x, int y, int z, ExtraArgs  extraArgs
)
     pure @safe nothrow
     if (is(T : int) &&
         someOtherLongCriteria!T &&
         yetMoreVeryLongCriteria!T
     )
{
}

for quick overview of parameters DDOC fits better IMHO


More information about the Digitalmars-d-learn mailing list