I've opened an enhancement ticket with a patch that changes this behaviour btw: http://dev.clojure.org/jira/browse/CLJ-1715
Alexey Cherkaev writes: > Hi, > > I have encountered the problem with Clojure 1.6.0, when I create the record > that implements IFn. > > For example, > > (defrecord Foo [x] > clojure.lang.IFn > (invoke [_ f] (f x))) > > Than create an instance of this record: > > (def f (->Foo 10)) > > And we can call it without a problem: > > user=> (f inc) > 11 > > Yet, if you try to define a value to keep the result, compiler throws an > error: > > user=> (def z (f inc)) > > CompilerException java.lang.AbstractMethodError, > compiling:(form-init4774307052978984831.clj:1:8) > > There is workaround: create local binding first and then assign the value > to a global variable: > > user=> (def z (let [temp (f inc)] temp)) > #'user/z > user=> z > 11 > > Is this a bug or I don't fully understand why you can't do that? > > Cheers, Alexey -- -- 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/d/optout.