www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What difference between std.typecons.Tuple and std.meta.AliasSeq

reply Suliman <evermind live.ru> writes:
Sometimes it's hard to understand the D philosophy, for example 
now I can't understand diffrence between std.typecons.Tuple and 
std.meta.AliasSeq. I know that in language like Python there is 
spatial data type named tuple like:
tup1 = ('physics', 'chemistry', 1997, 2000);

But what in D? That was Tuples module, but it's look like it was 
renamed to 
http://forum.dlang.org/thread/mnhfhs$2b9o$1 digitalmars.com

But look like std.typecons.Tuple and std.meta.AliasSeq are 
exists. So I really can't understand what and how I should to use 
that's all.
Sep 20 2015
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
AliasSeq is just a random collection of stuff.

A Tuple is more like a struct.
Sep 20 2015
prev sibling parent reply Alex Parrill <initrd.gz gmail.com> writes:
On Sunday, 20 September 2015 at 18:10:49 UTC, Suliman wrote:
 Sometimes it's hard to understand the D philosophy, for example 
 now I can't understand diffrence between std.typecons.Tuple and 
 std.meta.AliasSeq. I know that in language like Python there is 
 spatial data type named tuple like:
 tup1 = ('physics', 'chemistry', 1997, 2000);

 But what in D? That was Tuples module, but it's look like it 
 was renamed to 
 http://forum.dlang.org/thread/mnhfhs$2b9o$1 digitalmars.com

 But look like std.typecons.Tuple and std.meta.AliasSeq are 
 exists. So I really can't understand what and how I should to 
 use that's all.
std.typecons.Tuple is more like Python's tuples. It effectively defines a struct with one field per type in the tuple definition, and only holds values. std.meta.AliasSeq (aka std.typetuple.TypeTuple) is a compile-time construct, used mostly with templates, and is more like a list. They can hold types, values, or symbol aliases, but only exist during compilation (though you can declare a variable using an AliasSeq containing only types; I think this acts like defining one variable for each type in the seq).
Sep 20 2015
parent John Colvin <john.loughran.colvin gmail.com> writes:
On Sunday, 20 September 2015 at 18:28:13 UTC, Alex Parrill wrote:
 (though you can declare a variable using an AliasSeq containing 
 only types; I think this acts like defining one variable for 
 each type in the seq).
This is what is used inside std.typecons.Tuple
Sep 20 2015