I think there are also other reasons to bear in mind here, e.g. file system access. I'm aware it's not a common use case for macros, but for my shadergraph lib[1] I'm using slurp to embed GLSL files as CLJS strings during compile time and can't see how this would be as easily possible (without relying on node.js) if macros were written directly in CLJS. The beauty of macros is that you can pretty much do what you want at compile time (including calling external processes). I'd not want to lose this ability, since especially for CLJS these kind of things are more useful than in a plain Clojure context (think general assets preparation/transformation) and macros provide a nice alternative to say needing to wrap such features as lein plugins.
[1] https://github.com/thi-ng/shadergraph/blob/master/src/core.org#macro-definitions On 5 Mar 2015 04:03, "Peter West" <[email protected]> wrote: > On Thursday, 5 March 2015 05:31:49 UTC+10, Stuart Sierra wrote: > Thanks to all for the replies. > > Stuart, I wasn't thinking about self-hosting; merely about unifying the > experience under Clojure and ClojureScript, wrt macros. Some work has > already been done towards this, and I was wondering whether it were > feasible to integrate defmacro into the CLJS compiler. I thought there may > be subtleties around the fact that CLJS appears to be an essentially AoT > environment. > > In the event that there are no structural impediments, we might look > forward to such a full integration of defmacro some time down the track. I > think it would be a boon for the wider acceptance of CLJS. > > > On March 3, 2015, Peter West wrote: > > > Macros eventually all expand to CLJS-compatible code. > > > Currently, IIUC, both macro definition and expansion are > > > handled by the Clojure compiler, with the resulting code > > > (presumably CLJS compatible) being handed back to the > > > ClojureScript compiler. Was this simply a convenience to > > > get CLJS working with a minimum of fuss, or are there some > > > structural impediments? > > > > > > Mostly, I think, it was the quickest path to bootstrap the > > ClojureScript compiler. Clojure already had a reader and > > macro expander, so ClojureScript used them. > > > > In Rich Hickey's original design, ClojureScript was not > > intended to be self-hosting without the JVM. The past few > > years of work have brought ClojureScript closer to the > > *possibility* of self-hosting, but it hasn't been a priority > > for most of the major contributors. > > > > -S > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
