[phobos] Ranges using runtime interfaces
David Simcha
dsimcha at gmail.com
Thu Aug 19 21:51:32 PDT 2010
On 8/20/2010 12:01 AM, Andrei Alexandrescu wrote:
> On 08/19/2010 10:42 PM, David Simcha wrote:
>> I remember about a year and a half ago, there was talk of defining a
>> wrapper module around ranges to make them more usable in cases where
>> templates can't be used, such as virtual functions. I've revisited that
>> now that I'm cleaning up ranges. I've created a fairly simple attempt at
>> writing such a module. (http://pastebin.com/aDew6Kgg) This exercise has
>> reinforced my conviction that about the only thing good about nominative
>> typing is that it's easy to implement efficiently.
>
> Well structural systems (which current ranges are) are also pretty
> easy to implement efficiently. Anyway, signs of OO clusterfrak are
> already visible in the explosion of iXxxAssignable interfaces.
>
> Could you please add moveFront() and friends to the interfaces? Given
> that you've given up on ref returns (which I believe is a sound
> decision) we need some efficient means to destructively read stuff.
Added moveFront, moveBack, moveAt and capitalized things. For some
reason I thought interface names were excluded from the capitalize
typename convention if you're using the Hungarian IInterfaceName style.
It may make sense to just drop the Hungarian stuff, but I don't know if
D has a firm convention either way yet on using Hungarian for interfaces.
http://pastebin.com/sHiTNABe
Also, I found some nasty moveBack/moveAt bugs in std.range in the
process, namely no default impl. for ranges of elements w/o postblits.
I have no idea how they went this long without being found/fixed.
More information about the phobos
mailing list