On Aug 8, 3:36 pm, Stuart Sierra <
the.stuart.sie...@gmail.com> wrote:
> user=> (definline f [& args] `(println ~args))
> java.lang.Exception: Unable to resolve symbol: & in this context
> clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:25: Unable to
> resolve symbol: & in this context
definline can't support & because the treatment of the rest arg would
be different in the macro and the fn. In a macro, the actual arg forms
are available at compile-time and would be spliced into the expansion
(it should probably be ~@args in your example). But in the fn the
variable args will be bundled into a single runtime parameter. Bottom
line - the function's body wouldn't be the same as the macroexpansion,
so this is not a candidate for definline. But you can use :inline to
define separate expansions and bodies - there are a few examples in
boot.clj.
I've altered the doc for definline to state this restriction.
Thanks for the report,
Rich