Clojurians
#lumo
<
2018-01-28
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

richiardiandrea01:01:33

Done the steps, the token is the thing I am missing...

richiardiandrea01:01:50

which docs do I need to follow? I guess Travis docs? @anmonteiro Maybe I need to ask your help on this.

richiardiandrea02:01:58

say I am compiling something with cljs.analyzer in it. Where can I get the analysis cache for it? Is there a place where to find it? I am also thinking whether it should be published on npm for lumo consumption (we don't have cache support yet but it would be awesome to have)

mfikes02:01:47

@richiardiandrea If I understand your first question, usually out/cljs/analyzer.cljc.cache.json.

richiardiandrea02:01:37

yep I can find that file in target because I compile lumo myself...but I think it should be published for consumption now that we can compile with it

richiardiandrea02:01:50

or compilation will fail

richiardiandrea02:01:13

(or I am doing something else wrong ;))

mfikes02:01:03

Ahh, interesting: One problem with attempting to publish any compiled artifacts is that if the compiler version changes, the artifacts become invalid.

richiardiandrea02:01:47

ah, so ideally lumo should publish its own release cache files

richiardiandrea02:01:42

no well, any Cljs compiler files should work...only they have to be the same version

mfikes02:01:52

Well, all I'm saying is: If you publish a ClojureScript library for general use, attempting to include compiled artifacts leads to the possibility of a version mismatch. So, most ClojureScript libraries comprise only source code.

richiardiandrea02:01:08

Even pointing the classpath to cache fails still has some spurious warning and failures...will need to dig more:

WARNING: Use of undeclared Var cljs.analyzer/no-warn at line 855 
WARNING: Use of undeclared Var cljs.analyzer/no-warn at line 873 
WARNING: Use of undeclared Var cljs.analyzer/no-warn at line 2495 
WARNING: Use of undeclared Var cljs.analyzer/no-warn at line 2516 
WARNING: Use of undeclared Var cljs.analyzer/no-warn at line 2536 
Copying lumo/io.cljs to out/lumo/io.cljs
Compiling out/lumo/io.cljs
Copying cljs/spec/gen/alpha.cljs to out/cljs/spec/gen/alpha.cljs
Compiling out/cljs/spec/gen/alpha.cljs
Copying cljs/spec/alpha.cljs to out/cljs/spec/alpha.cljs
Compiling out/cljs/spec/alpha.cljs
failed compiling file:out/cljs/spec/alpha.cljs
	 (new)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2058:72)
	 (evalmachine.<anonymous>:644:25)
	 Function.lumo.compiler.compile_file.cljs$core$IFn$_invoke$arity$3 (evalmachine.<anonymous>:655:4)
	 (Object.lumo$closure$compile_file)
	 (evalmachine.<anonymous>:1644:21)
	 (Object.lumo$closure$_compile)
	 (Object.lumo$closure$compile_from_jar)
	 (evalmachine.<anonymous>:1679:21)
	 (Object.lumo$closure$_compile)

Cannot write 
	 Object.com.cognitect.transit.impl.writer.marshal (NO_SOURCE_FILE <embedded>:6021:288)
	 Object.com.cognitect.transit.impl.writer.emitObjects (NO_SOURCE_FILE <embedded>:6008:181)
	 Object.com.cognitect.transit.impl.writer.emitArray (NO_SOURCE_FILE <embedded>:6008:407)
	 Object.com.cognitect.transit.impl.writer.marshal (NO_SOURCE_FILE <embedded>:6021:58)
	 (NO_SOURCE_FILE <embedded>:6014:409)
	 cljs.core.PersistentHashMap.forEach (NO_SOURCE_FILE <embedded>:1503:182)
	 Object.com.cognitect.transit.impl.writer.emitMap (NO_SOURCE_FILE <embedded>:6014:286)
	 Object.com.cognitect.transit.impl.writer.marshal (NO_SOURCE_FILE <embedded>:6021:129)
	 Object.com.cognitect.transit.impl.writer.marshalTop (NO_SOURCE_FILE <embedded>:6023:120)
	 com.cognitect.transit.impl.writer.Writer.write (NO_SOURCE_FILE <embedded>:6024:390)

richiardiandrea02:01:58

this last stacktrace is with cljs 1.9.1104

mfikes02:01:50

@richiardiandrea Is this a new Lumo build failure that occurred simply by switching to 1.9.1104?

richiardiandrea02:01:31

no well this is my experiments compiling some code containing cljs.analyzer

mfikes02:01:15

