On Tuesday, February 17, 2015 at 1:39:02 AM UTC-6, Ivan L wrote:
> Let's say I have a namespace in clj mylib.macros.
> It has functions as well as macros.
> Some macros are defined as calling other macros or functions.
> 
> I want to use it in cljs mylib.views.
> 
> How do I define the macro namespace and how do I pull it in the views 
> namespace?  Finally, how would a third party consumer of mylib use an item 
> from views namespace, or directly from the macros namespace?

Well, in your mylib.view or mylib/view.cljs you could use the next statement:

(ns mylib.views
  (:require-macros [mylib.macros :refer [your-macro-1 your-macro-2 ...]]))

And for your users... what other or all (I guess) authors do is that, for 
example, you could name your library mylib.core so you could have two files 
core.clj and core.cljs in your mylib directory. So your clj file will contain 
your macros and your cljs file will have your public functions or api. Then 
your users will have to:

(ns your-users.namespace
  (:require [mylib.core :include-macros true])) ;; if they want to include all 
                                                ;; macros

or 

(ns your-users.namespace
  (:require [mylib.core :refer-macros [your-macro-1 your-macro-2 ...]]))

Hope it helps.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to