planck

zimablue 2022-02-03T10:08:04.459549Z

Hi, stupid question - what are the important differences between lumo and planck? I see that they're using different js engines, but what does that mean in practise? Both engines are presumably running javascript close to Ecmascript, and the differences I know about are: (import style), (default-accessible libraries). If one tried to use Planck to compile a "my-node-bundle.js" then tried to run that in nodejs what concretely wouldn't work? Also if one tried to call planck /from/ nodejs, what wouldn't work?

borkdude 2022-02-03T11:11:32.471709Z

@zimablue Planck is specifically built around JavaScript Core. The README suggests using lumo if you want to use Node.js libraries: https://planck-repl.org/guide-all.html. Note that there is now also #nbb, a CLJS interpreter which works on Node.js. Now that lumo is unmaintained, maybe the Planck readme could mention #nbb as an alternative there as well. What do you think of this @mfikes?

mfikes 2022-02-03T13:12:45.112169Z

@borkdude Yes, if I don't add that feel free to submit a PR

mfikes 2022-02-03T13:15:52.503549Z

@zimablue Lumo also runs on Windows. For your other question, if you compiled a JS with Planck you might be able to get it to run in Node, but there would perhaps be issues with dependency loading (a JS is typically created per namespace). If you wanted to make a JS file that runs in Node, I'd just use the ClojureScript compiler. In terms of calling Planck from Node, I suppose you can have Node shell out... Planck is just a native process.

zimablue 2022-02-03T14:00:26.254449Z

thanks for explaining

zimablue 2022-02-03T14:00:59.707219Z

in terms of calling planck from node, why would you have to shell out? I thought at the bottom there would be a .js file which is "the compiler", why wouldn't it be possible to import that from node?

zimablue 2022-02-03T14:01:27.400579Z

I get that it might be wrapped in a .sh but there's a javascript file somewhere doing all of the work right

zimablue 2022-02-03T14:06:26.541349Z

I suspect that this is a very stupid question, sorry

mfikes 2022-02-03T14:10:37.543919Z

@zimablue Well, Planck is a binary, much like Node is a binary

zimablue 2022-02-03T14:15:24.082839Z

I think, reading the code, the thing I didn't realize is that Plank uses c for actual work right? I thought it was a bootstrapped cljs compiler but it's actually c at the bottom? Therefore there's no javascript runtime that could call it and run it without using shell, unless the c was compiled to webassembly?

zimablue 2022-02-03T14:17:38.887579Z

I think I got scrambled, started here: http://swannodette.github.io/2015/07/29/clojurescript-17/ , so someone somewhere made something like a bootstrapped cljs compiler, but that's not what Planck is?

mfikes 2022-02-03T14:32:06.505189Z

@zimablue Planck is a C-based environment that hosts self-hosted ClojureScript

zimablue 2022-02-03T15:25:03.270169Z

I think I'm closer to understanding, I read more of the source code. Somewhere, "cljs" files must get turned into "js" files if you're using the closure compiler, but I can't see precisely where. I can see it happening in "script.bootstrap.build", where "cljs.build.api/build" is called, that's the essence of the "bootstrapped compiler" right?

mfikes 2022-02-03T15:29:32.781049Z

@zimablue Self-hosted ClojureScript is an inherent capability of CloureScript. Plank is just one consumer of that capability. Here is a talk I gave that explains some of the fundamental concepts: https://youtu.be/HnQ89r_dKEM