Comment made by: alexmiller
The conceptual implementations of IDeref and IBlockingDeref on ManyToManyChannel using existing async constructs is relatively straightforward:
`
(deftype ManyToManyChannel
#_existing_code...
IDeref
(deref [this] (<!! this))
IBlockingDeref
(deref [this ms timeoutValue]
(alt!!
this ([val _] val)
(timeout ms) timeoutValue)))
`
However, M2MC is defined in clojure.core.async.impl.channels. <!!, alt(image: ), and timeout are all defined in clojure.core.async, which depends on clojure.core.async.impl.channels, so there is a cyclic dependency problem here. The <!! and timeouts are pretty easy to deal with looking up the var behind delay like this:
`
(def ^:private <!!' (delay (find-var 'clojure.core.async/<!!)))
;; then:
IDeref
(deref [this] (@<!!' this))
`
However, I'm a little stumped on how to do the equivalent with alt!!, which is a macro around do-alt and alts(image: ).