News for hackers. Stuff that matters.
Re:Philosophy and "for" loops — more from Go and Rust by sanderjd on Thursday July 11, 2013 @11:59AM (#6026874)
Great article - I particularly enjoyed the discussion of the relative distributions of different types of loops in the Go standard libraries.

Having said that, I thought the Go `readLine` using channels example was strange. The goroutine that provides lines to the channel actually still needs to loop over the lines, and in fact includes a DRY version of the loop in question:

  for {
    line, ok := file.readLine()
    if !ok { break }
    // ...
  }
This is not to say that using an unguarded loop with a break is necessarily the best way to do this, but it seems to be the simplest DRY way to do this. I think he just wanted an excuse to demonstrate `range` with a channel.
Re:Philosophy and "for" loops — more from Go and Rust by lazyjones on Friday July 12, 2013 @12:00PM (#6033274)
Indeed, further down in the comments (on the article) one of the Go team members pointed this out and the author just called this solution "measurably worse" without any factual basis. It's a pity that so many seemingly technical articles are littered with bias and unfounded opinions these days...