std.range: Order of arguments unluckily chosen?

KennyTM~ kennytm at gmail.com
Mon Jun 6 09:20:30 PDT 2011


On Jun 5, 11 06:55, Andrei Alexandrescu wrote:
> Well this hurts. With the same in mind as you, I initially defined take
> to take the number first. But OO people wanted to write array.take(3),
> so I changed the order. Don't forget that UFCS is still on the table.
>
> Impossible to please everybody!
>
> I don't know what to do to improve the situation.
>
>
> Andrei

You could provide an overload?

   Take!R take(R)(size_t n, R input) if (!is(Unqual!R : size_t)) {
     return take(input, n);
   }

Like PHP's implode() ;).


More information about the Digitalmars-d mailing list