I personally like immutable methods way better than a ref changing function like popFrontN. As you pointed out writing str.find(";").drop(2).find(";").drop(2) is cleaner than writing this with popFrontN.

Drop will have issues for input ranges.

Adding a ref count parameter overload to let you know how many elements were dropped/not dropped seems too messy. No idea for that one.

The documentation should clearly state that this offers similar functionality to popFrontN but it's purpose is to enable a different syntax so that people don't get completely confused.

martin

On Tue, 16 Aug 2011 01:22:43 +0200, Jonathan M Davis <[email protected]> wrote:

On Saturday, August 13, 2011 23:02 Jonathan M Davis wrote:
[snip]
So, the question is: Is drop worth having in Phobos? It's common in
functional languages, and if you want to program in a more functional
style, it's of enormous benefit. We'll still have popFrontN regardless, so
the question is whether drop adds enough value to be worth having or
whether it's just too similar to popFrontN to be worth adding to the
standard library.

Personally, I think that drop would be a _very_ useful function to have.
What do you think?

Does anyone else have an opinion on this? It will be a lot easier to talk
Andrei into having drop in Phobos if more than just 2 people respond.

- Jonathan M Davis

Reply via email to