这是代码的传递版本:
正常功能:通过
(defn my-fn
[]
(throw (IllegalStateException.)))
(fact
(my-fn) => (throws IllegalStateException))
这是它的宏版本:
(defmacro my-fn
[]
(throw (IllegalStateException.)))
(fact
(my-fn) => (throws IllegalStateException))
这里失败的是输出:
LOAD FAILURE for example.dsl.is-test
java.lang.IllegalStateException, compiling:(example/dsl/is_test.clj:14:3)
The exception has been stored in #'*me, so `(pst *me)` will show the stack trace.
FAILURE: 1 check failed. (But 12 succeeded.)
这与我刚刚将defn更改为defmacro的代码相同。
我不明白为什么这不起作用?