Fork me on GitHub
#planck
<
2022-02-03
zimablue10:02:04

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?

borkdude11:02:32

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

mfikes13:02:45

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

mfikes13:02:52

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

zimablue14:02:26

thanks for explaining

zimablue14:02:59

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?

zimablue14:02:27

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

zimablue14:02:26

I suspect that this is a very stupid question, sorry

mfikes14:02:37

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

zimablue14:02:24

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?

zimablue14:02:38

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?

mfikes14:02:06

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

zimablue15:02:03

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?

mfikes15:02:32

@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