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-macros true :refer [slurp]])) ;; This is possible because we can evaluate *Clojure* code at compile time. (def project-clj (slurp "project.clj")) >From there you could then use read-string, or what have you, and examine the contents. Here's a link to the gist for reference: https://gist.github.com/noprompt/9086232. On Tuesday, February 18, 2014 8:32:05 PM UTC-8, t x wrote: > > 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 called every time a namespace has been "required / > loaded / reloaded" > > Every time I require/load/reload a namespace, I want the following to > happen: > > (CHECKER ... source code of the namesapce) > > i.e. something like > > (CHECKER (read-string "namesapce-just-loaded.clj")) > > Then, if CHECKER throws an exception, it should be a compile error. If > CHECKER prints stuff out, it should go into the "lein repl" stdout, > and if CHECKER doesn't do anything, it's assumed that the namespace > passed the check. > > Is there a minimal example somewhere of how this works? (i.e. > something as stupid as: "this example calls a function, which just > prints out the name of all functions defined" would be extremely > helpful). > > Thanks! > -- 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/groups/opt_out.