> On Apr 18, 2016, at 4:52 PM, Dave Abrahams via swift-evolution
> <[email protected]> wrote:
>
>>
>
> Again you're encoding “I'm at the end” in the index, which as we've
> agreed does not work.
If nothing else, it works—and seems natural—for linked lists.
Sorry; if I’d remembered this elementary example sooner I would’ve lead with it.
I’ll point it out then be completely done.
> So one special index value “moves automatically as the collection changes” and
> all others do not. Doesn't seem like an advantage to me. It's easy to
> imagine having subtle bugs due to this difference.
Again, if you implement a textbook linked-list under collections-move-indices,
the natural representation for the indices is arguably `ListNode<T>?` (or
whatever), wherein you use `nil` for the end index.
As a consequence, at least in this scenario you wind up with the
semantics/behavior sketched previously for `endIndex`.
No further reply is needed; thank you for sharing your insight.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution