On 15 February 2010 19:37, Аркадий Рост <arkr...@gmail.com> wrote:
> I don't understand the reason to make the argument binding-map:

with-binding* is used in the definition of bound-fn*, which seems like
a pretty useful thing to have. The reason it accepts a Var / value map
is probably the fact that that's what get-thread-bindings /
push-thread-bindings operate on, which in turn makes perfect sense to
me. (They're essentially operating on environments, which are
basically maps and should be optimised for map-like usage.)

> for example, using binding macro:
> (binding [a 5] ...do something...) ;;using vector to contain bindings.
> but using with-bindings*:
> (with-bindings* {#'a 5} f args) ;;hash-map is ised to contain bindings

That's why you should just use binding most of the time and leave
with-bindings / with-bindings* for strange special cases.

> what was the reason for such implementation?

See above.

> (with-bindings* [a 5] f args) ;; it seems to be more common syntaxes

Actually, not at all! with-* functions / macros, by convention, either
take no "binding-like" argument at all (e.g. with-out-str) or whatever
"binding-like" argument makes sense (e.g.
clojure.contrib.sql/with-connection, which accepts a map of db
connection parameters).

Sincerely,
Michał

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