onyx-platform / onyx-local-rt

A pure, deterministic Clojure(Script) runtime for Onyx
Eclipse Public License 1.0
32 stars 5 forks source link

Can't compile onyx-local-rt for cljs because of clojure-future-spec #5

Closed visibletrap closed 7 years ago

visibletrap commented 7 years ago

As far as I know, the cause is onyx-local-rt.api namespace depends on onyx.spec namespace which depends on clojure.future namespace which is not a cljc project.

This is an error message I got from figwheel

----  Could not Analyze  /my/path/onyx/spec.cljc  ----

  No such namespace: clojure.future, could not locate clojure/future.cljs, clojure/future.cljc, or Closure namespace "clojure.future" 

----  Analysis Error : Please see /my/path/onyx/spec.cljc  ----
MichaelDrogalis commented 7 years ago

Hi @visibletrap! Sorry you ran into this one. The workaround isn't great, but we're in the unfortunate situation of not being able to move to Clojure 1.9 yet in core.

You can make a file in your project under the path clojure.future.future.clj with the contents:

(ns clojure.future
  "Temporary workaround for clojure-only clojure-future-spec dep."
  (:refer-clojure :exclude [any? boolean? uuid?]))                                                                                                          

(defn any? [x]
  true)

(defn boolean? [x]
  (clojure.core/boolean? x))

(defn uuid? [x]
  (clojure.core/uuid? x))

I had to work around this one quite recently, and am in search of a better solution until we can move everything to 1.9.

visibletrap commented 7 years ago

Hi Michael,

Thank you for very quick response and the workaround. The workaround isn't bad at all. I should have known this.

For other people would might land to this issue in the future, I got cljs compiler working with a slight modification from Michael's approach. I instead create a .cljs file under path src/clojure/future.cljs (namespace clojure.future).

MichaelDrogalis commented 7 years ago

Thanks for the feedback @visibletrap!

arichiardi commented 6 years ago

Sorry to write in a closed PR but I guess this also means that you cannot really run the local runtime in something like lumo, is this correct?

MichaelDrogalis commented 6 years ago

@arichiardi I think we yanked future-spec out a while ago. It should work ok with Lumo as far as I know.

arichiardi commented 6 years ago

This awesome news thanks!