Although I have not used nbb, babashka itself has been super useful for avoiding the slower JVM startup time while still using Clojure to automate some tasks at the command line.
Yet, despite many projects using bb + a bb.edn tasks file as a replacement for Make, I find myself still reaching for Make, out of familiarity at least, perhaps to avoid the extra dependency on bb itself?
The main difference is that nbb lets you execute a .cljs file straight away, without a compilation step. As such, it doesn't need any JVM tooling. You can create an AWS Lambda with only a couple of lines of code:
What kind of differences/limitations are there when interpreting Clojurescript (nbb) as opposed to compiling it (shadow-cljs, lein, self-hosted?, other things?)?
I love babashka but always find nbb scripts hard because everything returns a promise which makes the normal REPL workflow tricky.. maybe I’m doing it wrong though
I'm not sure if this applies to nbb, but there's a command line flag for the node repl (`--experimental-repl-await`) which allows you to use await in the repl, allowing you to kind of sidestep the normal annoyance of handling promises.
Just as an FYI for the interested, there is a self-hosted version of clojurescript now, it enables macros in the same runtime with some caveats but the main downside (AFAIK) is increased bundle size, which is less relevant for node.js.
There was a self-hosted CLJS project for Node.js which is now abandoned. It was called lumo. It came with a custom image of Node.js with lumo built-in for better startup times since the JS bundle of self-hosted CLJS is quite large resulting in not so great startup out of the box. Nbb is just a library that you can use with any Node.js version. That said, it might be worth revisiting the self-hosted CLJS approach at some point.
Clojure/Clojurescript is a functional lisp dialect and therefore brings you more and other ways to write programs, since it defers much from javascript/typescript.
But I think another question would be "why do you need nbb for clojurescript?". The minimal answer is: clojure has slow startup time, and clojurescript need some tooling to produce runnable code. With nbb (or bb for clojure) you can run Clojurescript as a scripting language in the terminal, like python or shell, and still use some libraries both from the nodejs or clojure(-script) ecosystem.
Author here. Nbb is a scripting environment for Clojure running on Node.js. Clojure is a Lisp that emphasises functional and data oriented programming. Scripts are executed using an interpreter, so there is no build/compile step necessary, which is convenient for small applications.
If you're more curious, check out the README which has a list of videos and articles on this.
Nbb isn't a compiler, but a Clojure interpreter. Clojure is a hosted language, but can be compiled or interpreted. The ClojureScript compiler compiles Clojure to JavaScript, but nbb only interprets Clojure.
Basically, you take a programming language and make it work on a platform that meant to be programmed using a different PL. Clojure is hosted by design - it's not Java, but can be used to program for JVM. It ain't Javascript, yet can be used to target nodejs and browser; not an [official] CLR language, but you can write .Net programs. You can use Clojure to make Flutter apps with ClojureDart. You can integrate Python into Clojure with libpython-clj. Or write Clojure to target Erlang/OTP; or Rust; or R; There's even a clojure-like language for Lua - Fennel.
There's something about Clojure people like so much, they want it to work atop any platform.
Compiles/transpiles into code that runs on a "host" language execution environment (nodejs, JVM, CLR) instead of it's own VM implementation, or native code.
Is this similar to Lumo (https://github.com/anmonteiro/lumo)? I would assume Lumo has a faster start time since it boots from a V8 snapshot, but otherwise I'd assume the two projects are similar (except that, of course, lumo is EOL)
This is actually really nifty. However can you change it to be asynchronous instead? Right now the polyglot runs synchronously.
What about the stdout/stderr... It ultimately has to give you back a child process. Could there be a spawn version that gives you the child process too?
Yet, despite many projects using bb + a bb.edn tasks file as a replacement for Make, I find myself still reaching for Make, out of familiarity at least, perhaps to avoid the extra dependency on bb itself?