There's one part of your table I don't follow — how do you get better indexing performance by implementing custom indexes? SequenceIndex
keeps a reference to its element
so you can return that in O(1) time.
In fact, you might be able to remove that entirely, because calling next()
on Base.Iterator
should give you the same value?
Regarding the proposal as a whole — I'm not sure. It seems a lot like using a sledgehammer to crack a nut, although it does solve a problems. My preference is still towards semantically changing Sequence to be multipass (a la [Pitch] Remove the single-pass requirement on Sequence), purely for the limited effects on existing source, but Dave's pitch also solves the associatedtype
weirdness when jumping from Sequence to Collection.