Am Thu, 30 Aug 2012 00:55:40 +0400 schrieb Dmitry Olshansky <[email protected]>:
> The voting ends today, time to count the votes. > > With the result of 6 YES votes vs 1 NO std.digest package is accepted > for inclusion into Phobos. > > > Congratulations, Johannes. > thanks everyone! > --- > > Still, there is one thing that bothers me. > > Of few issues that were found (and addressed) during voting there is > one that requires a global change (in std.algorithm). I'm talking > about this comment by Andrei: > > > * This example: > > > > copy(oneMillionRange, &ctx); //Note: You must pass a pointer to > > copy! > > > > suggests we're doing something wrong. I think a better solution > > would be to have copy() take the target range by "auto ref", and > > institute this passing convention as a general rule for output > > ranges. > > About time to remind us of auto ref and how it works then. > The end result is we need to get a version of copy that: > - doesn't break existing code > - takes destination by ref when possible thus fixing this pattern. > Would it be good enough if we special cased arrays to have the same behavior as now and used 'auto ref' for all other output ranges? I think we can't avoid breaking some code though. If some code relied on the second parameter being passed by value, there's nothing we can do? E.g: ---- auto a = copy([0], start); // a = start ~ 0 auto b = copy([1], start); // b = start ~ 1 auto c = copy([2], start); // c = start ~ 2
