Hi,

On Aug 21, 8:34 am, gutzofter <gutzof...@gmail.com> wrote:

> (defmacro macro-hello []
>   `"hello")
>
> (defn -main []
>   (println (eval '(= 0 0))) ;works
>   (println (eval '(com.yourcompany.defpackage/macro-hello))) ;works
>   (println (eval `(macro-hello))) ;works
>   (println (eval '(macro-hello))) ;does not work
>   )
>
> seems that backquote resolves namespace while quote doesn't.
>
> Can you point me in the right direction concerning backquote and
> quote?

http://clojure.org/reader

My suspicion is, that the macro call is done by `eval` in the
clojure.core namespace, not the namespace of your file. The ` resolves
the symbol to `com.yourcompany.defpackage/macro-hello` which will also
work in the clojure.core namespace, since it is fully qualified. '
does not resolve the symbol and since clojure.core doesn't have a
`macro-hello`, you get the error.

For real-life use, you should only use `. ' is only useful for well-
defined DSLs, but not for macros. (read: hygiene)

Avoid `eval`. It will come back to haunt you.

Sincerely
Meikel

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