I want the next version of Midje to continue to support Clojure 1.3. I also 
want to use  `leiningen.core.project`. `leiningen.core.project` uses `ex-info`, 
which was introduced in 1.4. I want to write my own version of `ex-info` and 
put it into `clojure.core` when we're running under 1.3 --- in such a way that 
`leiningen.core.project` will see that fake version when it's `required`. 

I thought I could do this:

    user=> (in-ns 'clojure.core)
    clojure.core=> (defn ex-info [& args] "stuff here")
    clojure.core=> (in-ns 'user)
    user=> (require 'leiningen.core.project)

Indeed, that works fine in the repl. However, it doesn't work when the first 
three lines are in a file. Specifically, this fails:

    (ns midje.repl
      (:require ...
            midje.util.backwards-compatible-utils
            [leiningen.core.project :as project]         

... when `m.u.backwards-compatible-utils` contains:

    (when (ecosystem/clojure-1-3?)
      (in-ns 'clojure.core)
      (defn ex-info ...)
      (in-ns 'midje.util.backwards-compatible-utils))

Why not? What should I do instead?


-----
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Occasional consulting on Agile
Author of /Functional Programming for the Object-Oriented Programmer/: 
https://leanpub.com/fp-oo


-- 
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

Reply via email to