What's a compiler macro? In the case of cljs, all macros are expanded until they are no longer macro calls. Having a function of the same name in cljs code is not a problem.
:inline should not be used in cljs.
Rich
> --
> You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
> To post to this group, send email to cloju...@googlegroups.com.
> To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.
ClojureScript has a form of compiler macros. They obviate :inline. They already deliver high performance aget/aset (i.e. the versions you see in core.cljs are not used by direct calls - look at the macro defs in core.clj). They have not yet been extended to the math ops - doing so is a longstanding TODO. Patches welcome.
What's a compiler macro? In the case of cljs, all macros are expanded until they are no longer macro calls. Having a function of the same name in cljs code is not a problem.
:inline should not be used in cljs.
Rich
If anyone's interested, feel free to grab it.
Alan
Great!
> Is there anything else that people would like to see here, something I
> missed?
> David
One thing: the single arity cases of +, - and * should not
syntax-quote x and / should unquote x.
Sincerely,
Michał
Sorry if I'm being dense -- how is this different from regular macros
in Clojure. Don't they also expand until they are no longer macro
calls?
--Chouser
(defmacro foo [& args] &form)
(macroexpand '(foo 1 2 3))
; => (foo 1 2 3)
(Incidentally, this doesn't work with the macrolet of tools.macro --
mostly due to &form and &env not being handled as magic args. Patch in
progress. @Alan: I completely forgot about this use of &form when we
were discussing the test-tagging thing recently; anyway, it wouldn't
have worked without a patched tools.macro anyway. I guess I'll be
having another look at that code after writing the patch up...)
In Common Lisp, the almost-equivalent (defmacro foo (&whole form &rest
args) form) (macroexpand '(foo 1 2 3)) would not terminate.
Anyway, agreed about the application as an elaborate, tunable inlining
mechanism being possible due to different namespacing. (I.e. macros in
cljs living in a separate namespace from functions which only comes
into play for symbols occurring in the operator position.)
Sincerely,
Michał
We could move to a uniform compiler-macro system for both if a) we had a different place to put them (i.e. not in the var), and b) they expanded only once. This would yield the additional benefit CL compiler macros have in that they can expand into themselves (i.e. into forms with the same first symbol).
Rich