On Feb 13, 2009, at 13:31, Mark Volkmann wrote:

> What are some reasons to use with-local-vars instead of let or  
> binding?

Let just creates bindings for a lexical scope. They cannot be  
modified at all.

Binding and with-local-vars deal with vars, i.e. mutable references.  
Binding creates a dynamic scope for already existing vars that are  
accessible in some namespace. With-local-vars also creates a dynamic  
scope, but for newly created anonymous vars.

So far for the theory. I have to admit that in my own experience,  
every time I considered using with-local-vars, I ended up realising  
that what I really wanted is atoms or refs. Which means that I cannot  
cite a use case for with-local-vars. I scanned through the source  
code of clojure and clojure-contrib to see if with-local-vars is used  
anywhere at all, but the answer is no.

Konrad.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to