[phobos] Time to get ready for the next release

Steve Schveighoffer schveiguy at yahoo.com
Tue Apr 26 10:50:35 PDT 2011


>________________________________
>From: David Simcha <dsimcha at gmail.com>
>To: Discuss the phobos library for D <phobos at puremagic.com>
>Sent: Friday, April 22, 2011 6:58 PM
>Subject: Re: [phobos] Time to get ready for the next release
>
>
> On 4/22/2011 5:05 PM, Steve Schveighoffer wrote: 
>> How do you automate 4182?  That is, how does the wrapper know that I want the result to be covariant in derived classes?
>>
>>
> Right, I agree with you that this is a bug and should be fixed.  I am not sure, however, how it relates to the operator overloading issue.

OK, I looked over it again, and it's actually a bug that affects my workaround for the other bug.  Essentially, in order to work around the fact that I can't have templates in my interfaces, I aliased the virtual functions to opCat, etc.  But that did not pass on the covariance.

However, thinking about it, it would be nice if I could simply alias the operators to virtual functions.  Hm...  Would something like this make sense?

class C
{
   C opCatAssign(C other) {...}

   template opOpAssign(string s) if s == "~="
   {
       alias opCatAssign opOpAssign;
   }
}

This would be awesome, because then we have a way to get all our virtual functions without having to incur template bloat, or rely on inlining.  I can see how this would be useful for opDispatch.

It would also make for a super-easy mixin implementation.  In fact, you wouldn't need to deal with parameters at all.

But in this case, 4182 would need to be fixed ;)

I need to file another enhancement request...

-Steve



More information about the phobos mailing list