Tuple/TypeTuple etc.

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Aug 16 13:21:18 PDT 2013


On Fri, Aug 16, 2013 at 03:35:40PM -0400, Jonathan M Davis wrote:
[...]
> Adding a syntax for TypeTuple, making TypeTuple redundant would be
> great, but Bearophile seems to be arguing that having some sort of
> tuple syntax would make it so that we don't need TypeTuple and Tuple,
> which is wrong, because they're different. If you're creating a new
> syntax in the language for one of them, you only get rid of the need
> for one of them in the library, not both.  The idea of a "universal
> tuple" (like Bearophile seems to be looking for) makes no sense given
> the differences between the built-in tuples and Tuple.
[...]

This is why I don't like the term "tuple". It's using a single word to
describe apples and oranges. It gives you the wrong idea that there's
some kind of underlying, unifying thing common to both, but there isn't!
We really need to start using different terms to refer to them,
otherwise the confusion will only continue.

If I could roll back time, I'd rename std.range.Tuple to
std.range.AnonStruct, because that's what it is -- an anonymous struct
that you put together on-the-spot by stringing a bunch of values
together. It has nothing to do with what DMD calls a "tuple" (except
that compile-time tuples, or CT-tuples, are used to implement it, but
that's an irrelevant implementational detail).

But I don't have a time machine, sad to say, and there's also precedent
for "tuple" in other languages in relation to what std.range.Tuple does,
so I'm expecting "tuple" will stick in this case.

Which leaves the compile-time thingies in need of a new, DIFFERENT name.
Ali's suggestion, SymbolTuple, is nice, but still has that dreaded
"tuple" in it, which still suggests some kind of conflation with
std.range.Tuple. I think we should avoid any name containing "tuple" for
these things. What about SymbolList? (maybe TypeList, but it's
misleading because it isn't restricted to types alone; plus I want to
avoid "sequence" in order to prevent the same confusion with
std.range.sequence).

Or maybe we should call them "tuplets" with a T (as in "quintuplet"). Or
"compile-time tuplets" (CT-tuplets), to distinguish them from Tuples.
The diminutive -t ending being a reference to the fact that they are
compile-time-only constructs, hence not "full-fledged Tuples".


T

-- 
Error: Keyboard not attached. Press F1 to continue. -- Yoon Ha Lee, CONLANG


More information about the Digitalmars-d mailing list