DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1

jmh530 john.michael.hall at gmail.com
Tue Sep 10 23:05:33 UTC 2019

On Tuesday, 10 September 2019 at 21:48:33 UTC, Stefanos Baziotis 
> [snip]
> TBH, I did not understand completely the code. From what I can 
> tell,
> this DIP doesn't have connection with the code above because
> there's no alias. But this might be an oversimplification and
> I might have missed something.

What do you mean there is no alias? This is an alias:

template Foo_able(T)
     if (isFoo!T)
     alias Foo_able = T;

It's using the explicit template syntax. The template 
documentation [1] has "template TFoo(T) { alias Ptr = T*; }" as 
an example. This is very similar except it has a template 
constraint and I use an eponymous template. Without the template 
constraint it is template Foo_able(T) { alias Foo_able = T; }

For your other point, if above is a template alias, then the 
other must also (just adding in a static assert). Regardless, it 
would be used as a function parameter in the useFoo function.

[1] https://dlang.org/spec/template.html

More information about the Digitalmars-d mailing list