Hi,This may have been discussed before but would it not be practical to be able to control the behavior of the underlying channel buffer?Say you don't want the buffer to block when it is full but simply drop one of the ends in an either fifo or lifo way.
--
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 golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
My question is not at all related to any real need I have now.It was merely a thought I had when refreshing my message passing...For example ttl functionality is something easily implemented on a case by case but and the ttl on a message clearly belong to the message.The dropping of the message feels like it belongs to the queue though.Maybe more advanced example would be priorities?We are always advocating separation of concerns and I just think that some of these approaches may belong in the queuing rather than with the user.
For networking I would go for something else at least until/if net chans come back.My point is simply that some of these things may belong in the queue.
Maybe you have a windowing system where communication is distributed via channels and you may want to coalesce some events transparently,maybe some events are more important?
What queue? I am talking about the channels underlying queue.
The whole point is to modify the behavior of the channel. If I can do it via a library, fine but it is not possible right?
There would need to be all sorts of intermediary buffers and a number of channels. This can easily be implemented in a library, sure but why not have it in the native channels? There is already the distinction between buffered and non-buffered channels that you have to consider actively when you code. This is no different.
I think it belongs in the language but there could be implementation details too destructive to make it worth it of course.
--
I think the dropping case(s) lifo/fifo is a pretty natural extension to the current channels.It provides a bit more control of the behavior without sacrificing easy and nice way that channels are used.1. Unbuffered channels - Rendezvous2. Buffered, blocking3. Buffered non-blocking - drop newest4. Buffered non-blocking - drop oldestAnd sure these can always be implemented (everything can) but that does not make it a bad evolution of the channels.
I think the dropping case(s) lifo/fifo is a pretty natural extension to the current channels.It provides a bit more control of the behavior without sacrificing easy and nice way that channels are used.1. Unbuffered channels - Rendezvous2. Buffered, blocking3. Buffered non-blocking - drop newest4. Buffered non-blocking - drop oldestAnd sure these can always be implemented (everything can) but that does not make it a bad evolution of the channels.
--