Fork me on GitHub

[self-host] The pprint.clj file is almost usable from bootstrap, apart from one use of macroexpand. One conditionalized solution involves the use of cljs.js. Perhaps this big hammer can be employed as a last resort when porting ClojureScript macro implementations that use certain Clojure-specific features. I’m wondering if there might be a better solution and if others here have ideas. Here’s my whack at it:


@mfikes I’m eager to hear about your progress on macroexpand, I read your recent blogpost - kudos! that gist link, is it tested code? I don’t think make-sync works as intended


I don’t think it is possible to turn async call into a sync call without introducing some kind of promise system


I believe it will work only in cases when cljs/eval decides to call cb synchronously


in other cases res will be nil when dereferenced


@darwin: It works. (See the comment below the code showing it working.) In general, you are right and this code could in theory fail. I think it is working because no async calls to *load-fn* are being made. A proper solution would likely involve rippling the async nature through the users of the macro, which would likely be problematic.


ok, sounds like an improvement to me, just raise some exception with explanation when someone calls it with async behaviour


@darwin: I'm wondering if there is any other way to do the macroexpand call.


@mfikes: unfortunately I don’t have such deep understanding, good luck!