> > To be clear, I didn't mean that a channel is guaranteed to be closed, > rather that previously I could count on the ability to drain a channel > after I have chosen to close it. Closing a promise-chan which has received > a value has no impact on later takes, it is indistinguishable from a > channel with an infinite buffer filled with a single value, which feels > like a deviation from the thought that unbounded buffers are bad. The > example in my previous message will OOM when used with a promise-chan. >
The buffer is not unbounded - it is of size 1. > This new behaviour doesn't directly contradict the close! dosctring - > "Data in the channel remains available for taking, until exhausted, after > which takes will return nil", but that description could leave you with the > expectation that data is exhausted. > > I guess I'm trying to understand if this new channel type is intended to > be used with the battery of existing channel macros (pipe, reduce, > pipeline, mult, etc.), where it may act as an unbounded, uncloseable > producer of values, or if it's really only intended to be used as a promise > which can be resolved in a non-blocking manner using put, take, >!, <!, > !!>, !!<. > It is primarily useful as a promise, but it can be useful to combine it with other channel ops with alts etc. But there may be other use cases where it's useful. > If it's the latter, would it make sense to rename promise-chan to promise, > i.e. a core.async promise type who's implementation happens to be a > channel, and expand only those macros relating to puts and takes to accept > chan-or-promise. > We are not going to change the name - it is a channel with promise semantics. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.