Closed jwiegley closed 9 years ago
I'm reluctant to change the existing function, mainly because it is a strongly breaking change. This function is commonly downstream of a Producer
whose return value is ()
and if you change the return value of takeWhile
to something other than unit then it will break existing code.
However, I would be okay with adding another function with a similar name (i.e. takeWhile'
or something similar) and then implementing takeWhile
in terms of this new function.
@Gabriel439 Yes, that's an understandable rejection. I was thinking of something like takeWhileAwait
to indicate to the user that it will consume values and then produce another one. How does that sound?
How about a synonym like spanWhile
?
@Gabriel439 Hmm.. except that a span is something I'd expect to be in pipes-group
. I think maybe your original suggestion of takeWhile'
is probably best.
Alright, that sounds good
Commit has been updated.
Thanks! :)
This gives pipelines a chance to hand the failing element downstream:
Otherwise, there is no way to make use of that element, neither to drop it, consume it, nor re-yield it.