Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


I 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: