Thanks Thomas.

On Thursday, 26 February 2015 19:57:39 UTC+10, Thomas Heller  wrote:
> If you change it to
> 
> ;; In src/cljs/fancy/fancy.cljs: 
> (ns fancy.fancy
>   (:require-macros [fancy.fancy :as m]) 
> 
> ;; In src/cljs/fancy/core.cljs: 
> (ns fancy.core 
>   (:require 
>     [fancy.fancy :as fancy]))
> 
> 
> (fancy/fun 123) should then always equal the macro version (unless you use 
> apply). The namespace that provides the macros must require them itself for 
> the new stuff to work.
> 
> On Thursday, February 26, 2015 at 7:28:38 AM UTC+1, Peter West wrote:
> > 
> > In 2012 on the Clojure list, there was a conversation about cljs files 
> > sharing the same name with clj macro files.
> > 
> > http://grokbase.com/t/gg/clojure/129d4g0ppq/macros-shadowing-defn-in-clojurescript-akin-to-definiline
> > 
> > I tried essentially the same code with the current version of clojurescript.
> > 
> > ;; In src/cljs/fancy/core.cljs:
> > (ns fancy.core
> >   (:require
> >     [fancy.fancy :as fancy])
> >   (:require-macros [fancy.fancy :as fancy]))
> > 
> > (defn incljs []
> >   (js/alert (apply fancy/fun ["cljs non macro"])))
> > 
> > (defn inclj []
> >   (js/alert (fancy/fun "clj macros")) )
> > 
> > ;; In src/cljs/fancy/fancy.cljs:
> > (ns fancy.fancy)
> > 
> > (defn fun [x]
> >       [:runtime :fun x])
> > 
> > ;; In src/clj/fancy/fancy.clj:
> > (ns fancy.fancy)
> > 
> > (defmacro fun [x]
> >   [:precompiled :fun x])
> > 
> > ;; fancy.html
> > <html>
> > <body>
> >     <button onclick="fancy.core.incljs()">CLJS</button>
> >     <button onclick="fancy.core.inclj()">CLJ</button>
> >     <script src="resources/public/js/fancy.js"></script>
> > </body>
> > </html>
> > 
> > When I run this, I get the :runtime output from the CLJS button, and the 
> > :precompiled output from the CLJ button.
> > 
> > However, if I remove the :require-macros form from core.cljs I get the 
> > :runtime output from both.  Is this as expected?

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to