syntax sugar: std.path::buildPath instead of from!"std.path".buildPath

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 14 16:34:02 PST 2017


On Tue, 14 Feb 2017 21:33:00 +0000, Lurker wrote:

> On Tuesday, 14 February 2017 at 16:25:17 UTC, 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);
>>
>>
> Range remove (SwapStrategy s = SwapStrategy.stable, Range, Offset...)
> (Range range, Offset offset)
> if CanRemove!(s, range, offset);

Which adds another layer to determine what sort of arguments the thing 
requires. Fewer layers is better.

In the past, I tried to track down compilation errors in Phobos (due to my 
changes) relating to, I think, template overload selection in std.conv 
based on template constraints. It was hell. Multiple layers with `static 
if (__traits(compiles))` interspersed.

I'm not too keen on template constraints in general. If you need them, 
keep them short and keep the entire definition in one place.

>> The function name is on the first line. I think 10 seconds would be an
>> exaggeration of an admittedly real issue.
>>
>>
> Thought so, too, but then I *did* spend 10 seconds trying to find it
> myself!

Does your editor not have syntax highlighting? For me, I just look 
immediately below the giant block of blue comment text and check the 
second word in the line below.


More information about the Digitalmars-d mailing list