clj-commons / potemkin

some ideas which are almost good
572 stars 53 forks source link

:forms meta data loses quoting #12

Closed genovese closed 10 years ago

genovese commented 11 years ago

Hey Zach,

Thanks for a great package here. It's very handy

I've had a small issue with some macros that use :forms meta data (like let does) to provide a usage summary in documentation automatically. This is a quoted data structure, but it loses its quotes under import-vars (i.e., import-macro).

For instance,

(ns A)
(defmacro a 
  "doc"
  {:forms '[(a [bbb] ccc)]}
  [b]
  `(list :do :something :with ~b))
(ns B
  (:require potemkin A))
(potemkin/import-vars (A a))

will raise an error like

CompilerException java.lang.RuntimeException: Unable to resolve symbol: bbb in this context, compiling....

This isn't specific to :forms of course; I just happen to have a use for that case. The same issue arises with quoted forms in metadata, with the quoted form losing its quoting protection when being expanded by import-vars and then apparently being evaluated/compiled subsequently.

Thanks,

Chris

ztellman commented 10 years ago

This appears to be fixed in the current version.