Tuple, TypeTuple, tupleof etc

bearophile bearophileHUGS at lycos.com
Tue Jul 6 13:58:05 PDT 2010


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?

Bye,
bearophile


More information about the Digitalmars-d mailing list