babashka

Gent Krasniqi 2025-06-20T07:49:22.574029Z

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)

Gent Krasniqi 2025-06-20T07:50:13.240379Z

Of course I understand that I'd need to have only babashka compatible dependencies.

borkdude 2025-06-20T07:51:05.975349Z

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

👍 1
borkdude 2025-06-20T07:51:23.809019Z

or you can install it with https://github.com/babashka/bbin

teodorlu 2025-06-20T13:48:45.287899Z

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

borkdude 2025-06-20T13:49:53.891669Z

It's intentional that these classes are not exposed since nextjournal.markdown may choose a different backing library in the future

👍 1
borkdude 2025-06-20T13:50:20.676849Z

What would have been your use case with them?

teodorlu 2025-06-20T13:53:25.352989Z

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!

borkdude 2025-06-20T13:56:29.181659Z

babashka uses SCI and in SCI you expose classes via a configuration

👍 1
borkdude 2025-06-20T13:56:42.547899Z

so you're correct in that these classes should be in classes.clj

👍 1
teodorlu 2025-06-20T14:00:04.356479Z

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! 🙏 😊

borkdude 2025-06-20T14:00:45.003629Z

correct

👍 1
borkdude 2025-06-20T14:01:40.134539Z

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.

👍 1
👀 1
borkdude 2025-06-20T14:07:25.222089Z

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

👍 1