digitalmars.D - Tuple, TypeTuple, tupleof etc
- bearophile (5/5) Jul 06 2010 You have a "tupleof" struct attribute that gives a TypeTuple, and it can...
- retard (6/24) Jul 10 2010 I'm afraid the tuple thing won't change anymore. The topic is a bit
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
Jul 06 2010
Tue, 06 Jul 2010 16:58:05 -0400, bearophile wrote: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?I'm afraid the tuple thing won't change anymore. The topic is a bit inflammable in any case. To begin with, the tupleof doesn't even necessary return well-typed tuples. And even though $ strings /path/to/bin/dmd |grep -i tuple returns matches, they say D doesn't have built-in tuples.
Jul 10 2010