Hi all, If the function executed in a future throws an error it is printed out in the repl immediately. If that function is executed in a future which itself is executed in a future then it isn't.
For example, imagine somebody wrote the following code (please, suspend belief and just accept people do do this when learning Clojure :)): [code] ;; some silly code user> (swap! atom inc 0) ClassCastException clojure.core$atom cannot be cast to clojure.lang.Atom clojure.core/swap! (core.clj:2161) ;; silly code wrapped in a future user> (future (swap! atom inc 0)) ClassCastException clojure.core$atom cannot be cast to clojure.lang.Atom clojure.core/swap! (core.clj:2161) ;; silly code wrapped in a future wrapped in a future user> (future (future (swap! atom inc 0))) #<core$future_call$reify__6267@11e55d39: :pending> user> [/code] My understanding is that future executes its delegate in a separate thread, hence the "(future (swa...))" code prints out the exception almost immediately. I don't understand why the nested future doesn't print out the error though as it should surely be executed almost immediately as well? Of course, if you dereference the call then it prints out the stack trace. As to why you would want a future in a future...that is a different kettle of fish :). -- -- 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.