Clojure sometimes inlines functions. `every?` is an example. As a result, you 
can have a function that uses `every?`, call it like so:

(with-redefs [every? (fn [& args] (println "Hi mom!") false)]
   (function-that-calls-every))

... and not get the results that the text of the program calls for. 

This behavior with inlined functions has led to something like three 
independent confused messages to the Midje mailing list. I don't relish having 
to explain the issue forevermore. Is it a reasonable enhancement request to ask 
that `with-redefs` blow up when given a function that will be inlined? 
Alternately, could {:will-be-inlined true} be added to the metadata of such 
vars so that tools like Midje can check for themselves?

(My preferred solution would be a way to turn off this and other optimizations 
that change behavior in edge cases, but I believe that's already been ruled 
out.)

-----
Brian Marick, Artisanal Labrador
Now working at http://path11.com
Contract programming in Ruby and Clojure
Occasional consulting on Agile


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