On 26/11/2012 19:59, Walter Bright wrote:
On 11/27/2012 5:52 AM, David Nadlinger wrote:
I agree, and if I remember previous discussions on the subject
correctly, it seems like only Walter is in favor of upholding the
current restrictions of "alias" parameters to symbols. I simply do not
see a point in pushing compiler implementation details on the user like
that – for the programmer, a type is a type is a type…

Walter, do you have an example of a situation where the alias parameter
restriction would be beneficial?  (for the D code involved, I don't mean
the few lines of code avoided in the compiler)

In any case, it will break a great deal of existing code to change  that
behavior.

I agree we shouldn't change the semantics of alias parameters now, particularly as breakages wouldn't be detectable. That would be horrible for any affected code.

However, if at some point we want to improve the situation, we could add a different syntax, e.g. using 'auto':

template Foo(auto Param)
...
template Foo(T)

auto template parameters would accept anything, including built-in types. auto template parameters should therefore be considered less specialized than type parameters like T in the Foo(T) template. So Foo!int and Foo!MyStruct would instantiate Foo(T), not Foo(auto Param).

Reply via email to