Self-hosted ClojureScript supports defmacro in the same way that regular 
ClojureScript supports defmacro. In particular, macros must be defined 
separately from runtime code. And, perforce, macros must be written in 
ClojureScript (or, alternatively, they can be in a .clj file, so long as the 
Clojure in that file happens to also be ClojureScript.)

See this for more exposition on this:  
http://blog.fikesfarm.com/posts/2015-06-19-portable-macro-musing.html 
<http://blog.fikesfarm.com/posts/2015-06-19-portable-macro-musing.html>

Also, if you’d like to just mess around with macros within a self-hosted 
ClojureScript REPL, it _is_ possible to do if you play games with the way 
things work under the hood. This is covered in more detail here: 
http://blog.fikesfarm.com/posts/2015-09-07-messing-with-macros-at-the-repl.html 
<http://blog.fikesfarm.com/posts/2015-09-07-messing-with-macros-at-the-repl.html>

For your example below this ends up looking like:

cljs.user=> (ns foo.core$macros)
nil
foo.core$macros=> (defmacro m [x] `(- ~x))
true
foo.core$macros=> (foo.core/m 1)
-1

- Mike

> On Sep 13, 2015, at 10:43 AM, ZhX Chen <sorrow17...@gmail.com> wrote:
> 
> In clojure:
> 
> => (defmacro m [x] `(- ~x))
> => (m 1)
> => -1
> 
> While in self-hosted clojurescript:
> 
> => (defmacro m [x] `(- ~x))
> => (m 1)
> => (- nil)
> 
> So this means self hosted clojurescript does not fully support the defmacro 
> yet?
> 
> -- 
> 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.

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