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]))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to