[phobos] Fwd: Tuple, TypeTuple, tupleof etc

Shin Fujishiro rsinfu at gmail.com
Mon Oct 4 14:08:26 PDT 2010


It's about the messy situation around tuple nomenclature in Phobos:

 - TypeTuple can contain values too
 - Tuple is different from TypeTuple
 - tupleof is not a Tuple but a TypeTuple consisting of values

Note also that "Tuple" has packed semantics and "TypeTuple" has
expanded semantics.  The two are really different in many aspects.
What to do with them?


Shin

On July 6, bearophile posted to the newsgroup:

> You have a "tupleof" struct attribute that gives a TypeTuple, and it
> can contain values too and not just types, and then you have a Tuple in
> Phobos that is something similar, but not exactly the same as, a
> TypeTuple. You can return a Tuple but not a TypeTuple. All this is
> messy, D newbies will have troubles. Having two slightly different
> kinds of tuples in a language is bad, but mixing their names in those
> ways is even worse.
> 
> In my dlibs1 what's called Tuple is named Record and what's named
> TypeTuple is named Tuple, this is better because a record is quite
> similar to a struct (as named in Pascal-like languages too), while a
> Tuple is named tuple in the language too.  The name "Record" is bad for
> this purpose because while it's structurally a struct, from an usage
> point of view it's more like a mathematical tuple.
> 
> In the end I still think "Record" and "Tuple" are better names, despite
> their faults. Please think of the newbies :-) Can those two names in
> Phobos2 be changed?

http://www.digitalmars.com/d/archives/digitalmars/D/Tuple_TypeTuple_tupleof_etc_113005.html


More information about the phobos mailing list