When I encountered this post, my instinct was to suggest that he write a specific macro to bind these particular variables rather than depend on magic to make new bindings at run-time from symbols known only at run-time, a la:
(defmacro with-a-b-c [m & body] `(let [mp# ,mp] a (:a mp#) b (:b mp#) c (:c mp#)] ~...@body)) Is this a more "idiomatic" solution or a more "lispy" one, or am I laboring under a misunderstanding? -V On Aug 8, 5:24 pm, John Harrop <jharrop...@gmail.com> wrote: > On Sat, Aug 8, 2009 at 9:52 AM, Rich Hickey <richhic...@gmail.com> wrote: > > > On Sat, Aug 8, 2009 at 5:53 AM, Meikel Brandmeyer<m...@kotka.de> wrote: > > > Hi, > > > > Am 08.08.2009 um 02:52 schrieb samppi: > > > >> Great, thanks. Is clojure.lang.Var/pushThreadBindings a public, > > >> supported part of the API? Can I use it without fear of suddenly > > >> dropped support? > > > > It is was `binding` uses internally. Unfortunately > > > this is not exported by Clojure's public API. I - > > > unfortunately - have to rely on this hack. > > > get-/push-/pop-thread-bindings wrapping Var.get/push/popThreadBindings > > would be a welcome issue/patch. > > > Note the addition of getThreadBindings(), which returns a map of all > > the current bindings. This could be used to define a > > function-returning macro that can be used when you want to pass a > > helper function to another thread and have it use the bindings in > > effect at the point of its creation. > > It occurs to me that the above would also allow stored functions to carry > thread-local bindings with them. The obvious application being to fix the > interaction between thread-local bindings and lazy seqs. They could also > potentially even be used in code run in a future. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---