[phobos] Ranges using runtime interfaces

Andrei Alexandrescu andrei at erdani.com
Mon Oct 25 16:17:50 PDT 2010


On 8/20/10 23:06 CDT, Shin Fujishiro wrote:
>> 2.  The base interface is OutputRange!(E).  If I change the base
>> interface to OutputRange!(E...), then OutputRange!(uint, double) won't
>> be a subtype of OutputRange!(uint).  This is self-evidently ridiculous.
>> I could maybe make OutputRangeObject!(E...) inherit from
>> OutputRange!(E[0]), OutputRange!(E[1]), ..., OutputRange!(E[$ - 1]), but
>> other than nasty string mixins D doesn't provide a way to inherit from a
>> tuple of interfaces.
>
> Oh, really?  That's bad.  I thought tuples could be used in the class
> inheritance list.  IIRC something like the following also does not work
> due to a deep inheritance bug:
>
> interface OutputRange(E...) : OutputRange!(E[1 .. $]) {
>      void put(E[0] e);
> }
>
> Then, maybe we should put off supporting this anyway...

Once Kenji's adapt() is in place, this problem can be considered solved. 
I suggest we move with variadic OutputRange.

Andrei


More information about the phobos mailing list