reagent-project / reagent

A minimalistic ClojureScript interface to React.js
http://reagent-project.github.io/
MIT License
4.75k stars 414 forks source link

self-hosted clojurescript #361

Open sonwh98 opened 6 years ago

sonwh98 commented 6 years ago

I am trying to get reagent working in self-hosted clojurescript. I am encountering two problems.

  1. macros are defined in .clj files. For example, there is reagent.interop.cljs and reagent.interop.clj . the cljs does nothing but (:require-macros [reagent.interop]) . To fix this problem, I just copied the .clj into the .cljs

  2. My load-fn does not know where to extract cljsjs dependencies. I asked a question here about it https://groups.google.com/forum/#!topic/clojurescript/E7H1cuZQpys

Now that clojurescript can run macros, is there a reason why macro expansions can't be done in cljs instead of clj?

mfikes commented 6 years ago

@sonwh98 With respect to your point (1) above, in self-hosted ClojureScript, macros are defined in *.clj and *.cljc files, just as they are done in JVM-based ClojureScript. The only difference is that the macro namespaces are (perforce) compiled as ClojureScript (taking the :cljs branch in reader conditionals).

Perhaps your last question above is answered by https://github.com/clojure/clojurescript/wiki/Bootstrapped-ClojureScript-FAQ#with-bootstrapped-clojurescript-can-we-now-have-namespaces-that-mix-both-macros-and-functions

Deraen commented 6 years ago

I'd like to add self-host test case at some point to the project. Those interop macros will probably be removed at some point which hopefully will help with this: #325.

mfikes commented 6 years ago

With respect to self-host test cases, support for doo has landed (but not yet released): https://github.com/bensu/doo/commit/830f52b3620b24b8351503b6554dd03de1f317d8

Deraen commented 3 years ago

What's the status of self-hosted cljs? Both Lumo and Planck seem a bit old and haven't been updated to the latest clojurescript versions?