syntax sugar: std.path::buildPath instead of from!"std.path".buildPath
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 14 12:46:17 PST 2017
On 2/14/2017 8:25 AM, Andrei Alexandrescu wrote:
> Range remove
> (SwapStrategy s = SwapStrategy.stable, Range, Offset...)
> (Range range, Offset offset)
> if (s != SwapStrategy.stable
> && isBidirectionalRange!Range
> && hasLvalueElements!Range
> && hasLength!Range
> && Offset.length >= 1);
>
> The function name is on the first line.
It could be improved slightly using indentation:
Range remove
(SwapStrategy s = SwapStrategy.stable, Range, Offset...)
(Range range, Offset offset)
if (s != SwapStrategy.stable
&& isBidirectionalRange!Range
&& hasLvalueElements!Range
&& hasLength!Range
&& Offset.length >= 1);
But there's another issue here. remove() has other overloads:
Range remove
(SwapStrategy s = SwapStrategy.stable, Range, Offset...)
(Range range, Offset offset)
if (s == SwapStrategy.stable
&& isBidirectionalRange!Range
&& hasLvalueElements!Range
&& Offset.length >= 1)
Range remove(alias pred, SwapStrategy s = SwapStrategy.stable, Range)
(Range range)
if (isBidirectionalRange!Range
&& hasLvalueElements!Range)
Two constraints are common to all three, those are the only ones that actually
need to be in the constraint. The others can go in the body under `static if`,
as the user need not be concerned with them.
This is a general issue in Phobos that too many constraints are user-facing when
they don't need to be.
A further improvement in the documentation would be to add links to
isBidirectionalRange and hasLvalueElements.
More information about the Digitalmars-d
mailing list