Why does phobos have collisions?

Ivan Kazmenko via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 7 07:57:44 PDT 2017


On Wednesday, 7 June 2017 at 10:01:30 UTC, Mike B Johnson wrote:
> Error: template std.algorithm.mutation.strip cannot deduce 
> function from argument types !()(string), candidates are:
> src\phobos\std\algorithm\mutation.d(2280):        
> std.algorithm.mutation.strip(Range, E)(Range range, E element) 
> if (isBidirectionalRange!Range && is(typeof(range.front == 
> element) : bool))
> \src\phobos\std\algorithm\mutation.d(2287):        
> std.algorithm.mutation.strip(alias pred, Range)(Range range) if 
> (isBidirectionalRange!Range && is(typeof(pred(range.back)) : 
> bool))
>
> This is on a line of code that simply strips away a string...
>
> and works fine when using standard strip(without importing 
> std.algorithm)... but when importing std.algorithm too, those 
> errors pop up... seems like a defect.

Actually, it looks like the std.algorithm[.mutation] is imported 
but std.string isn't.
As std.algorithm's strip is more generic, it cannot assume what's 
the "whitespace" to be stripped, so it's not callable without 
explicitly specifying what to strip.

I've experienced this too, and it's really a bit confusing the 
first time it happens.

Ivan Kazmenko.



More information about the Digitalmars-d mailing list