top | item 37098121

(no title)

cy_hauser | 2 years ago

>> "there's only one way to do it"

What's the one way to do iterators now? I thought this proposal came about because there wasn't a default way and everybody had to roll their own.

discuss

order

ilyt|2 years ago

you can just return channel. range works over channels. Close channel once you're done with iterator. Technically there is side effect of that (iterator done like that would always produce extra value before exiting) but you could probably work around it without much boilerplate