>From my perspective, a buffer is below the abstraction level of a channel. If you want a channel with special behavior, it seems like you should implement a channel.
On Monday, January 13, 2014 10:47:22 PM UTC-6, t x wrote: > > I am aware of: > > DroppingBuffer and SliddingBuffer > > I would like to build a channel with different semantics: > > When I try to put an item on a full channel: > > * DroppingBuffer drops the new item > * SliddingBuffer evicts the oldest item > > * ClosingBuffer should _close the channel_ > > (thus, the receiver eventually gets a nil, and realizes "ah, was > disconnected") > > Now, I am looking at the github core.async code: > > DroppingBuffer: > https://github.com/clojure/core.async/blob/76317035d386ce2a1d98c2c349da9b898b480c55/src/main/clojure/clojure/core/async/impl/buffers.clj#L33-L45 > > ManyToManyChannel: > https://github.com/clojure/core.async/blob/76317035d386ce2a1d98c2c349da9b898b480c55/src/main/clojure/clojure/core/async/impl/channels.clj#L31-L198 > > ## Problem: > > DroppingBuffer is easy to understand. However, I don't think I can > implement "ClosingBuffer" as Buffer. > > I feel taht "ClosingBuffer" can only be implemneted at the Channel Level. > > However, the Channel Code is complicated. > > Is there a neat hack / trick to do what I described above? > > Thanks! > -- -- 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/groups/opt_out.