https://issues.dlang.org/show_bug.cgi?id=4535
--- Comment #9 from timon.g...@gmx.ch --- (In reply to Jonathan M Davis from comment #8) > (In reply to timon.gehr from comment #7) > > (In reply to Jonathan M Davis from comment #6) > > > We already have until, > > > which does what takeWhile would do - it just has an arguably worse name. > > > Is > > > there something about until that does not fulfill what takeWhile would do? > > > > In many (most?) circumstances it is just silly to have to specify a > > condition to detect the first element that you do /not/ want included in > > your range. There is a reason 'filter' keeps the elements for which the > > predicate evaluates to 'true' and not those for which it evaluates to > > 'false'. > > True, in may circumstances, having to negate your predicate is annoying, but > when I tried to get takeWhile and dropWhile added on that basis several > years ago, Andrei vetoed it, because it was trivial to just negate the > predicate, and he's right. It may be a bit annoying, but it is trivial. > ... I'm not using Phobos in order to get annoyed by trivialities, and neither are the people who will need to read my code. It is not inadvisable to not condone double-negation in text for which we want to avoid that it does not fail to be hard to digest. > There's still some value in takeWhile on the basis of user friendliness if > you have a predicate that would need to be negated to be used with until, > and some folks do go looking for takeWhile and fail to find until (though > until's docs do now mention that it's essentially takeWhile), but we do > generally try to avoid adding extremely simple functions to Phobos, and if > takeWhile or dropWhile were added, they would almost certainly be added as > simple wrappers around until and find respectively. > ... User friendliness, reader friendliness, name standardization. > So, unless someone can convince Andrei that having to negate the predicate > is onerous enough to merit adding the opposite functions and/or the negated > versions are more common than what we have, It is controversial that takeWhile is more commonly useful that until? > I think that it's pretty clear > that neither takeWhile nor dropWhile are going to be added, because we > already have the functionality that they provide, even if it does require > that you sometimes negate your predicate. It is wrong to think in terms of "functionality" for combiners used in a functional program. Every additional negation makes a one-liner harder to understand even if it inconveniences its construction in a minor (but still, unnecesssary) way. --