Fork me on GitHub
#klipse
<
2017-02-01
>
arnaud_bos00:02:32

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

arnaud_bos00:02:28

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

arnaud_bos00:02:01

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

arnaud_bos00:02:37

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 ! 🙂

arnaud_bos01:02:16

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?

arnaud_bos05:02:18

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

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?

moxaj07:02:44

@viebel upgrading lumo to 1.1 I believe

Yehonathan Sharvit07:02:09

Does it work in klipse also?

moxaj08:02:14

@viebel haven't tested yet, will do later

arnaud_bos09:02:10

@viebel will read, thanks!

moxaj09:02:56

@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 ?

moxaj09:02:50

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

moxaj10:02:31

i'll try to make a minimal repro

Yehonathan Sharvit10:02:50

that will definitely help to solve the issue

moxaj10:02:33

works fine in lumo, but fails with klipse

moxaj10:02:21

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

moxaj10:02:50

the require succeeded, but it loaded the function (with the hidden arguments), instead of the macro

moxaj10:02:20

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

moxaj10:02:20

"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. "

moxaj10:02:04

so it should work, and it does work with lumo locally

arnaud_bos10:02:10

@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

moxaj10:02:13

I was convinced in the cljs channel that it actually works 🙂

Yehonathan Sharvit10:02:22

more specifically implicit macro loading

moxaj10:02:50

@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
10

arnaud_bos10:02:29

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

arnaud_bos10:02:49

Thanks! 👍

moxaj18:02:17

@viebel is there a way to run klipse locally?

moxaj20:02:38

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

moxaj20:02:25

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