Thanks @mpangburn
So I skimmed through the previous discussion and didn't find any particular reason for it to stall out, it just kinda...did. I can see two possible reasons for its demise:
- Insufficient time to pitch and implement. Only @Chris_Eidhof can speak to whether that's the case.
- Some uncertainty around @Joe_Groff's comment about the possibility of
map
being able to evolve this behaviour.
In either case I think the proposal as written has merit, and we should tackle it again.
As for for inout element in sequence
, I like this substantially less because it's a much larger change to the language. The way Sequence
is implemented does not seem to make it straightforward to hand the underlying storage to the loop body. In particular, there is no concept of MutableSequence
. This means that for inout
loops have different type requirements than for
loops, either requiring a MutableCollection
as the sequence (and then not involving the makeIterator
path) or creating a new MutableSequence
protocol that uses accessors in weird ways.
In either case this feels like a lot of effort for adding syntax to what is not a particularly common operation. So I think I'd want to constrain this to the much simpler model proposed here and in the previous thread.