<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I don't see the motivation for removing enumerated(). It's a source-breaking change that seems unjustified to me. Sure, enumerated() isn't as flexible as one might like, and you can certainly reproduce its effects with zip(), but I don't think we've demonstrated that enumerated() is actively harmful. Removing it means obsolescing a bunch of training material, blog posts, etc. What do we gain by removing it?<br><br>-BJ</div><div><br>On May 10, 2017, at 7:24 AM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div>When this was previously brought up, I believe the consensus was for removing enumerated and doing nothing else.<br><div class="gmail_quote"><div dir="ltr">On Wed, May 10, 2017 at 02:50 Pavol Vaskovic <<a href="mailto:pali@pali.sk">pali@pali.sk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">One more note:<br><div class="gmail_extra"><br><div class="gmail_quote"></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, May 7, 2017 at 8:51 PM, Ben Cohen <span dir="ltr"><<a href="mailto:ben_cohen@apple.com" target="_blank">ben_cohen@apple.com</a>></span> wrote:<br></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(180,38,26)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">let</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)"> words = [</span><span style="font-variant-ligatures:no-common-ligatures">"five"</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">,</span><span style="font-variant-ligatures:no-common-ligatures">"four"</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">,</span><span style="font-variant-ligatures:no-common-ligatures">"three"</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">,</span><span style="font-variant-ligatures:no-common-ligatures">"two"</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">,</span><span style="font-variant-ligatures:no-common-ligatures">"one"</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">,</span><span style="font-variant-ligatures:no-common-ligatures">"blastoff!"</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">]</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">((0...5)</span><span style="font-variant-ligatures:no-common-ligatures">.</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">reversed</span><span style="font-variant-ligatures:no-common-ligatures">() </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">|></span><span style="font-variant-ligatures:no-common-ligatures"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">zip</span><span style="font-variant-ligatures:no-common-ligatures">($0, </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">words</span><span style="font-variant-ligatures:no-common-ligatures">) })</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"> .</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">forEach</span><span style="font-variant-ligatures:no-common-ligatures"> { </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,149,175)">print</span><span style="font-variant-ligatures:no-common-ligatures">($0.0,$0.1, separator: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(180,38,26)">": "</span><span style="font-variant-ligatures:no-common-ligatures">) }</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><br><span style="font-variant-ligatures:no-common-ligatures"></span></div></div></div></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>...</div></div></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">((0...5).<span style="color:rgb(52,149,175)">reversed</span>() |> <span style="color:rgb(52,149,175)">zip</span>(</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(4,51,255)">_</span><span style="font-variant-ligatures:no-common-ligatures">, <span style="color:rgb(52,149,175)">words</span>))</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> .<span style="color:rgb(52,149,175)">forEach</span> { <span style="color:rgb(52,149,175)">print</span>($0.0,$0.1, separator: </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(180,38,26)">": "</span><span style="font-variant-ligatures:no-common-ligatures">) }</span></div></div></div></div></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"></div></blockquote><div><br></div><div>The code above demonstrates that replacing `enumerated` with `zip` gives you anonymous tuples that need to be accessed with positional properties.</div><div><br></div><div>In contrast, the tuple returned from `enumerated` gives you named tuple (offset: Int, element: Element).</div><div><br></div><div>Does this change your opinion when you take into account the sorry state of tuple handling in Swift 4, that prevents you from writing concise and readable functional code? See:</div><div><div><br></div><div>SR-4745 for (index, (a, b)) in dict.enumerated() produces an error<br></div></div><div><a href="https://bugs.swift.org/browse/SR-4745" target="_blank">https://bugs.swift.org/browse/SR-4745</a><br></div><div><br></div><div><div>SR-4738 Can not decompose nested tuple in closure arguments</div></div><div><a href="https://bugs.swift.org/browse/SR-4738" target="_blank">https://bugs.swift.org/browse/SR-4738</a><br></div><div><div><br></div><div>Best regards</div><div>Pavol Vaskovic </div></div></div></div></div>
</blockquote></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>