Thread overview
AliasSeq can contain template identifier too?
Dec 12, 2015
Shriramana Sharma
Dec 12, 2015
Mike Parker
Dec 13, 2015
Ali Çehreli
December 12, 2015
https://github.com/D-Programming-Language/phobos/blob/master/std/meta.d#L790

Looks like an AliasSeq can contain a template identifier too. So should I understand that AliasSeq in general can refer to any identifier and any value? Hitherto I thought it was any *type* and any value...

-- 
Shriramana Sharma, Penguin #395953
December 12, 2015
On Saturday, 12 December 2015 at 14:15:37 UTC, Shriramana Sharma wrote:
> https://github.com/D-Programming-Language/phobos/blob/master/std/meta.d#L790
>
> Looks like an AliasSeq can contain a template identifier too. So should I understand that AliasSeq in general can refer to any identifier and any value? Hitherto I thought it was any *type* and any value...

Templates can take type, expression (value) and alias parameters. The latter can be symbols. Variadic templates, those with T... parameters, can accept all of those. There are also template this parameters for classes, but those are irrelevant here.

This is some example code from learning D:

```
import std.stdio;

void printArgs(T...)() if(T.length != 0) {
    foreach(sym; T)
        writeln(sym.stringof);
}

alias ArgList(T...) = T;

void main() {
    printArgs!(int, "Pizza!", std.stdio, writeln);
    printArgs!(ArgList!(int, string, double));
}
```

AliasSeq is implemented like ArgList, which is the shortened form of the following:

```
template ArgList(T...) {
   alias ArgList = T;
}
```

Normally, T... is only visible inside the template body, but the eponymous alias gives you a handle to it externally.
December 12, 2015
On 12/12/2015 06:15 AM, Shriramana Sharma wrote:
> https://github.com/D-Programming-Language/phobos/blob/master/std/meta.d#L790
>
> Looks like an AliasSeq can contain a template identifier too. So should I
> understand that AliasSeq in general can refer to any identifier and any
> value? Hitherto I thought it was any *type* and any value...

I've corrected the wording that I used. Now it says "A comma-separated list of values, types, and symbols (i.e. alias template arguments)".

  http://ddili.org/ders/d.en/tuples.html#ix_tuples.AliasSeq,%20std.meta

Ali