Andrei's interface requests

Kagamin spam at here.lot
Sat Apr 4 05:49:23 PDT 2009


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*?
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.
3. If you use templates, why you would need interfaces at all?

Interfaces parameterised with their implementations!



More information about the Digitalmars-d mailing list