def with a function value returns meta {:macro false}, but def itself doesn't have meta


  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Not Reproducible
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:


On the master (1.2) branch, if you create a def with an initial function value, {:macro false} is added to the metadata of the return value for def. However, if you look again at the metadata on the var itself, the {:macro false} is not present! This breaks the use of contrib's defalias when aliasing macros, because the new alias is marked as {:macro false}.

The code below demonstrates the issue, which was introduced in, "metadata for fns."

;; all running on 1.2, DIFF noted in comments

(defmacro foo [])
-> #'user/foo

(meta (def bar (.getRoot #'foo)))
-> {:macro false, :ns #<Namespace user>, :name bar, :file "NO_SOURCE_PATH", :line 83}
;; DIFF: where did that :macro false come from??

(def bar (.getRoot #'foo))
-> #'user/bar

(meta #'bar)
-> {:ns #<Namespace user>, :name bar, :file "NO_SOURCE_PATH", :line 84}
;; LIKE 1.1, but really weird: now the :macro false is gone again!


Alex Miller made changes -
Field Original Value New Value
Fix Version/s Backlog [ 10035 ]
Alex Miller made changes -
Priority Major [ 3 ]
Alex Miller made changes -
Status Open [ 1 ] Closed [ 6 ]
Resolution Not Reproducible [ 4 ]


Vote (0)
Watch (0)


  • Created: