macroexpand and syntax-quote

42 views
Skip to first unread message

bentav

unread,
Oct 3, 2015, 10:44:11 AM10/3/15
to Clojure
Common Lisp:

(defmacro foo ()
 
`(defmacro bar ()
    `
(baz)))

(macroexpand-1 '(foo))

=> (DEFMACRO BAR () `(BAZ))




Clojure:

(defmacro foo []
 
`(defmacro bar []
    `
(baz)))

(macroexpand-1 '(foo))

=> (clojure.core/defmacro user/bar [] (clojure.core/seq (clojure.core/concat (clojure.core/list (quote user/baz)))))


Looks awful. Is it possible to do something about that?

Gary Verhaegen

unread,
Oct 3, 2015, 2:37:36 PM10/3/15
to clo...@googlegroups.com
This is very much by design. Clojure is somewhere between Common Lisp and Scheme in terms of macro hygiene.

Being compatible with Common Lisp is explicitly not a goal for Clojure. Watch out for similarly named functions with different behavior too.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages