On Thu, Sep 13, 2012 at 8:30 AM, Herwig Hochleitner
<hhochleit...@gmail.com> wrote:
> Hello,
>
> right now, this works in clojurescript:
>
> ;; in a file lib/fancy.cljs
> (ns lib.fancy)
> (defn fun [x]
>   [:runtime :fun x])
>
> ;; in a file lib/fancy.clj
> (ns lib.fancy)
> (defmacro fun [x]
>   [:precompiled :fun x])
>
> ;; in a file app/core.clj
> (ns app.core
>   (:require
>     [lib.fancy :as fancy])
>   (:require-macros
>     [lib.fancy :as fancy]))
>
> (fancy/fun :invokation)
> ;; => [:precompiled :fun :invokation]
>
> (apply fancy/fun [:invokation])
> ;; => [:runtime :fun :invokaton]
>
> This behavior is perfectly understandable, given the compilation-phase model
> of clojurescript. It is also used in cljs.core for math functions et al.
>
> Now my question is:
>
> Is this behavior also supported for user code or does it only work
> incidentally?
> By this I mean using the same alias in :require and :require-macros, and
> refer to either of them, depending on usage?

That's how compiler macros are intended to work.

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

Reply via email to