Hi,

just found that a binding-form within a let-form does still use the
outer value.

user> (def *val* "root binding")
#'user/*val*
user> (defn print-val [] (println "*val* is: " *val*))
#'user/print-val
user> (defn let-vs-binding []
        (println "beginning: " *val*)
        (let [*val* "bound by let"]
          (println "in LET: " *val*)
          (print-val)
          (binding [*val* "bound by BINDING"]
            (println "in BINDING: " *val*)
            (print-val))))
#'user/let-vs-binding
user> (let-vs-binding)
beginning:  root binding
in LET:  bound by let
*val* is:  root binding
in BINDING:  bound by let
*val* is:  bound by BINDING

As far as I can see this is the documented behavior.  The rules for
resolving a symbol described in http://clojure.org/evaluation seem to
be the relevant part.

Two questions

1. Is my explanation correct?
2. Is this the desired behavior or will it change in the near future?

Kind regards,
Stefan

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