Wait, what? What is AliasSeq?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 23 08:48:57 PDT 2015


On Thursday, 23 July 2015 at 15:03:24 UTC, Timon Gehr wrote:
> On 07/23/2015 10:42 AM, deadalnix wrote:
>> On Wednesday, 22 July 2015 at 04:44:48 UTC, Timon Gehr wrote:
>>> On 07/22/2015 12:53 AM, deadalnix wrote:
>>>> On Tuesday, 21 July 2015 at 21:26:24 UTC, Daniel N wrote:
>>>>> On Tuesday, 21 July 2015 at 16:54:54 UTC, H. S. Teoh wrote:
>>>>>>
>>>>>> Because, among other things, it auto-expands.
>>>>>>
>>>>>>
>>>>>> T
>>>>>
>>>>> 1) .tupleof auto-expands and changing it at this point 
>>>>> would cause
>>>>> epic breakage.(I also see no reason to.)
>>>>>
>>>>
>>>> This is actually a very good point. First of, tupleof does 
>>>> not return a
>>>> TypeTuple, but they have something similar in nature.
>>>
>>> What's the difference? There shouldn't be any.
>>
>> You can't put runtime values into the first one, you can into 
>> the second
>> one.
>
> It should be just a bunch of aliases to the field members, 
> which have runtime values.
>
> Anyway, I figured out the difference:
>
> alias Seq(T...)=T;
>
> void main(){
>     struct S{ int x,y,z; }
>     S s;
>     alias a=s.tupleof; // error
>     alias b=Seq!(s.x,s.y,s.z); // ok
>     alias c=Seq!(s.tupleof); // ok
>     typeof(s.tupleof) x;
>     alias d=x; // ok
> }
>
>
> Wtf.

That definitely makes it seem like they _should_ be the same, 
though they clearly aren't. That may just be part of the issues 
related to alias not being consistent that David was bringing up 
before though. Regardless, I'm inclined to agree that what 
tupleof gives you should just be a TypeTuple/AliasSeq/whatever, 
though it would be nice to rename it once we actually settle on a 
name for the library construct.

- Jonathan M Davis


More information about the Digitalmars-d mailing list