Oh. So... hah :slightly_smiling_face:

mfikes02:01:59

ClojureScript is self-hosting... but this raises the question: Can the self-hosted compiler then compile itself again (2nd stage). In general so far the answer has been "no".

mfikes02:01:59

In other words, ClojureScript isn't truly "bootstrapped" in the sense that it is still tied to the JVM for the first compile.

richiardiandrea02:01:26

Oooo ok, so well then all the code that relies on compiler features cannot compile itself? For instance a lib that wants to use warning handler functions...

richiardiandrea02:01:58

if that does not work probably those should be re-factored out there?

mfikes02:01:27

So, what I've done in Planck, (and I assume Lumo does the same), is that things like analyzer.cljc are indeed compiled down to JavaScript and analysis cache, and then bundled with Planck. So, you can use the cljs.analyzer namespace (`:require` it). But it is another matter altogether to try to point Planck or Lumo at analyzer.cljc and try to have it compile that file.

richiardiandrea02:01:44

I am specifically using this piece of code:

(defn exit-on-warning!
  [warning-type env extra]
  (when (warning-type ana/*cljs-warnings*)
    (when-let [s (ana/error-message warning-type extra)]
      (binding [*print-fn* *print-err-fn*]
        (println "lumo error:" (ana/message env s)))
      (lumo.core/exit 1))))

richiardiandrea02:01:03

yep I am doing that already...I think

mfikes02:01:15

Sure, that seems fine in that that code is only using ana. Not compiling it.

richiardiandrea02:01:23

lumo -K -c ~/git/lumo/target:serverless-cljs-plugin lumo-compile.cljs

richiardiandrea02:01:10

but it is requiring it as well and I guess that triggers something I cannot grasp now :smile:

richiardiandrea02:01:20

maybe it is not using the cache then

mfikes02:01:42

$ lumo
Lumo 1.7.0
ClojureScript 1.9.908
Node.js v8.4.0
 Docs: (doc function-name-here)
       (find-doc "part-of-name-here")
 Source: (source function-name-here)
 Exit: Control+D or :cljs/quit or exit

cljs.user=> (require '[cljs.analyzer :as ana])
nil
cljs.user=> (require 'lumo.core)
nil
cljs.user=> (defn exit-on-warning!
       #_=>   [warning-type env extra]
       #_=>   (when (warning-type ana/*cljs-warnings*)
       #_=>     (when-let [s (ana/error-message warning-type extra)]
       #_=>       (binding [*print-fn* *print-err-fn*]
       #_=>         (println "lumo error:" (ana/message env s)))
       #_=>       (lumo.core/exit 1))))
#'cljs.user/exit-on-warning!
cljs.user=>

richiardiandrea02:01:55

yep that works at the repl

richiardiandrea02:01:03

it is compilation that is not :wink:

mfikes02:01:22

Ahh. I've never delved into the subtle differences.

richiardiandrea02:01:06

I think it has something to do with what you where saying above about not being able to compile itself...and it is probably not using the cache, I will report back :slightly_smiling_face:

mfikes02:01:32

My first reaction would be to try to have the Lumo compilation mode load compiled artifacts from the Lumo binary if they happen to be things produced from source like analyzer.cljc

mfikes02:01:22

In other words, make the compilation mode work just like the REPL mode when it comes to loading stuff like that. But then again, I've never looked at that aspect of Lumo.

richiardiandrea02:01:48

I think lumo does that already

richiardiandrea02:01:46

there is some difference though that waits to be discovered in there, bug or subtlety

richiardiandrea02:01:12

I have to say that the JVM compiler is faster in this regard

richiardiandrea02:01:42

but lumo is in early stages about compilation

mfikes02:01:14

Yeah. You definitely feel the difference in speed when working with Coal Mine. The Clojure compiler can load some of that corpus in seconds, while ClojureScript JVM is in minutes, and Planck gets closer to hours. :slightly_smiling_face:

richiardiandrea02:01:12

I think I fixed a warning

richiardiandrea02:01:21

in cljs core...will open a ticket

richiardiandrea03:01:38

Going back to the idea of a common place for projects like lumo, planck and closh ... I think that cljs-oss can be a good place

mfikes18:01:34

@richiardiandrea If you end up digging into adding Lumo to Canary, I've distilled the steps into the README. If you see anything inaccurate, we can get it fixed. I'll invite you to the repo so you can push stuff into it.

richiardiandrea19:01:37

I have some of the steps ready in a local branch and I think I just need the token or understand how to produce one, afk at the moment. I will read the Readme thanks!