News for hackers. Stuff that matters.
Re:Why I went from Python to Go (and not node.js) by ricardobeat on Friday September 14, 2012 @06:34PM (#4524336)
Shared-nothing is a design decision (and runtime/language limitation), due to the single-threaded nature of js. The workers can communicate with the master via message passing: http://nodejs.org/api/cluster.html#cluster_worker_send_messa...

The documentation has the primary goal of explaining how things work, not being the canonical style guide.

Take a similar example from the Go documentation:

    const NCPU = 4  // number of CPU cores

    func (v Vector) DoAll(u Vector) {
        c := make(chan int, NCPU)  // Buffering optional but sensible.
        for i := 0; i < NCPU; i++ {
            go v.DoSome(i*len(v)/NCPU, (i+1)*len(v)/NCPU, u, c)
        }
        // Drain the channel.
        for i := 0; i < NCPU; i++ {
            <-c    // wait for one task to complete
        }
        // All done.
    }

There are no comments on this comment yet.