<div dir="ltr"><div>I support a fixed version. I don't think that's mutually exclusive with removing enumerate.</div><div><br></div><div>This thread seems to be a result of a misused API, so I think it's necessary to make it obvious when that API changes. I think we'd want a period of deprecation with both enumerate() and a new (hopefully more clear and concise) method, so that people can fix their code.<br><br></div><div>I think this would be a good change:</div><div><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;color:rgb(51,51,51)"><span class="" style="background-color:rgb(234,255,234);color:rgb(85,165,50)">+ @available(*, deprecated, message="it will be removed in Swift 3")</span>
public func enumerate() -> EnumerateSequence<Self>
<span class="" style="background-color:rgb(234,255,234);color:rgb(85,165,50)">+ public func indexed() -> Zip2Sequence<Self.Index,Self> { return zip(self.indices, self) }</span></pre></div><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 16, 2016 at 11:12 AM, Charles Srstka <span dir="ltr"><<a href="mailto:cocoadev@charlessoft.com" target="_blank">cocoadev@charlessoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><blockquote type="cite">On Apr 15, 2016, at 8:09 PM, Andrew Bennett via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></blockquote><div><blockquote type="cite"><br><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I'm in support of a method of getting a sequence of (Index,Value) pairs (as you know from the other thread). I think I'm leaning toward option three if it's equivalent to `zip(self.indices, self)`, ideally as a concise property like keys/values on a Dictionary.</span><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">I've been using zip in production. I presumed enumerate was intended for enumerating indices, and that it had just been forgotten when the slice changes went through. I'm in favour of removing it.</div></div></blockquote></div><br></span><div>Instead of removing it, how about just fixing it so that it returns the proper indexes rather than arbitrary numbers?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Charles</div><div><br></div></font></span></div></blockquote></div><br></div>