clj-commons / manifold

A compatibility layer for event-driven abstractions
1.02k stars 108 forks source link

Trouble with lazy sequences #32

Closed ekimber closed 9 years ago

ekimber commented 9 years ago

Some of my deferreds yield a LazySeq. This seems to break manifold. Is there something I've misunderstood here? I can get around this by delazifying the result.

Here's an example of what I'm talking about:

@(d/chain [1 2 3] (fn [x] (map #(* 2 %) x)))
ClassCastException clojure.lang.LazySeq cannot be cast to java.util.concurrent.Future  clojure.core/deref-future (core.clj:2180)
@(d/chain [1 2 3] (fn [x] (vec (map #(* 2 %) x))))
=> [2 4 6]
ztellman commented 9 years ago

I'm unable to reproduce this in the latest code. There was an issue in earlier versions where lazy seqs, which implement clojure.lang.IPending, would be treated as a deferred value, but that has since been fixed. Let me know if you have any issues with the latest formal release, and I'll cut a new one.

ekimber commented 9 years ago

This was on 0.1.0-beta11, which is the latest release. You're right though, it's fixed in the snapshot build.

ztellman commented 9 years ago

Sorry, I had thought this fix had already been released. Thanks for the heads up.

ekimber commented 9 years ago

Cool, thanks for the library! It's very useful.