http://clojure.org/lisps

"All (global) Vars can be dynamically rebound without interfering with
lexical local bindings. No special declarations are necessary to
distinguish between dynamic and lexical bindings."

Other part of that explanation is whether x in a given piece of code
refers to a lexical (local) or dynamic (global) value.
It seems that if there's a local value available for x, it always
hides the global value for x.
Global value is only looked up when there's no local value available
in the surrounding text.

binding may look like a lexical construct, since it has braces that
enclose an area of code, but it's not.
It affects code that actually executes during that time, not code that
was written in that space.

And yeah, dynamic scope interacting with laziness is the single most
confusing thing about Clojure, even if you've had a little lisp
experience.
Use the variants of def just for functions or macros; use ref or let
for variables; avoid using binding.

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

Reply via email to