2010/1/10 Nicolas Buduroi <nbudu...@gmail.com>: > That was it, thanks a lot.
Ah great. My understanding is that type meta data should go on the object not the var, but that integers for example do not support meta data as they are java objects. Only things like vectors and hash maps do. So you can not set an integer 'type' unless you put it in a IObj container. It is possible to make the :default print-method only attempt to vary-meta if o is indeed an IObj: (defmethod print-method :default [o, #^java.io.Writer w] (if (instance? clojure.lang.IObj o) (print-method (vary-meta o #(dissoc % :type)) w) (.write w (str o)))) user=> (defbar fuz 1) #'user/fuz But I doubt this is really what you are aiming for user=> (type fuz) java.lang.Integer user=> (type (var fuz)) :user/MyType I think you would want (type fuz) to be :user/MyType, which I do not think is possible with integers user=> (type (vary-meta [1 2 3] assoc :type :user/MyType)) :user/MyType user=> (type (vary-meta 1 assoc :type :user/MyType)) java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IObj (NO_SOURCE_FILE:0) So I think the source of the exception is clear, but have you found a solution to your original problem? Maybe if you expand on that someone can describe a good technique. Regards, Tim.
-- 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