Thanks for the help to everyone. It seems a common thing to want to check an array as one may not know the variables at compile time. Not that it's more than a few lines to do in D. But in terms of language adoption, small frictions can have large consequences over time. (Modern people don't have much patience or sticking power even if viewed rationally the ROI makes these things trivial. That's also because in a corporate environment management are not always patient when somebody tries something new and not yet mainstream). Making the standard library easy with no sharp edges might have a high payoff over time.

How would one add this note about needing to pass a tuple not an array to the docs or wiki ? For docs, clone and submit a pull request? How about wiki?

On Monday, 12 January 2015 at 07:49:16 UTC, Mengu wrote:
On Saturday, 10 January 2015 at 23:32:47 UTC, bearophile wrote:
Laeeth Isharc:

In D there is a feature that allows a function to accept both an array of items and items,

yes - it is funny there is not an overloading that accepts arrays

I meant this D feature:


void foo(T)(T[] items...) {
   import std.stdio;
   items.writeln;
}
void main() {
   foo("red", "green", "blue");
   foo(["red", "green", "blue"]);
   auto a = ["red", "green", "blue"];
   foo(a);
}


Bye,
bearophile

for the curious, expanding tuples and typetuples on ali's book is explained at http://ddili.org/ders/d.en/tuples.html#ix_tuples..expand and at http://ddili.org/ders/d.en/tuples.html#ix_tuples.TypeTuple, std.typetuple.

Reply via email to