3 ms·
- My initial thought is that the performance implication (e.g. escaping to the heap) of impure iterators is an implementation detail and seems like a good candi
by catlifeonmars 1y ago
- My initial thought is that the performance implication (e.g. escaping to the heap) of impure iterators is an implementation detail and seems like a good candidate for a future compiler optimization.
- impure iterators are strictly more powerful than pure iterators in that they can be resumed but do not have to be. If I wanted to pick one pattern for consistent behavior across all iterators it would be this one.
- gregwebs 1y agoNot all impure iterators can be resumed. But any pure iterator can be converted to a resumable iterator with a generic conversion function.
- catlifeonmars 1y ago> any pure iterator can be converted to a resumable iterator with a generic conversion function. Makes sense > Not all impure iterators can be resumed How do you mean? In my head resuming an iterator is just partially unrolling a loop.
- nine_k 1y agoAn impure iterator can panic, so you can't resume?