[DIP] Resolution of Alias Template Parameters in Function Templates

Stefanos Baziotis sdi1600105 at di.uoa.gr
Mon May 20 17:46:50 UTC 2019


On Monday, 20 May 2019 at 17:35:23 UTC, jmh530 wrote:
>
> I don't see that "Changing the parameter type might not be 
> enough" caveat as being that big of an issue. I see the problem 
> as coming from the alias
> alias TemplateAlias(S, V) = TemplateType!(S);


I agree with you, but there might be more to it than it meets the 
eye
because of course, it is accepted by the language currently.

Other than that, to end up that this is a problem of aliases is 
irrelevant to the DIP. It doesn't have to do with template 
functions or template aliases as parameters to template functions.

> There is no reason for V to be there. You could just as easily 
> write
> alias TemplateAlias(S, V = null) = TemplateType!(S);

This still causes the drop of a template function template 
parameter.

> However, the user may not be able to change TemplateAlias, in 
> which case something like
> alias TemplateAlias(S) = TemplateAlias!(S, typeof(null));
> might be an acceptable solution I think.

Yes, but that is how the user decides to solve it.
Again, concluding about what aliases are acceptable and what not 
is a separate
topic, which is of course important.


More information about the Digitalmars-d mailing list