4 ms·
Author here. I think there is definitely room for improvement in the iterator API. I intend to experiment with more implementations in the coming weeks with the
by zyedidia 5y ago
Author here. I think there is definitely room for improvement in the iterator API. I intend to experiment with more implementations in the coming weeks with the goal of settling on something better by the time Go 1.18 is released. The main alternative I have in mind is a cursor-style iterator (for example, with `Next`, `Done`, and `Value` methods). If you have something else in mind too, let me know and I might be able to try it out.
- lucian1900 5y agoI think the cursor alternative works best with Go's syntax. it := GetAnIterator() for it.Next() { it.Value() } This still allows composition of different iterators, for building up lazy/incremental processing.