Thanks for the insight, Konrad. I know this is a sideshow to the larger discussion on types, but it does present an unexpected usability issue.
On 26 February 2009 at 02:44, Konrad Hinsen wrote: > The fix is to provide a default implementation for print-method. Try > executing this: > > (defmethod print-method :default [o w] (print-method "failed" w)) This prevents the stack overflow. But I'd prefer a more forgiving default print behavior. > There should be a default in clojure.core, but I am not > sure what it should best be. Should it print the object stripped of > its metadata? I vote for this. A default that re-dispatches on class (as you suggested, stripping the :type metadata), falls back to the previous print behavior. (defmethod print-method :default [o, #^java.io.Writer w] (if (:type (meta o)) (print-method (with-meta o (dissoc (meta o) :type)) w) (do (.write w "#<") (.write w (.getSimpleName (class o))) (.write w " ") (.write w (str o)) (.write w ">")))) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---