Andrei's interface requests
Denis Koroskin
2korden at gmail.com
Sat Apr 4 06:27:14 PDT 2009
On Sat, 04 Apr 2009 16:49:23 +0400, Kagamin <spam at here.lot> 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*?
I believe his proposal exactly intends to fix 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