diff --git a/CHANGES.md b/CHANGES.md index b4a2fae..9f4498f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ ## 1.1.3-SNAPSHOT +* Better AOT behavior: path functions for inline caching and protpath extensions no longer write eval'd class files. You can force path functions to not override `*compile-files*` by binding `com.rpl.specter.impl/*path-compile-files*` to `true`. * Bug fix: fix throw-illegal in cljs ## 1.1.2 - 2018-11-01 diff --git a/src/clj/com/rpl/specter.cljc b/src/clj/com/rpl/specter.cljc index 8738cfd..8d76326 100644 --- a/src/clj/com/rpl/specter.cljc +++ b/src/clj/com/rpl/specter.cljc @@ -456,7 +456,8 @@ params (-> protpath-prot :sigs first last :arglists first)] (doseq [[atype path-code] extensions] (extend atype protpath-prot - {m (eval `(fn ~params (path ~path-code)))})))) + {m (binding [*compile-files* false] + (eval `(fn ~params (path ~path-code))))})))) (defmacro extend-protocolpath "Used in conjunction with `defprotocolpath`. See [[defprotocolpath]]." diff --git a/src/clj/com/rpl/specter/impl.cljc b/src/clj/com/rpl/specter/impl.cljc index 3f990fc..ede71e2 100644 --- a/src/clj/com/rpl/specter/impl.cljc +++ b/src/clj/com/rpl/specter/impl.cljc @@ -908,6 +908,8 @@ (if (fn? e) (re-find #" .*" (pr-str e)) e)) o))) +(def ^:dynamic *path-compile-files* false) + #?(:clj (defn mk-dynamic-path-maker [resolved-code ns-str used-locals-list possible-param] (let [code `(fn [~@used-locals-list] ~resolved-code) @@ -916,7 +918,11 @@ (println "Produced code:") (pp/pprint code) (println)) - (binding [*ns* ns] (eval+ code)))) + (binding [*ns* ns + *compile-files* (if *path-compile-files* + *compile-files* + false)] + (eval+ code)))) :cljs (defn mk-dynamic-path-maker [resolved-code ns-str used-locals-list possible-params]