[phobos] Difference between std.range is std.algorithm
David Simcha
dsimcha at gmail.com
Fri Jul 29 15:06:23 PDT 2011
>From the initial discussions on std.range back in 2009, it was decided that
std.range operates on topology, whereas std.algorithm operates on contents.
Basically, stuff in std.range doesn't care what any of the values in the
range are, std.algorithm does. Of course, the similar names etc. may
warrant bending the rules.
On Fri, Jul 29, 2011 at 5:58 PM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:
> Is there a simple way to distinguish whether something belongs in std.range
> or
> std.algorithm? I know that in at least some cases, it's debatable as to
> whether something belongs in one or the other, but is there a general rule
> that we could give in one sentence or so?
>
> For instance, I've been debating the situation with https://github.com/D-
> Programming-Language/phobos/pull/147 a bit (it adds takeWhile, drop, and
> dropWhile). drop clearly belongs in std.range, but both takeWhile and
> dropWhile could go in either std.range or std.algorithm. Given the
> similarities in their names to take, takeExactly, and drop, they should
> probably go in std.range. However, there _are_ similar functions in
> std.algorithm (e.g. takeWhile is similar to until). So, I don't know which
> place is better (at present they're in std.range). But I'm not even aware
> of a
> rule that I could give in a sentence or two which would say what the
> general
> dividing line between std.range or std.algorithm is. You can get a feel for
> it
> by seeing what's currently there, but it would be nice if we could have an
> actual rule which made it clearer.
>
> - Jonathan M Davis
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20110729/228840d7/attachment.html>
More information about the phobos
mailing list