Fork me on GitHub
#lumo
<
2017-12-05
>
alepeino16:12:48

@grav I am. I managed to compile some simple script, but now I'm having some problems when I started requiring some library. The build process hangs indefinitely and when I interrupt it:

ERROR in file [object Object]
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1928:72)
	 Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2539:92)
	 (NO_SOURCE_FILE <embedded>:6020:354)
	 z (NO_SOURCE_FILE <embedded>:6021:263)
	 Object.cljs.js.eval_str_STAR_ (NO_SOURCE_FILE <embedded>:6022:328)
	 Function.cljs.js.eval_str.cljs$core$IFn$_invoke$arity$5 (NO_SOURCE_FILE <embedded>:6025:508)
	 Object.lumo.repl.execute_text (NO_SOURCE_FILE <embedded>:6511:475)
	 Object.lumo.repl.execute_source (NO_SOURCE_FILE <embedded>:6517:370)
	 Object.lumo.repl.execute (NO_SOURCE_FILE <embedded>:6518:202)

Script execution interrupted.
	 ContextifyScript.Script.runInThisContext (vm.cljs:44:33)
	 Object.runInThisContext (vm.cljs:116:38)
	 ()
	 (Object.lumo.repl.caching_node_eval)
	 (NO_SOURCE_FILE <embedded>:6020:273)
	 z (NO_SOURCE_FILE <embedded>:6021:263)
	 Object.cljs.js.eval_str_STAR_ (NO_SOURCE_FILE <embedded>:6022:328)
	 Function.cljs.js.eval_str.cljs$core$IFn$_invoke$arity$5 (NO_SOURCE_FILE <embedded>:6025:508)
	 Object.lumo.repl.execute_text (NO_SOURCE_FILE <embedded>:6511:475)
	 Object.lumo.repl.execute_source (NO_SOURCE_FILE <embedded>:6517:370)

Here's the build command as generated by calvin: https://gist.github.com/alepeino/67f0b2e3d5f7a1ec4f53dd134e68e4bb

richiardiandrea16:12:05

@alepeino not all the current Clojure library are Lumo-compatible. They specifically need to say that the are bootstrap or self-host compatible...or use no macros and be cljs compatible...so that might be the problem you are facing

alepeino19:12:10

@richiardiandrea oh ok, I just needed a http/xhr client. Tried "cljs-http", switched to "funcool/httpurr" and now I'm getting

Failed! Could not parse ns form jarful.core: Error: No protocol method IJavaScript.-requires defined for type cljs.core/PersistentVector: [:error #error {:message "failed compiling file:out/cljs/core.cljs", :data {:file "out/cljs/core.cljs"}, :cause #object[Error Error: No protocol method IJavaScript.-requires defined for type cljs.core/PersistentVector: [:error #error {:message "failed compiling file:out/process/env.cljs", :data {:file "out/process/env.cljs"}, :cause #object[Error Error: No protocol method IJavaScript.-requires defined for type cljs.core/PersistentVector: [:error #error {:message "Could not parse ns form process.env", :data {:tag :cljs/analysis-error}, :cause #object[TypeError TypeError: $$LUMO_GLOBALS.readSourcePaths is not a function]}]]}]]}]
    at Object.cljs.core.missing_protocol (<embedded>:179:274)
    at lumo$cljs_deps$_requires (evalmachine.<anonymous>:418:17)
    at <embedded>:983:205
    at cljs.core.LazySeq.fn (<embedded>:983:210)
(...)
What is it that makes a library self-host compatible or not? Thank you

mfikes19:12:59

@alepeino Generally, if a ClojureScript library defines macros which themselves employ Java interop, that library won't work in self-hosted ClojureScript. This is because in self-hosted ClojureScript, the macros need to be compiled by the ClojureScript compiler (not the Clojure compiler).

mfikes19:12:37

To put it another way, Lumo needs to compile the library's macros. Lumo only has ClojureScript at its disposal.