I'm still a fan of that indexed() proposal... On Tue, Jan 31, 2017 at 8:52 AM Matthew Johnson via swift-evolution < [email protected]> wrote:
> On Jan 31, 2017, at 10:46 AM, Chris Eidhof <[email protected]> wrote: > > 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. > > > 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). > > You’re making a great case for the need to continue spreading knowledge > about Swift’s collection model through the community. > > 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. > > > On Tue, 31 Jan 2017 at 17:41, Matthew Johnson via swift-evolution < > [email protected]> wrote: > > On Jan 31, 2017, at 10:36 AM, Xiaodi Wu via swift-evolution < > [email protected]> wrote: > > I totally sympathize with users being confused. It's an interesting idea > to move it to Array only. > > 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”? > > > +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. > > On Tue, Jan 31, 2017 at 09:35 Ole Begemann via swift-evolution < > [email protected]> wrote: > > On 31/01/2017 16:19, Ole Begemann via swift-evolution wrote: > > Here are three previous discussion about this topic: > > > > 1) December 2015: [Idea] Add an (Index, Element) sequence to > > CollectionType > > > https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151221/004561.html > > and > > > https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151228/004626.html > > > > > > 2) April 2016: [Idea] Replace enumerate() with something more explicit > > > https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160411/015074.html > > > > > > 3) September 2016: [Proposal draft] Introducing `indexed()` > collections > > > https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160926/027355.html > > To clarify, the discussions I linked to don't all propose to remove or > replace `enumerated()`, but they all talk about the potential confusion > about what `enumerated()` does and does not do. > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution > > -- > Sent from my phone > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
