--
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.
To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/c7dc4d42-0f31-4960-9497-a7855827b444n%40googlegroups.com.
Looks interesting! Is there an article somewhere that explains why each change to Go was necessary for DST? For example, why are sticky channel values required for DST?
Couldn’t sticky values be simulated with a goroutine that owns sending on a channel that implements the sticky/unsticky/clear behavior?
Isn’t it possible in general to arrange to not close a channel more than once?
--
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.
To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/9d26d464-e322-4220-925a-1e933bbfe812n%40googlegroups.com.
I had in mind a goroutine that receives commands for channel-like operations and implements them itself. So it would have a list to store the sent values, a sticky value variable, lists of receive commands (containing the channel to send a value back on), and lists of receive-full commands (containing the channel to send the values back on). It would loop on selecting for incoming commands, and behave accordingly. It’s not as efficient as having the behavior built in, no doubt, but probably simpler to implement.
This is an interesting approach.
I would have following question/feedback to the design:
- In view of the intent to broadcast a non empty value to all receivers of a channel, my intuition would be that the receivers should receive the value only once. What was the rational behind the continuing receiving of the "sticky" value from a logical point of view? Maybe a broadcast send could be initiated with ch <* x. The receiving goroutine would receive the value and would park until the channel is signaled to be ready for another value, either a sticky or a non sticky one. This could eliminate the application logic part of versioning the receives and unnecessary loops on that.
- The block until full receive x <| ch seems to be a means to synchronize on goroutine termination in a select thus allowing to implement a timeout. However, one would need to know the number of goroutines to synchronize for beforehand - which seems not to be a universal case. The intent to have a timeout on Wait could simply be achieved by Wait() replicating the context Done() logic.