Don't do what I did when self-hosting cljs... Also: why did this happen?

I’ve been reading the excellent tutorial over at
http://nbeloglazov.com/2016/03/05/getting-started-with-self-hosted-cljs-part-1.html
and figured I’d play around with self-hosting in a fresh project.

After some happy hacking I’ve managed to compile a bunch of different cljs-files using node to run my “build tool”. But some namespaces (e.g. cljs.tools.reader) wouldn’t compile properly. I’d get an error akin to “Could not parse ns form …”, despite the ns-form looking perfectly fine!

After several hours of testing things, looking at lumo's source code and banging my head into the wall, I figured I’d go back to basics, and just put the tutorial code into my project, then replace it step by step with my own code.

That was when I saw it: I had accidently replaced cljs.js/js-eval with js/eval in the compiler options!
So everything I tried worked, except for macro-namespaces, and even then the error seemed to have troubles with parsing the ns, nothing about the eval-function being erronous… :smiley: It even generated the macro-namespaces’ code properly, but for some reason js/eval couldn’t properly find the macros when trying to use them from other namespaces.

Thought this was interesting enough to be shared. Do you know why this happened?

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.