Re: hooks on "namespace required/loaded"

2014-02-18 Thread t x
@Joel: While on IRC, I completely misunderstood you. Now, after looking at it again, it makes sense. This is very cool -- because making it a macro forces it to be evaluated at compile time, when the source is available. Very nice. :-) @Andy Thanks! I will look into load-libs. The foll

Re: hooks on "namespace required/loaded"

2014-02-18 Thread Andy Fingerhut
I am not sure about ClojureScript, but in Clojure/Java you can use alter-var-root to change the definition of load-libs, which is called by both require and use. You can use alter-var-root to change the definition of any function you want in clojure.core or any other namespace. I wouldn't recomme

Re: hooks on "namespace required/loaded"

2014-02-18 Thread Joel Holdbrooks
I know we talked a bit about this in IRC but this is a hack you could use to slurp the file's contents into a string in that file: (ns foo.core (:refer-clojure :exclude [slurp])) (defmacro slurp [file] (clojure.core/slurp file)) ;; In CLJS (ns bar.core (:require [foo.core :include-mac

Re: hooks on "namespace required/loaded"

2014-02-18 Thread t x
With apologies for spamming: Solutions that involves installing a new lein plugin is fine too. I'm willing to completely re-organize my workflow in order to * have some other piece of Clojure code gets called / do verification whenever a clojure namespace is required/loaded/reloaded / Don

Re: hooks on "namespace required/loaded"

2014-02-18 Thread t x
As a point of clarification, read-string is not a hard requirement. Just getting the name of the namespace (and walking through the symbols + calling source on each of them to get the source code is perfeclty fine). Basically, I want to hook a function that * gets called every time a namespace i

hooks on "namespace required/loaded"

2014-02-18 Thread t x
Hi, Although solutions not involving cljx are perfectly fine, I'm using cljx -- so solutions that involves hooking into cljx are perfectly fine too. I have my own "poor-man's lint / type checker" (with different objectives from core.typed). I want a certain function (call it CHECKER) to be ca