Re: Bug report: function metadata is broken
On 13 Jul., 12:03, Meikel Brandmeyer m...@kotka.de wrote: I'm not sure, though, why the metadata gets moved to the function on redefinition. Does anyone know why this is so? (defn foo [x] x) (defn foo [x y] (+ x y)) (:arglists (meta (var foo))) == ([x y]) (:arglists (meta foo)) == ([x]) Thanks, Andreas -- 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
Bug report: function metadata is broken
Hi, I asked in the IRC channel about metadata on functions[1], and was told that it's indeed possible in 1.2. I tried this at the REPL and saw the following behavior (which looks like a bug): user= (defn ^{:foo v1.0} mfoo mfoo docstring [] (println foo v1.0)) #'user/mfoo user= (meta mfoo) {:ns #Namespace user, :name mfoo} user= (mfoo) foo v1.0 nil user= (defn ^{:foo v2.0} mfoo mfoo docstring [] (println foo v2.0)) #'user/mfoo user= (meta mfoo) {:ns #Namespace user, :name mfoo, :file NO_SOURCE_PATH, :line 33, :arglists ([]), :doc mfoo docstring, :foo v1.0} user= (mfoo) foo v2.0 nil This is from the latest source: $ git remote -v originhttp://github.com/clojure/clojure.git (fetch) originhttp://github.com/clojure/clojure.git (push) $ git rev-parse HEAD d184ed95817c5ddfd5874ea75e83e0df7e753c24 It appears I can't create new tickets on assembla[2], so I'm posting to the mailing list instead. Thanks! Mike [1] http://clojure-log.n01se.net/#04:25 [2] http://www.assembla.com/spaces/clojure/tickets -- 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
Re: Bug report: function metadata is broken
Hi, On Jul 13, 11:52 am, Mike Mazur mma...@gmail.com wrote: I asked in the IRC channel about metadata on functions[1], and was told that it's indeed possible in 1.2. I tried this at the REPL and saw the following behavior (which looks like a bug): user= (defn ^{:foo v1.0} mfoo mfoo docstring [] (println foo v1.0)) #'user/mfoo user= (meta mfoo) {:ns #Namespace user, :name mfoo} user= (mfoo) foo v1.0 nil user= (defn ^{:foo v2.0} mfoo mfoo docstring [] (println foo v2.0)) #'user/mfoo user= (meta mfoo) {:ns #Namespace user, :name mfoo, :file NO_SOURCE_PATH, :line 33, :arglists ([]), :doc mfoo docstring, :foo v1.0} user= (mfoo) foo v2.0 nil Metadata on functions works as expected: user= (meta (with-meta (fn [] :with-meta) {:foo v1.0})) {:foo v1.0} Hinting the argument to defn (or providing the optional meta map) attaches the metadata to the Var: user= (defn ^{:mfoo v1.0} mfoo mfoo docstring {:foo v1.0} [] (println foo v1.0)) #'user/mfoo user= (meta #'mfoo) {:ns #Namespace user, :name mfoo, :file NO_SOURCE_PATH, :line 1, :arglists ([]), :foo v1.0, :doc mfoo docstring, :mfoo v1.0} user= (meta mfoo) {:ns #Namespace user, :name mfoo} I'm not sure, though, why the metadata gets moved to the function on redefinition. Sincerely Meikel -- 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