A Discussion of Tuple Syntax

Dicebot public at dicebot.lv
Tue Aug 20 13:24:42 PDT 2013


On Tuesday, 20 August 2013 at 20:16:54 UTC, Andrei Alexandrescu 
wrote:
> On 8/20/13 6:57 AM, Dicebot wrote:
>> I am proposing something more radical. Deprecate _both_ 
>> TypeTuple and
>> Tuple. Clearly define the difference between built-in type 
>> tuple and
>> expression tuple (latter being instance of former).
>
> But that can't be the case.

Can you elaborate on this? I can only judge by observable 
behavior which clearly says that typeof(TypeTuple!(2, 3)) is 
TypeTuple!(int, int). And when you use variadic template argument 
syntax in functions, you use "T..." (which is a built-in type 
tuple) to declare arguments (which is built-in expression tuple). 
There are probably some inconsistencies in implementation but 
this is the observable behavior that can be declared official.

>> Preserve
>> auto-expansion.
>
> That would be problematic to say the least. (There have been a 
> few discussions in this group; I've come to think auto 
> expansion is fail.)

:O it is awesome! Stuff like foo(myStructInstance.tupleof) is 
very powerful tool for generic interfaces. Do you remember any 
keywords to look for to find those discussions? Ones I remember 
were mostly about auto-expansion _not_ happening in some 
reasonable places.


More information about the Digitalmars-d mailing list