Hello @viebel
As we've discussed before, I'm trying to use klipse with core.matrix
in order to provide interactivity in a blog post about matrices
I don't really know where to start, I've tried to use the data-external-libs
param, but I suspect I'm not doing it right because I get a lot of 404 errors
I've read
you need to provide the full list of dependencies (including the dependencies of dependencies recursively)
on the readme, maybe this is the problem, I'm not sure I've tracked down all the dependencies of core.matrix
I guess my question is:
- do I need to track down and add all the dependencies in data-external-libs
(like, cloning the repo and performing a lein deps :tree
and then adding all corresponding raw.githubusercontent/.../src something path) ?
- what do I need to check to see if a particular dependency is klipse/self-hosted compatible ?
- what are key error messages (logs) I can detect/look after to identify a dependency vs self-hosted problem ?
Thanks ! 🙂
From Chrome DevTools what I see is a lot of 404 errors are due to klipse actually searching for the right path of each namespace as .cljs
or .cljc
file in each external-libs
I have provided.
Most of the attempts fail and then one finally reach the target, looks good so far, at least I think ^^
After that other 404 appear such as:
<https://viebel.github.io/klipse/cache-cljs//cljs_SLASH_core_SLASH_matrix_SLASH_utils.js>
What are those calls?Turning on verbose
mode gives interesting results, some namespaces seems to have problems being loaded because they require macros:
{:error #error {:message Could not parse ns form clojure.core.matrix.utils, :data {:tag :cljs/analysis-error}, :cause #error {:message Invalid :refer, macro clojure.core.matrix.macros/is-long-array? does not exist, :data {:tag :cljs/analysis-error}}}}
But this macro exists in the source code: https://github.com/mikera/core.matrix/blob/develop/src/main/clojure/clojure/core/matrix/macros.cljc#L58@arnaud_bos Making core.matrix self-host compatible will be awesome
!!!
There is a 1st draft of a wiki page that could help you: https://github.com/viebel/klipse/wiki/How-to-make-a-clojure-library-self-host-compatible
@arnaud_bos let me know if it helps and if you still have questions
(Feel free to enrich the wiki page will all the tips and tricks that you discover along the way)
@moxaj That’s wonderful!!!!
What was the last fix - that made it work?
@viebel upgrading lumo to 1.1 I believe
Does it work in klipse also?
@viebel haven't tested yet, will do later
@viebel will read, thanks!
@viebel does not work with klipse 😕 You mentioned you might need to recompile some libs, that might fix it
What’s the issue now @moxaj ?
Still inf. loop?
no, I see the same thing as if I was using Lumo 1.0-alpha with ClojureScript 1.9.293 - namely, the self-required macro trick does not work
That’s really weird because klipse is built with cljs version 1.9.456
i'll try to make a minimal repro
that will definitely help to solve the issue
works fine in lumo, but fails with klipse
klipse-test.b
loads klipse-test.a/x
the function, not the macro
Can you also provide a function/macro call that doesn’t work in klipse?
I mean currently it’s hard to see what went wrong because the require statement seems to have succeeded
the require succeeded, but it loaded the function (with the hidden arguments), instead of the macro
so, a function was passed the symbol asdf
, which could not be resolved
I think the problem is with (:require [klipse-test.a :refer [x]]))
This refer x
as a function and not as a macro
You have to use either :refer-macros or :require-macros
"Implicit macro loading: If a namespace is required or used, and that namespace itself requires or uses macros from its own namespace, then the macros will be implicitly required or used using the same specifications. Furthermore, in this case, macro vars may be included in a :refer or :only spec. "
so it should work, and it does work with lumo locally
@viebel I've read the wiki page quickly a few hour ago and was under the impression that the problem with core.matrix
was about the macro loading "infinite loop" stuff, but you've removed that part, should I look elsewhere then?
I'll do other tests asap.
Actually @moxaj added and removed this part of the page
We are trying to figure out together what is the proper way to deal with macro
I was convinced in the cljs channel that it actually works 🙂
more specifically implicit macro loading
https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure
@viebel could you clone the klipse-test repo and test it locally with lumo?
sure
you have tested it locally with lumo @moxaj ?
yes
ok
doing it now
how do I test that it works @moxaj
?
indeed it works
foo=> klipse-test.b/asdf
10
in lumo
ok, seems like your work will be valuable for fixing my issues with core.matrix. cant' help for the moment sorry, I'll get back to it asap
np.
Will let you know @arnaud_bos when we solve the issues
Thanks! 👍
@viebel is there a way to run klipse locally?
sure.
Look at https://github.com/viebel/klipse/blob/master/contributing.md
@viebel take a look a this: http://tiny.cc/o4twiy
(minified cause it's a pretty long klipse link)
it correctly compiles and prints the resulting js to the dev console