Sorry for the possibly basic question. If I want to keep a script-like project both babashka and JVM clojure compatible, is my understanding correct that I can keep a regular clojure project structure, add a bb.edn pointing to deps.edn, and later just make an uberscript if I want to use it in a script like fashion? (i.e. bb my-uberscript.clj)
Of course I understand that I'd need to have only babashka compatible dependencies.
The first part: yes
The second part: you don't need to, you can make an executable #!/usr/bin/env bb script in your project root next to the http://bb.as an entrypoint, add it to your PATH and be done
or you can install it with https://github.com/babashka/bbin
Babashka now ships with Nextjournal Markdown. I assumed that since Nextjournal Markdown uses commonmark-java, I would be able to import commonmark Java classes. That appears not to be the case! Is the reason that "importable babashka classes" have to be mentioned in https://github.com/babashka/babashka/blob/c2cc23ab171f3191aa4f41344227875bf17f33ec/src/babashka/impl/classes.clj#L13, otherwise they can't be imported? (Just asking for my own curiosity).
It's intentional that these classes are not exposed since nextjournal.markdown may choose a different backing library in the future
What would have been your use case with them?
I don't have a use case, not exposing makes perfect sense to me — keep the public API as small as possible. Asking to improve my own understanding of how Babashka works!
babashka uses SCI and in SCI you expose classes via a configuration
so you're correct in that these classes should be in classes.clj
Gotcha, so — 1. on the JVM, because there's no "SCI indirection" involved, and everything ends up on the classpath 2. whereas on GraalVM-compiled SCI into Babashka, imported classes are handled explicitly. Thanks! 🙏 😊
correct
sometimes you can still reach the class like this:
$ bb -e '(Class/forName "org.commonmark.node.Node")'
org.commonmark.node.Node
but it's not in any way guaranteed.This is kind of like Google Closure optimizations. the class is somewhere used so it retains some information about it. But how much is up to native-image