On Monday, January 17, 2011 10:59:16 spir wrote: > On 01/17/2011 07:53 PM, Adam Ruppe wrote: > > It seems to me that you actually want two separate functions: > > > > repeat("abc", 3) => ["abc", "abc", "abc"] > > > > join(repeat("abc", 3)) => "abcabcabc" > > Would rather see: > > repeat("abc", 3) => ["abc", "abc", "abc"] > "abc" * 3 => "abcabcabc"
Considering that D add the ~ operator for concatenation because + was too ambiguous (e.g. what should "2" + "3" do?), there's no way that overloading * for a function in std.algorithm is going to fly. And since we're dealing with arbitrary range types - not just strings - it definitely isn't going to work. Not to mention, using an operator like that implies that it'sa basic and important operation. However, I'm not sure that I've ever had to use such an operation in my entire life. It needs a normal function, not an overloaded operator. - Jonathan M Davis