<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 31, 2017, at 10:46 AM, Chris Eidhof <<a href="mailto:chris@eidhof.nl" class="">chris@eidhof.nl</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I agree that it's very useful. I use it regularly. The documentation isn't that unclear, imo. To me, the underlying problem isn't enumerated. I think the underlying cause is that collections aren't indexed with zero based indices.if you don't understand this (which is the case for many experienced programmers new to Swift) it's hard to understand, and (too) easy to make a mistake.</div></div></blockquote><div><br class=""></div><div>This indicates that the underlying problem is *not* enumerated at all. The underlying problem is that Swift is still a relatively new language and it does some things differently than other languages (for very good reasons).</div><div><br class=""></div><div>You’re making a great case for the need to continue spreading knowledge about Swift’s collection model through the community.</div><div><br class=""></div><div>I don’t think it’s problematic for an experienced programmer who is new to the language to bump up against this when the reach for `enumerated`. They’re going to need to learn the collection model sooner or later. </div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><div class="gmail_quote"><div class="">On Tue, 31 Jan 2017 at 17:41, Matthew Johnson via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Jan 31, 2017, at 10:36 AM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="gmail_msg m_3720081916406269865Apple-interchange-newline"><div class="gmail_msg">I totally sympathize with users being confused. It's an interesting idea to move it to Array only.<br class="gmail_msg"><br class="gmail_msg">The thing is, it does make sense (and wouldn't be confusing) to enumerate a dictionary or set. Moreover, the behavior is _exactly_ what it says on the tin: when you enumerate something in real life, there is no sense in which the number is related to some sort of index. Can we fix this by documentation? Like, a big blaring "don't use this when you want the index”?<br class="gmail_msg"></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">+1. A similar method on collection that provides indices might be useful but that doesn’t mean we should remove `enumerated`. User confusion should be addressed by documentation.</div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">On Tue, Jan 31, 2017 at 09:35 Ole Begemann via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 31/01/2017 16:19, Ole Begemann via swift-evolution wrote:<br class="gmail_msg">
> Here are three previous discussion about this topic:<br class="gmail_msg">
><br class="gmail_msg">
> 1) December 2015: [Idea] Add an (Index, Element) sequence to<br class="gmail_msg">
> CollectionType<br class="gmail_msg">
> <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151221/004561.html" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151221/004561.html</a><br class="gmail_msg">
> and<br class="gmail_msg">
> <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151228/004626.html" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151228/004626.html</a><br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> 2) April 2016: [Idea] Replace enumerate() with something more explicit<br class="gmail_msg">
> <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160411/015074.html" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160411/015074.html</a><br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> 3) September 2016: [Proposal draft] Introducing `indexed()` collections<br class="gmail_msg">
> <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160926/027355.html" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160926/027355.html</a><br class="gmail_msg">
<br class="gmail_msg">
To clarify, the discussions I linked to don't all propose to remove or<br class="gmail_msg">
replace `enumerated()`, but they all talk about the potential confusion<br class="gmail_msg">
about what `enumerated()` does and does not do.<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>
_______________________________________________<br class="gmail_msg">swift-evolution mailing list<br class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg"></div></blockquote></div></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div></div><div dir="ltr" class="">-- <br class=""></div><div data-smartmail="gmail_signature" class="">Sent from my phone</div>
</div></blockquote></div><br class=""></body></html>