Jonathan M Davis:

startsWith dosen't take an array of needles. It takes a variadic list of them.

All the argument after the first of startsWith could be required to be of the same type, for this D offers:

void foo(T)(T[] items...) {}
void main() {
    foo(1);
    foo(1, 2);
    foo(1, 2, 3);
    foo([1]);
    foo([1, 2]);
    foo([1, 2, 3]);
}


Isn't it better to modify startsWith a little like this?

Bye,
bearophile

Reply via email to