LazyInterface (simplified Boost.Interfaces)

kenji hara k.hara.pg at gmail.com
Thu Sep 23 12:13:36 PDT 2010


I supported covariance of return types.
Please check it.

2010/9/24 kenji hara <k.hara.pg at gmail.com>:
> Thanks very much!
>
>> If you agree, I am committed to advocate adopting this abstraction for Phobos in module std.typecons, with credit.
> Of couse, I agree.
>
>
>> All - a bit of bikeshedding - what is a better name for adaptTo? I know there is a consecrated name for such late matching of an interface, but I can't remember it.
> from here(http://www.coderage.com/interfaces/), I found two keywords.
> - Non-intrusive dynamic polymorphism
> - Aspect Oriented Programming
> How about you?
>
>
> I understood the covariance problem. I think that I should also support it.
> By the way, there is a question about this sample code.
>> class C
>> {
>>  long draw(){ return 10; }
>> }
>> interface Drawable
>> {
>>  int draw();
>> }
> In my opinion, C can derive from Drawable ideally.
> so, it will be satisfied with this code.
>
> static assert(isCovariantWith!(typeof(C.draw), typeof(Drawable.draw)));
>
> Correctness of it is like this, isn't it?
> class C
> {
>  int draw(){ return 10; }
> }
> interface Drawable
> {
>  long draw();
> }
>
>
>> The override should be legit.
> I will fix them.
>
>
> Kenji Hara
>


More information about the Digitalmars-d mailing list