No, because that global mutable variable would need to be specifiable by Specter on usage of the library. For example, if you wrote:
(defn foo [] (select [:a :b] {:a {:b 1}})) `select` has no ability to control anything outside the context of its form. It certainly can't wrap `foo` to put a volatile field in its closure. So for the static-field idea, it would expand to something like: (defn foo [] (static-field [pathcache] (if-not pathcache (set! pathcache ...)) ... )) On Tuesday, May 31, 2016 at 3:15:26 PM UTC-4, puzzler wrote: > > In your writeup, you say that there would be further speed benefits if you > could have a global mutable variable within the context of a function (like > a static field). > > Can't you effectively accomplish that already in Clojure like this?: > > (let [mycache (volatile! nil)] > (defn foo [] > ...))) > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.