enum and tuples

Jonathan M Davis jmdavisProg at gmx.com
Fri Aug 9 11:29:29 PDT 2013


On Friday, August 09, 2013 10:41:05 H. S. Teoh wrote:
> On Fri, Aug 09, 2013 at 09:36:16AM -0700, Ali Çehreli wrote:
> > On 08/08/2013 11:16 PM, captaindet wrote:> hi,
> > 
> > > i am still struggling getting to grips with tuples, especially
> > > typetuples.
> > 
> > Yes, especially TypeTuples. :)
> > 
> > > typetuples seem to live in a shadow world
> > 
> > My feelings! :)
> > 
> > Coincidentally, I am struggling with the same question at the moment
> > as I am in the process of revising and translating a Tuples chapter.
> > I got stuck just yesterday but I have not re-read Philippe Sigaud's
> > document yet.
> 
> [...]
> 
> According to my understanding (please correct me if I'm wrong), there
> are two *different* kinds of tuples, which may be the source of much of
> the confusion surrounding tuples.
[snip]
> Hope this helps! :)

I think that you have it at least mostly right, though I skimmed over most of 
it, so you might have a minor detail wrong somewhere.

The compiler's tuples (TypeTuples) are basically what template and function 
parameter and argument lists are. TypeTuple itself is then just an alias for 
them so that you can actually declare and refer to them directly. It's kind of 
a travesty that they're referred to as tuples, and I really wish that they'd 
stop being referred to as that, but Walter keeps using the term tuple for 
them. Personally, I just always call them TypeTuples (as bad as that name is), 
though technically TypeTuple is just the alias. Regardless, they're completely 
a compile-time construct, unlike std.typecons.Tuple, which is a real tuple 
type.

Really, the problem is the terminology used. It makes it all way more 
confusing than it should be.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list