On Thursday, 17 July 2014 at 22:16:10 UTC, Dicebot wrote:
On Thursday, 17 July 2014 at 22:06:01 UTC, Brad Anderson wrote:
I agreed with this for awhile but following the conversation
here
<https://github.com/D-Programming-Language/phobos/pull/2149>
I'm more inclined to think we should be adding lazy versions
of functions where possible rather than versions with
OutputRange parameters. It's more flexible that way and can
result in even fewer allocations than even OutputRange
parameters would have (i.e. you can have chains of lazy
operations and only allocate on the final step, or not at all
in some cases).
Laziness isn't appropriate or possible everywhere but it's
much easier to go from lazy to eager than the other way around.
[...]
This is not comparable. Lazy input range based solutions do not
make it possible to change allocation strategy, they simply
defer the allocation point. Ideally both are needed.
Well the idea is that you then copy into an output range with
whatever allocation strategy you want at the end. There is quite
a bit of overlap I think. Not complete overlap and OutputRange
accepting functions will still be needed but I think we should
prefer the lazy approach where possible.