I've been seeing this weird looping behavior with some go loops over the last few days. An exception is being thrown from a function within the loop and rather than logging and looping back around to a waiting take, the loop seems to just hop back to the line before the function call. It's been driving me crazy, because it's, well, crazy :)
I think i've managed to boil it down to the following: (def s (chan)) (def single (go-loop [] (try (prn "Awaiting single") (<! s) (prn "Single") (throw (new Throwable)) (catch Throwable t (prn t))) (recur))) (def d (chan)) (def double (go-loop [] (try (prn "Awaiting double") (<! d) (prn "Double") (throw (new Throwable)) (catch Exception re (prn re)) (catch Throwable t (prn t))) (recur))) Now if you (>!! s :a), you'll see the throwable printed out and the loop go back to waiting on the s channel. However, (>!! d :a) and you'll get to enjoy an infinite stream of 'Double'. In actual fact you can remove the -loop from double and get the same result. Not sure what's going on here at all. In the macro expanded version of double '(prn t)' doesn't appear at all (it does in single's expansion), so it looks like it's not surviving the move into the state machine and instead is routing back to (prn "Double") or the take isn't really completing somehow, leaving the :a on the chan. Either way it doesn't seem right! I'd love for someone to shed some light on this behavior and/or point me at something that would explain it. -- 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.