I'm looking to do something like this:

(defprotocol Addable
  (add-fields [this]))
    
(defrecord MyRecord [a b]
  Addable
  (add-fields [this] (+ a b)))

;;; Magic happens here

(defn indirect-adder [a b]
  (add-fields (MyRecord. a b)))


(with-definition-of-add-fields-changed-to (fn [_] "hi mom")
    (indirect-adder 1 2)
=> "hi mom" ; rather than 3

I expect there are no tricks like :dynamic true <http://blog.n01se.net/?p=134> 
that work, but I thought I'd check.

-----
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Occasional consulting on Agile
www.exampler.com, www.twitter.com/marick

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