Fork me on GitHub

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:

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:

Yehonathan Sharvit07:02:01

@arnaud_bos Making core.matrix self-host compatible will be awesome

Yehonathan Sharvit07:02:38

@arnaud_bos let me know if it helps and if you still have questions

Yehonathan Sharvit07:02:04

(Feel free to enrich the wiki page will all the tips and tricks that you discover along the way)

Yehonathan Sharvit07:02:22

@moxaj That’s wonderful!!!!

Yehonathan Sharvit07:02:32

What was the last fix - that made it work?


@viebel upgrading lumo to 1.1 I believe

Yehonathan Sharvit07:02:09

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

Yehonathan Sharvit09:02:25

What’s the issue now @moxaj ?


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

Yehonathan Sharvit09:02:50

That’s really weird because klipse is built with cljs version 1.9.456


i'll try to make a minimal repro

Yehonathan Sharvit10:02:50

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

Yehonathan Sharvit10:02:30

Can you also provide a function/macro call that doesn’t work in klipse?

Yehonathan Sharvit10:02:06

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

Yehonathan Sharvit10:02:54

I think the problem is with (:require [klipse-test.a :refer [x]]))

Yehonathan Sharvit10:02:16

This refer x as a function and not as a macro

Yehonathan Sharvit10:02:35

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.

Yehonathan Sharvit10:02:49

Actually @moxaj added and removed this part of the page

Yehonathan Sharvit10:02:07

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 🙂

Yehonathan Sharvit10:02:22

more specifically implicit macro loading


@viebel could you clone the klipse-test repo and test it locally with lumo?

Yehonathan Sharvit10:02:36

you have tested it locally with lumo @moxaj ?

Yehonathan Sharvit10:02:28

how do I test that it works @moxaj

Yehonathan Sharvit10:02:10

foo=> klipse-test.b/asdf


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

Yehonathan Sharvit10:02:31

Will let you know @arnaud_bos when we solve the issues


Thanks! 👍


@viebel is there a way to run klipse locally?


(minified cause it's a pretty long klipse link)


it correctly compiles and prints the resulting js to the dev console