Kagamin wrote:
Andrei Alexandrescu Wrote:

I grant that it would be quicker and clearer to write:
interface Foo
{
   static void stuff();
   this (int);
}
template Template(Arg : Foo) {}

than to write:
template Template(Arg) if (is (typeof (new Arg(0)) && isStaticFunction!(Arg, "stuff")) {}
Yah. Let me add that after the OOP meteoric rise in the past years, many of us can instantly figure how the former works, whereas the latter is thoroughly obscure.

1. If template constraints suck, why not fixing *them*?

That's a fix.

2. If implementation not complaining to interface constrains is prohibited, why 
you would want template constraints at all? Just use features you want and 
compiler will give errors if they are not provided.

Experience with C++ has shown that template functions tend to bite too much, i.e. they accept an argument and then they reject it when compiling. This makes overloading with templates very difficult.

3. If you use templates, why you would need interfaces at all?

Interfaces parameterised with their implementations!

I don't get this.


Andrei

Reply via email to