[phobos] Difference between std.range is std.algorithm

Jonathan M Davis jmdavisProg at gmx.com
Fri Jul 29 15:04:09 PDT 2011


On Friday 29 July 2011 14:58:47 Jonathan M Davis 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.

LoL. The subject should be "Difference between std.range _and_ std.algorithm", 
not is... It reminds me of that stupid joke about "what's the difference 
between a duck?"

- Jonathan M Davis


More information about the phobos mailing list