klipse

arnaud_bos 2017-02-01T00:40:42.000681Z

Hello @viebel

arnaud_bos 2017-02-01T00:41:32.000682Z

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_bos 2017-02-01T00:43:28.000683Z

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_bos 2017-02-01T00:45:01.000684Z

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_bos 2017-02-01T00:51:37.000686Z

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_bos 2017-02-01T01:45:16.000691Z

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?

arnaud_bos 2017-02-01T05:51:18.000692Z

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 Sharvit 2017-02-01T07:18:01.000695Z

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

Yehonathan Sharvit 2017-02-01T07:18:03.000696Z

!!!

Yehonathan Sharvit 2017-02-01T07:18:50.000697Z

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

Yehonathan Sharvit 2017-02-01T07:22:38.000699Z

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

Yehonathan Sharvit 2017-02-01T07:23:04.000700Z

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

Yehonathan Sharvit 2017-02-01T07:23:22.000701Z

@moxaj That’s wonderful!!!!

Yehonathan Sharvit 2017-02-01T07:23:32.000702Z

What was the last fix - that made it work?

moxaj 2017-02-01T07:43:44.000703Z

@viebel upgrading lumo to 1.1 I believe

Yehonathan Sharvit 2017-02-01T07:44:09.000704Z

Does it work in klipse also?

moxaj 2017-02-01T08:08:14.000706Z

@viebel haven't tested yet, will do later

arnaud_bos 2017-02-01T09:12:10.000707Z

@viebel will read, thanks!

moxaj 2017-02-01T09:55:56.000708Z

@viebel does not work with klipse 😕 You mentioned you might need to recompile some libs, that might fix it

Yehonathan Sharvit 2017-02-01T09:56:25.000709Z

What’s the issue now @moxaj ?

Yehonathan Sharvit 2017-02-01T09:56:28.000710Z

Still inf. loop?

moxaj 2017-02-01T09:57:50.000711Z

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 Sharvit 2017-02-01T09:58:50.000712Z

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

moxaj 2017-02-01T10:05:31.000713Z

i'll try to make a minimal repro

Yehonathan Sharvit 2017-02-01T10:05:50.000714Z

that will definitely help to solve the issue

moxaj 2017-02-01T10:21:33.000716Z

works fine in lumo, but fails with klipse

moxaj 2017-02-01T10:22:21.000717Z

klipse-test.b loads klipse-test.a/x the function, not the macro

Yehonathan Sharvit 2017-02-01T10:27:30.000718Z

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

Yehonathan Sharvit 2017-02-01T10:28:06.000719Z

I mean currently it’s hard to see what went wrong because the require statement seems to have succeeded

moxaj 2017-02-01T10:28:50.000720Z

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

moxaj 2017-02-01T10:29:20.000721Z

so, a function was passed the symbol asdf, which could not be resolved

Yehonathan Sharvit 2017-02-01T10:37:54.000722Z

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

Yehonathan Sharvit 2017-02-01T10:38:16.000723Z

This refer x as a function and not as a macro

Yehonathan Sharvit 2017-02-01T10:38:35.000724Z

You have to use either :refer-macros or :require-macros

moxaj 2017-02-01T10:39:20.000726Z

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

moxaj 2017-02-01T10:41:04.000727Z

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

arnaud_bos 2017-02-01T10:46:10.000728Z

@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 Sharvit 2017-02-01T10:46:49.000729Z

Actually @moxaj added and removed this part of the page

Yehonathan Sharvit 2017-02-01T10:48:07.000730Z

We are trying to figure out together what is the proper way to deal with macro

moxaj 2017-02-01T10:48:13.000731Z

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

Yehonathan Sharvit 2017-02-01T10:48:22.000732Z

more specifically implicit macro loading

moxaj 2017-02-01T10:48:50.000736Z

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

Yehonathan Sharvit 2017-02-01T10:49:07.000738Z

sure

Yehonathan Sharvit 2017-02-01T10:49:36.000739Z

you have tested it locally with lumo @moxaj ?

moxaj 2017-02-01T10:49:39.000740Z

yes

Yehonathan Sharvit 2017-02-01T10:49:46.000741Z

ok

Yehonathan Sharvit 2017-02-01T10:49:48.000742Z

doing it now

Yehonathan Sharvit 2017-02-01T10:52:28.000743Z

how do I test that it works @moxaj

Yehonathan Sharvit 2017-02-01T10:52:29.000744Z

?

Yehonathan Sharvit 2017-02-01T10:53:04.000745Z

indeed it works

Yehonathan Sharvit 2017-02-01T10:53:10.000746Z

foo=&gt; klipse-test.b/asdf
10

Yehonathan Sharvit 2017-02-01T10:53:12.000747Z

in lumo

arnaud_bos 2017-02-01T10:57:29.000748Z

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 Sharvit 2017-02-01T10:58:20.000749Z

np.

Yehonathan Sharvit 2017-02-01T10:58:31.000750Z

Will let you know @arnaud_bos when we solve the issues

arnaud_bos 2017-02-01T10:58:49.000752Z

Thanks! 👍

moxaj 2017-02-01T18:51:17.000754Z

@viebel is there a way to run klipse locally?

Yehonathan Sharvit 2017-02-01T19:34:29.000755Z

sure.

Yehonathan Sharvit 2017-02-01T19:35:46.000756Z

Look at https://github.com/viebel/klipse/blob/master/contributing.md

moxaj 2017-02-01T20:53:26.000759Z

@viebel take a look a this: http://tiny.cc/o4twiy

moxaj 2017-02-01T20:53:38.000760Z

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

moxaj 2017-02-01T20:54:25.000761Z

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