Thanks Sebastian for the thoughtful and helpful document! I like it and have shared it with my group.
> On Aug 13, 2015, at 1:51 PM, Sebastian Bensusan <sbe...@gmail.com> wrote: > > > I never thought of laziness! It's a good point. Retroactively I might add it > to the Functional Style section :) You did a nice job of presenting both pros and cons for the other features of Clojure, and I expect there would be something similar for your entry on laziness.... but FWIW from my perspective the cons here are more significant than for any other feature (and I know that opinions will vary on this!). I know that no language is perfect for everyone or every purpose, but at least from my perspective pervasive laziness is "one of Clojure's very few true mistakes" (sort of like my father-in-law says that "eggplant is one of god's very few true mistakes"). Laziness is often glorious and elegant, and the way that it's everywhere by default in Clojure is quite cool. But in a not-purely-functional environment it can cause weird problems at unexpected times and in unexpected places. There are several ways to get into trouble -- there was a nice blog post on some of them years ago, maybe by Chas Emerick? -- but I think most of my own come from the not-purely-functional nature of synchronization, awaiting the completion of tasks dispatched to agents. Symptoms that I get include the saturation of only one core when I expect to be saturating all of them, and sometimes out-of-memory errors. I think the former are due to delayed lazy computations taking place at unexpected times, and that the latter come from GC not collecting things that it would know it could collect if the deferred computations were completed in a non-lazy way. It has been hard to replicate or track down the sources of these problems, but they do always go away when I un-lazify everything -- coercing sequences to vectors, calling doall, changing every call to map to mapv, etc. Because these problems are so hard to diagnose and think about, I've taken to pre-emptively avoiding laziness whenever possible, unless I really want it (which is relatively rare, for me). This can be a bit awkward, and it's one of the very few things that I feel like I have to apologize for when I introduce Clojure to students. -Lee -- 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.