June 06, 2011 Re: So how exactly does one make a persistent range object? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | Andrej Mitrovic wrote:
>> On 6/6/11, Jonathan M Davis <jmdavisProg@gmx.com> wrote:
>> So, anything you do on your own could be polymorphic, but as soon as you
>> get ranges from Phobos, you lose the polymorphism.
>
> Yeah, I've noticed that. I wouldn't want to loose the ability to call into std.algorithm/std.range or even Philippe's dranges library, which looks really neat. I guess I can use take() on a range and then array() to get the underlying type which I could easily pass to other functions. I'll see what I can come up with as I experiment with these features.
I don't get what the issue is. Static polymorphism can be turned into dynamic polymorphism very easily. Just write a polymorphic wrapper template for ranges. This will work with Phobos ranges just as well as with your own. ;)
Timon
|
Copyright © 1999-2021 by the D Language Foundation