Tuples

Jonathan M Davis jmdavisProg at gmx.com
Sun May 26 17:25:49 PDT 2013


On Sunday, May 26, 2013 22:38:24 Diggory wrote:
> On Sunday, 26 May 2013 at 15:48:00 UTC, Russel Winder wrote:
> > I wonder if people coming to D, looking for information about
> > tuples,
> > will get confused by http://dlang.org/tuple.html which seems to
> > tell
> > people they have to "roll their own", and
> > http://dlang.org/phobos/std_typecons.html which tells people
> > they have
> > been pre-rolled in the standard library?
> 
> I found this especially confusing because the built-in Tuple is
> defined differently.
> 
> The Tuple in that example is equivalent to the definition of
> TypeTuple, and yet TypeTuple is supposedly specific to types
> while that example (as so by implication TypeTuple) apparently
> works just as well with other contents.
> 
> On top of that Tuple is the one that only works with types - any
> string expressions are extracted and used as names... Surely a
> tuple which can only store types should be a TypeTyple and a
> tuple which can store anything should be a Tuple.

I really wish that the term tuple didn't get used with the built-in tuples / 
TypeTuples. They _aren't_ tuples. They're similar, but they don't nest, and 
they cause a lot of confusion with std.typecons.Tuple. And they're only 
compile-time constructs to boot.

- Jonathan M Davis


More information about the Digitalmars-d mailing list