On Mar 26, 2009, at 22:44, srader wrote: > When I type the following in at the REPL: > > (def foo (ref {} :meta {:type :t})) > > and then try to print it, I get the following error: > > java.lang.ClassCastException: clojure.lang.Ref (NO_SOURCE_FILE:0) > [Thrown class clojure.lang.Compiler$CompilerException] > > Is this a bug?
I'd say yes. Here's what happens: Typing "foo" at the REPL causes a call to clojure.core/print-method. This is a multimethod that dispatches on the result of clojure.core/type, which is the value of the :type tag in the metadata if there is one. Since there is no implementation for type :t, the default implementation is called, which is: (defmethod print-method :default [o, #^Writer w] (print-method (vary-meta o #(dissoc % :type)) w)) It is the call to vary-meta that fails for a ref. Konrad. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---