brandonbloom / fipp

Fast Idiomatic Pretty Printer for Clojure
525 stars 44 forks source link

"No such namespace: cljs.core.rrb-vector" while loading in Lumo #45

Closed tiye closed 5 years ago

tiye commented 7 years ago

Well, it's in Lumo https://github.com/anmonteiro/lumo I used to run the code with Boot and it works in JVM. Now I'm trying Lumo, and it was supposed to work thanks to the cljc files. However I got an error while loading it:

Loading dependencies for clojure.core.rrb-vector
Processing :use-macros for clojure.core.rrb-vector
Loading clojure.core.rrb-vector.macros macros namespace
Evaluating clojure.core.rrb-vector.macros
Namespace side effects for clojure.core.rrb-vector.macros$macros
Processing :use-macros for clojure.core.rrb-vector.macros$macros
Processing :require-macros for clojure.core.rrb-vector.macros$macros
Loading result:  {:error #error {:message Could not eval clojure.core.rrb-vector.macros in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}, :cause #error {:message Unable to resolve var: assert in this context at line 9 clojure/core/rrb_vector/macros.clj, :data {:file clojure/core/rrb_vector/macros.clj, :line 9, :column 5, :tag :cljs/analysis-error}}}}
Loading cljs.core.rrb-vector namespace
Loading result:  {:error #error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}}
Loading result:  {:error #error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}}
Loading result:  {:error #error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}}
Loading result:  {:error #error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}}
Loading result:  {:error #error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}}
Loading result:  {:error #error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}}
#error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}

The Commands are:

export boot_deps=`boot show -c`
lumo -Kvc $boot_deps:src/ -i server.cljs

Since Lumo is using Bootstrapped ClojureScript, I guess it caused this problem. But I can't figure out why. By reading from the code, it should be working, this is weird.

https://github.com/brandonbloom/fipp/blob/07d138e2b3b8c58305b572548fc1ff53f5dd6618/src/fipp/deque.cljc#L4 https://github.com/clojure/core.rrb-vector/blob/master/src/main/cljs/clojure/core/rrb_vector.cljs#L1

mfikes commented 7 years ago

@jiyinyiyong Fipp works fine in bootstrapped ClojureScript; you just need to include the extra dependency: https://github.com/brandonbloom/fipp/blob/916357400433e4a81faf5e4c0b40f1267b22310d/project.clj#L7

tiye commented 7 years ago

@mfikes tried as you told:

diff --git a/build.boot b/build.boot
index 58db061..451c502 100644
--- a/build.boot
+++ b/build.boot
@@ -1,12 +1,13 @@

(set-env!
  :source-paths #{"src/"}
  :dependencies '[[org.clojure/clojure          "1.8.0"       :scope "test"]
                  [org.clojure/clojurescript    "1.9.293"     :scope "test"]
                  [adzerk/boot-test             "1.1.2"       :scope "test"]
                  [cirru/sepal                  [-"0.0.15"]-]{+"0.0.16"]+}
                  [andare                       "0.4.0"]
                  {+[org.clojure/core.rrb-vector  "0.0.11"]+}
                  [cumulo/shallow-diff          "0.1.1"]])

(require '[adzerk.boot-test   :refer :all]
         '[clojure.java.io    :as    io])

I think it's not working, the problem remains. And in the error logs I find this line:

Loading result:  {:error #error {:message Could not eval clojure.core.rrb-vector.macros in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}, :cause #error {:message Unable to resolve var: assert in this context at line 9 clojure/core/rrb_vector/macros.clj, :data {:file clojure/core/rrb_vector/macros.clj, :line 9, :column 5, :tag :cljs/analysis-error}}}}

It reads like macro parsing is failed...?

mfikes commented 7 years ago

@jiyinyiyong I think I see what is going on. It looks like it is picking up the Clojure macros while in ClojureScript. I'll take a look to see if there is a way to rectify this...

mfikes commented 7 years ago

This has nothing to do with Fipp:

$ lumo -qc core.rrb-vector-0.0.11.jar
cljs.user=> (require 'clojure.core.rrb-vector)
#error {:message No such namespace: cljs.core.rrb-vector, could not locate cljs/core/rrb_vector.cljs, cljs/core/rrb_vector.cljc, or Closure namespace "cljs.core.rrb-vector" in file clojure/core/rrb_vector/macros.clj, :data {:tag :cljs/analysis-error}}
tiye commented 7 years ago

Looks weird. The code is here https://github.com/clojure/core.rrb-vector/blob/master/src/main/cljs/clojure/core/rrb_vector.cljs#L1

mfikes commented 7 years ago

This fork patches core.rbb-vector to work with bootstrapped ClojureScript: https://github.com/mfikes/core.rrb-vector

Perhaps if the patch above works out, it can be submitted to the maintainers of core.rbb-vector.

It works with Fipp, but you will see that Lumo appears to have an independent issue where it always prints a newline.

$ lumo -qc fipp-0.6.9.jar:core.rrb-vector/src/main/cljs
cljs.user=> (require '[fipp.edn :refer (pprint) :rename {pprint fipp}])
nil
cljs.user=> (fipp [1 2 3])

[
1

2

3
]

nil
cljs.user=>

This could be opened against Lumo with this minimal repro:

cljs.user=> (print "hi")
hi
nil
cljs.user=> (println "hi")
hi
nil

I think this ticket can be closed as there is no defect in Fipp.

brandonbloom commented 7 years ago

I'll leave the ticket open until the underlying issue is resolved. Then I'll bump the dependency version in Fipp.

mfikes commented 7 years ago

Patch submitted upstream to core.rbb-vector: http://dev.clojure.org/jira/browse/CRRBV-16

brandonbloom commented 5 years ago

@mfikes Is this still an issue?

brandonbloom commented 5 years ago

This appears resolved, so I'll close. Let me know if I've misunderstood.