This will at least require [Pitch] Borrowing Sequence for the borrowing variant. But I also think there are still a lot of open questions:
- how do we differentiate between borrowing/consuming and variants that only consume the elements but not the collection.
- what will the result type be? There are now multiple Array like types.
- Should there also be lazy variations or should it be lazy by default?
and probably more.
Not a preview but a draft is up: Ownership-aware Set and Dictionary variants by lorentey · Pull Request #573 · apple/swift-collections · GitHub