The design has been used in Java for many, many, years… pretty sure most 
developers understand it. In fact, before Java had generics and the Iterable 
interface it was the only game in town if you wanted type safety - and the Go 
code is even more concise do to type inference.

> On Oct 25, 2018, at 2:52 PM, Eric S. Raymond <[email protected]> wrote:
> 
> robert engels <[email protected]>:
>> Wouldn’t you normally pass a consumer or collector function into the 
>> interator code? Then you only write the iterator once, and it is hidden.
> 
> I'll look into that approach.  There might be a readability issue there.
> 
>> Similar to how the sync.Map.Range() works.
>> 
>> Barring that, I don’t see how
>> 
>> for(i:=c.Iterator();i.HasNext();) {
>>      v := i.Next()
>> }
>> 
>> is that much more difficult to use - especially since you state it is a 
>> custom iteration anyway?
> 
> I don't like the eyeball friction.
> 
> I write for long timescales.  Someone other than me will have to be able to
> maintain this code someday.
> -- 
>               <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>
> 
> My work is funded by the Internet Civil Engineering Institute: 
> https://icei.org
> Please visit their site and donate: the civilization you save might be your 
> own.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to