Thread overview
Varargs concatenation
Jun 20
monkyyy
Jun 20
monkyyy
June 20
alias seq(T...)=T;
alias a=seq!int;
alias b=seq!float;
alias c=a~b;//seq!(int,float)
alias a=seq!();
a~=int;
a~=float;//seq!(int,float)

Concatenation of vartatic templates will automagically grab their headers and combine them together

If the templates are different then the first one will be used

alias a=seq!int;
alias b=AliasSeq!float;
static assert(is(a~b==seq!(int,float));
static assert(is(b~a==AliasSeq!(float,int));

this will allow pulling out template arguments from a reference

alias badseq(T...)=void;

alias a=badseq!(int,float);
alias b=seq!()~a;//seq!(int,float)

it should work with templated structs/functions

struct sumtype(T...){...}
alias a=seq!()~sumtype!(int,float);//seq!(int,float)
June 21
On 21/06/2025 7:55 AM, monkyyy wrote:
> alias seq(T...)=T; alias a=seq!int; alias b=seq!float; alias c=a~b;// seq!(int,float)

Note: we can do this today.

```d
import std.meta;

template Foo() {
    alias A = AliasSeq!int;
    A = AliasSeq!(A, float);
    pragma(msg, A); // (int, float)
}

alias Foos = Foo!();
```

Unfortunately alias assign doesn't work outside of the template.
Hence the template.

> alias badseq(T...)=void; alias a=badseq!(int,float); alias b=seq!()~a;//
> seq!(int,float)

That can't work, the alias goes bye bye, and it will only see the void.

June 20
On Friday, 20 June 2025 at 20:03:29 UTC, Richard (Rikki) Andrew Cattermole wrote:
> 
> > alias badseq(T...)=void; alias a=badseq!(int,float); alias
> b=seq!()~a;//
> > seq!(int,float)
>
> That can't work, the alias goes bye bye, and it will only see the void.

I think the spec says it *may* but Im pretty sure it *cant* in practice, the inherent memoization exists somewhere

```d
template badseq(T...){
    pragma(msg,T.stringof);
    alias badseq=void;
}
unittest{alias a=badseq!(int,float);}//prints
unittest{alias a=badseq!(int,float);}//doesnt
unittest{alias a=badseq!(int,float);}
unittest{alias a=badseq!(int,float);}
```