On Wed, Mar 21, 2012 at 1:12 AM, Evan Mezeske <emeze...@gmail.com> wrote: > Hi, > > I'm working on some tools for making it easier to share generic Clojure code > between Clojure and ClojureScript, and one problem that does not seem to > have a pretty solution is that of requiring macros. Clojure uses a regular > (:require ...) whereas ClojureScript needs a (:require-macros ...). I > understand that the distinction is necessary for ClojureScript because > macros are written in Clojure. > > This difference in the (ns ...) form is troublesome when trying to share > code between the two languages. Right now, the only solution is to > copy+edit the shared file (possibly with an automated tool) so that it has > :require and :require-macros as appropriate. This is not very pretty. > > So that gets me to wondering, has anyone brought up the idea of using > metadata to identify macro namespaces? So instead of using :require-macros, > :require would be used, but each namespace identifier would be inspected to > see if it had ^{:macros true}. > > > ; The existing way to require macros from ClojureScript: > > (ns example.shared > (:require-macros > [example.macros :as macros]) > (:require > [example.other :as other])) > > > > (ns example.shared > (:require > ^:macros [example.macros :as macros] > [example.other :as other]))
That might be one way to do it. The other obvious one is to implement :require-macros in Clojure's ns macro, as a synonym for require, and make sure require(-macros) is idempotent. -- 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