Why clojurescript macros can't be written in clojurescript?

冷暖自知 提交于 2019-12-03 10:26:42

From ClojureScript: Up and Running by Stuart Sierra and Luker VanderHart, page 69:

Macros are applied during the compilation process. They do not exist at runtime. Because the ClojureScript compiler is implemented in Clojure, ClojureScript macros must be written in Clojure, not ClojureScript. Fortunately, Clojure and ClojureScript are almost identical when it comes to manipulating data structures, so switching between the two languages is not difficult.

What that means is that macro code gets executed in Clojure world and not in the browser, so it must be written in plain Clojure.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!