leonoel / cloroutine

Coroutine support for clojure
Eclipse Public License 2.0
230 stars 10 forks source link

Requires ClojureScript dependency on classpath #21

Closed lgrapenthin closed 6 months ago

lgrapenthin commented 3 years ago

impl.cljc requires cljs.analyzer and cljs.env for cljs macros.

To avoid this problem, one approach would be:

leonoel commented 3 years ago

Keep in mind we need to support :

File extensions and reader conditionals are about the compiler language, but what we want is to conditionally require based on the target language.

lgrapenthin commented 3 years ago

https://github.com/cgrand/macrovich can be used as a tool or reference (code is very little) to avoid potential problems, however the clj based cljs compiler only reads clj for macroexpansion, if required by previously read cljs.

kawas44 commented 6 months ago

Hello, I would also love to use Missionary and build a standalone uberjar without 20 Mb of Clojurescript/Google cruft.

I have tried macrovich but was not able to make the code usable from clj and cljs at the same time :thinking:

I have tried the core.async solution, which is to create a separate namespace. Obviously a big disadvantage is the huge duplication of code. But at least, everything works correctly. You can see my commit on branch split-cljcljs-duplicate.

I have tried to dynamically require Clojurescript dependencies when available to provide a dedicated analyze implementation function. No code duplication but it may be a bit slower (could we use caching?). You can see my commit on branch split-cljcljs-dynamic.

I have tested my two branches with an external simple project and everything seems to work fine.

What do think about those solutions?

kawas44 commented 6 months ago

Hello @leonoel,

Using the cloroutine branch with dynamic loading and moving missionary clojurescript dependency to the cljs-test alias I was able to run missionary Clj tests and Cljs tests (clojurescript & planck) without errors.

The dynamic loading solution look promising. What do you think?

leonoel commented 6 months ago

Fixed in 12