Follow-up on AsyncSequence and parity with Sequence based APIs

I agree, forEach, and parity with Sequence, is important for AsyncSequence's ergonomics and adoption.

IIRC, there was resistance to adding forEach on Sequence in the first place, due to purity concerns in the "functional" APIs. That is, people wanted such APIs to remain for transforming values, leaving the looping to for. I think history has shown this to be pretty wrong. APIs which force users to switch between paradigms or contexts, for lack of a better term, are always sources of friction. This friction either frustrates the users on a regular basis or, for the more motivated, pushes the user into creating equivalent APIs in their context. We saw this with forEach and Result. I think we still see it in the Optional vs. throwing context. And we would see it here if there weren't an equivalent looping API.

10 Likes