Hi Phil, It's a good question.
Syntax quote is designed for generating code/syntax that is deterministic and avoids accidental local name capture. 1. Automatic namespace qualification helps avoid accidental local name capture in macros. user=> `(let [a# 1 b# a] a#) (clojure.core/let [a__48963__auto__ 1 b__48964__auto__ user/a] a__48963__auto__) The binding for b# shows a common mistake. By namespace qualifying "a" to "user/a", we don't allow the possibility of accidentally capturing locals. eg. "a" is not captured in the body (let [a 'evil] (clojure.core/let [a__48963__auto__ 1 b__48964__auto__ user/a] a__48963__auto__)) 2. Automatic namespace qualification helps make code deterministic with respect to the namespace of the consumer of a macro. Syntax quote resolves vars in the namespace the *macro* is defined in. This avoids odd situations where different vars are invoked depending on which namespace we use the macro. Bottom line: syntax quote is designed for macros by default. All the good properties of syntax quote can be avoided using combinations of quote, syntax quote and splice. eg. `~'a ;=> a Thanks, Ambrose On Thu, Jun 20, 2013 at 3:49 PM, Phillip Lord <phillip.l...@newcastle.ac.uk>wrote: > Jim <jimpil1...@gmail.com> writes: > > On 19/06/13 09:46, Phillip Lord wrote: > >> With the ' paul is not namespace qualified, while with the ` paul is. > >> > >> > >> Turns out to be a bit of a pain, actually, although I have worked around > >> it. But mostly I am surprised. Is this expected? > > > > Yes, this is very much expected! :) > > > > How else would you be able to write macros without ` ? > > Well, that doesn't answer the question. The backtick is useful in > writing macros (although the situation this caused me grief, actually, I > wasn't). So is quote. But then I do not understand why the behaviour is > different between the two. > > > Vars needs to resolve to something eventually... > > There are no vars involved here. `paul expands to a namespace qualified > symbol irrespective of the existence of a var. > > Phil > > -- > -- > 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 > --- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.