I am happy that you enjoy Klipse @d4hines
In order to get DataScript running on Klipse, you need two things:
1. Make sure datascript is self-host compatible
2. Use the data-external-libs
data attributes as explained here https://github.com/viebel/klipse#clojure-only-1
Hi @viebel. Thanks for the response. I've found a fork created by @djwhitt that I believe is self-host compatible: https://github.com/Zetawar/datascript/tree/macrovich/src However, when I try http://app.klipse.tech/?data-external-libs=%22https://raw.githubusercontent.com/Zetawar/datascript/tree/macrovich/src/%22
I get the error,
#error {:message "No such namespace: datascript.core, could not locate datascript/core.cljs, datascript/core.cljc, or JavaScript source providing \"datascript.core\"", :data {:tag :cljs/analysis-error}}
Can you give me any hints about what I might be doing wrong?
Hey, I noticed the mention and thought maybe I should fill in some details. :)
By all means!
That fork is self-host compatible, but it's pretty experimental and I've only tried it on Lumo.
Even there, it would fail every time the first time it was loaded and then only succeed on subsequent runs. I think probably because the analysis was cached after that.
So, you might be able to get it to work in Klipse, but it doesn't surprise me that it's failing either.
Aaaah, ok
Glad you clarified! Datascript in Klipse seems like quite a super-power for sketching out ideas. Can you lend any advice on how to get it there?
First, just to confirm, are you using the "macrovich" branch of that fork?
yes
I think the first thing I'd do is just try loading it in Lumo and see if that still works.
I haven't messed with it in quite a while.
I think the general approach I'd take is to try to get everything working cleanly in Lumo or Plank first and then try in Klipse.
Gotcha. Thanks a bunch!
Quick question though
Sure
I don't really understand clojurescript compilation at all. Let's say I was building it using cljs-build. Which of the many files generated has what I need?
Hmm... what you need for what specifically?
Well, Klipse, eventually
Klipse seems to accept both directories and JS files.
And both are produced, so I'm not sure which I would point it at if I built your branch locally, hosted the results, and tried pointing Klipse at it.
Ah, I haven't looked at Klipse in a bit, but I would assume it wants the straight CLJS rather than compiled JS.
That seems to match what @viebel said above too.
So you don't really want cljs-build output at all. You want cljs/cljc files that are self-host compatible.
Aaah, ok.
The magic of Lisp at work.
The main trick to get all the working is dealing with macros since in "normal" JVM compiled CLJS, those are actually evaluated as Clojure rather than ClojureScript.
That's where macrovich comes in, it gives you some tools for writing macros that work in both environments.
Gotcha.
Let me know if you need further help
Wow! Big thanks 🙏 to the Klipse community for the generous support I received on Patreon. I am speechless :hugging_face:. Already 18 Patrons and $325 per month. Want to join? https://patreon.com/klipse?utm_medium=social&utm_source=twitter&utm_campaign=creatorshare