Name collision using std.regex and std.array / std.range

Tobias Pankrath tobias at pankrath.net
Sun Jul 24 09:46:06 PDT 2011


I needed a small script for a project of mine and hacked one in python. 
Since I want to learn some D, I tried to convert it. Took me a bit longer 
than I thought, because I got delayed by this lovely error message:

Error: template instance ambiguous template declaration 
std.array.replace(R1,R2,R3) if (isDynamicArray!(R1) && isForwardRange!(R2) 
&& isForwardRange!(R3) && (hasLength!(R3) || isSomeString!(R3))) and 
std.regex.replace(Range,Engine,String) if (is(Unqual!(Engine) == Regex!
(Unqual!(typeof(Range.init[0])))))

Took me a while do understand it, but it seems that I've got a name 
collision. What I don't understand is, why is the compiler unable to 
tell two functions, one with two parameter and one with three, apart?




More information about the Digitalmars-d-learn mailing list