View parent Full Discussion (Custom range iterators in Go)

I agree it looks unconventional and does not read well.

A more readable version would be

for i := range ChanOfInts(10, 20, 2)

or shorter

for i := range OfInts(10, 20, 2)

but still, it looks ugly

overall I think the best solution is to use a classic for loop you cannot be more explicit than that and you do not sacrifice clarity at all. By the was the use of go-iter or iterators is even more ugly and un-necessary. In short KISS!

code of conduct - report abuse