On Mar 9, 12:00 am, Tassilo Horn <tass...@member.fsf.org> wrote: > Alan <a...@malloys.org> writes: > > Hi Alan, > > > And yes, it slows things down a bit, so in 1.3 the default is to not > > support rebinding (though re-def'ing is still supported). > > What do you mean by doesn't support rebinding? Does that mean, that > things like > > (def foo false) > (binding [foo true] (dostuff)) > (let [foo true] (dostuff) (println foo)) > > aren't supported anymore? > > BTW, I'm new to clojure, so I just got a question concerning binding > versus let right now. If `dostuff' is a function that only prints the > value of foo, am I right that the `binding' line would print "true", > whereas the the `let' line prints "false" and "true", because the > dostuff-print is not in the lexical scope of the let, right? > > Bye, > Tassilo
You are correct about how binding and let behave. As Ghoseb says, you can get this behavior back in 1.3 with (def ^:dynamic foo false). The behavior of let has not changed in 1.3: Your let-form will perform identically, because it is not rebinding the global #'foo var: it is creating a new local symbol with name 'foo and value true. As in 1.2, (dostuff) will still see #'foo as false, and the println will still see 'foo as true. -- 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