Mark Volkmann <r.mark.volkm...@gmail.com> writes: >> Whoops, this caught me today. Whereas "let" evaluates its bindings >> sequentially, "binding" does not! Observe: >> >> (def a "a1") >> (def b "b1") >> >> (let [a "a2", b a] b) >> ;;=> "a2" >> >> (binding [a "a2", b a] b) >> ;;=> "a1" >> >> I wouldn't call this a bug, but I think it's worth noting in the doc >> string for "binding". > > Is there a reason why it's better if binding isn't required to > evaluate the bindings sequentially? It sure would be nice if they both > did that unless there's a compelling reason not to.
I got bit by this a couple weeks ago. Apparently it's easy to implement in let without sacrificing performance, but the same is not true of binding. (I'm just repeating what I heard on IRC.) The asymmetry of it is unfortunate, but I think it's definitely worth the convenience in the let case. It's definitely nicer than having let, let*, and letrec all be separate forms as in Scheme. Certainly worth mentioning in the docstring though. -Phil --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---