News for hackers. Stuff that matters.
Re:Understand Go pointers by Animats on Wednesday April 26, 2017 @03:28PM (#14206181)
Huh?
Re:Understand Go pointers by thethirdone on Wednesday April 26, 2017 @04:24PM (#14206631)
Channels can be made with no buffering at all. In this case trying to send without a receiver is blocking, so the channel is not really acting as a queue anymore.

Buffering is only an option to improve performance. Programs should (if they are correct in a sense) be able to work with channels without buffering.

Re:Understand Go pointers by agentgt on Thursday April 27, 2017 @08:07AM (#14210823)
> Channels can be made with no buffering at all. In this case trying to send without a receiver is blocking, so the channel is not really acting as a queue anymore.

It depends on how you define a queue. That is in this case whether there is blocking or not. In Java this distinction is made clear with BlockingQueues and plain Queues.

A non buffering blocking queue in Java is a SynchronousQueue or casually known as a hand off queue or rendezvous queue. Unfortunately unlike Go these queues are painfully expensive in Java because Java doesn't have green threads as well I believe the queues use expensive locks (then again locks can be at times more efficient than spinning/sleeping the cpu aka ConcurrentLinkedQueue but in general they are expensive).

Going back to the ambiguity of what is a queue it gets even more complicated when talking about distributed queues/streams where you have acknowledgements, prefetching, round robin distribution etc (ie AMQP).