with-open and with-local-vars couldn't be thunks - the whole point is
creating some lexical variables in the caller's scope. Instead of
(with-open [f (file)] (stuff f)) you could require (open-callback (fn
[f] (stuff f)) (file)): either could expand into something like ((fn
[f] (stuff f)) (file)), but at that point you're just transforming let
into fn for fun, and costing yourself efficiency in exchange.

On Dec 22, 1:54 pm, Peter Danenberg <p...@roxygen.org> wrote:
> Scheme, for instance, obeys the Law of Macro-Parsimony: "don't use
> defmacro," namely, "where defn will suffice;" Clojure, on the other
> hand, is macro-liberal.
>
> In other words, everyone seems to prefer e.g. `(defmacro foo [vars &
> body] `(do ... ~@body))' where `(defn foo [vars thunk] ... (thunk))' would
> suffice; cases in point:
>
>   with-bindings
>   with-bindings*
>   with-in-str
>   with-local-vars
>   with-open
>   with-out-str
>   with-precision
>   with-redefs
>
> Why?

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