SE-0312: Add indexed() and Collection conformances for enumerated() and zip(_:_:)

Hello, Swift community.

The review of SE-0312: Add indexed() and Collection conformances for enumerated() and zip(::) begins now and runs through May 7th, 2021.

Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to the review manager. If you do email me directly, please put "SE-0312" somewhere in the subject line.

What goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

  • What is your evaluation of the proposal?
  • Is the problem being addressed significant enough to warrant a change to Swift?
  • Does this proposal fit well with the feel and direction of Swift?
  • If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
  • How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

More information about the Swift evolution process is available at:

As always, thank you for contributing to Swift.

Ben Cohen
Review Manager



1 Like


+1 seems great, a good addition



Is there a reason that Zip2Sequence is not getting a conditional conformance to LazySequenceProtocol?

1 Like

+1, seems obvious


As far as this goes I would really like to have this but I imagine that should go through its own separate pitch with where this one is at.

zip is a free function, so a .lazy in one of its arguments is not part of the same method chain that the zip itself belongs to.

If zipping two sequences were instead spelled as seq1.zipped(with: seq2) then Zip2Sequence would have conditional conformance to LazySequenceProtocol whenever the first inner sequence conforms to it, i.e. .zipped(with: seq2) would be a continuation of seq1's method chain.




One small suggestion: I think it'd be good to rename the Indexed type to IndexedCollection. There's no harm in it being longer because it will rarely show up at the use site. Also, the longer name is more consistent with other type names in the standard library (like EnumeratedSequence) and less likely to cause naming conflicts.



+1, especially for indexed().

Review Update

While the review of this feature was light with universal enthusiasm, the proposal author has requested it be sent back to pitch, due to discovery of an issue with zip and RandomAccessCollection conformance, which you can read more about on the new pitch thread.

Thanks to everyone who participated.

1 Like
Terms of Service

Privacy Policy

Cookie Policy