News for hackers. Stuff that matters.
Re:Go and Android by rakoo on Sunday March 30, 2014 @07:40AM (#7495890)
If you want to `range` over a non-rangeable thing, the idiomatic way to do this is to use an iterator approach:

  var e elem
  for nonrangeable.HasNext() {
    e = nonrangeable.Next()
    // do stuff with e
  }
Coincidentally, that's what the built-in io.Copy [0] does.

(I'm also very biased, but I think this approach fits better with the fact that Go is targeted towards stream processing)

[0] http://golang.org/src/pkg/io/io.go?s=11928:11988#L330

There are no comments on this comment yet.