Wait, what? What is AliasSeq?

via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 10 01:37:54 PDT 2015


On Thursday, 9 July 2015 at 19:10:39 UTC, Jonathan M Davis wrote:
> On Thursday, 9 July 2015 at 18:45:56 UTC, Marc Schütz wrote:
>> Interestingly, it goes on by saying:
>>
>>> An n-tuple is defined inductively using the construction
>>> of an ordered pair.
>>
>> Although not stated explicitly, this implies (a kind of) auto 
>> expanding!
>> => Fits more than perfectly :-P
>
> No one who has ever seriously used tuples in any programming 
> language I've ever heard of would expect tuples to auto expand. 
> Auto expansion makes them _considerably_ less useful. In the 
> case of TypeTuple/AliasSeq, the situation is a bit different, 
> because we're not really talking about tuples here. Real tuples 
> nest, and they don't auto expand.

But my quote above that they _don't_ nest and _do_ auto-expand, 
how else could you construct n-tuples from pairs?

> TypeTuple/AliasSeq is the _only_ case I've ever seen where 
> someone tried to claim that something was a tuple when it 
> didn't nest, or it auto-expanded. Folks have been consistently 
> confused about the differences between TypeTuple and 
> std.typecons.Tuple and the fact that TypeTuples auto expand. No 
> one expects it - because tuples just don't do that in any 
> actual programming languages. I question the validity of your 
> interpretation of the theory as well, but even if it's valid, 
> it doesn't match what's done in actual programming languages.

I personally think this auto-expanding argument is overrated. I 
don't have any particular expectation regarding auto-expansion 
towards the concept "tuple". Sure, it may be surprising, but that 
doesn't stop an auto expanding tuple from being a tuple, just 
like Perl arrays being auto-expanding doesn't stop them from 
being arrays.


More information about the Digitalmars-d mailing list