I would like to use Babashka for some more complicated programs like a nicer TUI or potentially running a GUI app of some kind using a Java library... But I really understand nothing about the GraalVM and Babashka enough to understand what JVM things would work and what would not. Do you all have suggestions on readings I could do for: 1. Learn more about the GraalVM and Babashka as a whole 2. What babashka can do with external Java dependencies (especially those that might rely on Java Native interfaces to do OS independent abstractions)? 3. How to bundle those into an application that can be distributed?
@bkocin We have a much better option now for TUIs now See recent conversations in #babashka and this: https://github.com/jline/jline3/issues/1566#issuecomment-3811572430
It's still a dev build, but I can release soon
I saw! I was actually considered using Golang with bubbletea because nothing similar in Clojure existed but this is just what I wanted 😃 . Thanks for sharing!
this library works with bb (dev): https://codeberg.org/timokramer/charm.clj
I'll release soon
I found that compiling JVM Clojure into native-image might be easier than adding Babashka to the mix - it of course depends on what you want to build, but nowadays with clj-easy native-image build files boil down to a script like this: https://github.com/lukaszkorecki/fusion-http/blob/main/example/native-image/build.sh - but again, it really depends on what you're trying to build
Yea back to basics makes sense if I do not understand this stuff in the first place. I understand the concept of native compilation but with Clojure everything is dynamic or uses reflection so I have no idea how that would even work with native compilation.
If you want scripting and don't want to get in graalvm binaries, you can use bb with for example bblgum. it does need an extra binary, named gum. https://github.com/lispyclouds/bblgum Some people just use ANSI codes to get colored output etc.
One example of a standalone TUI with bb that uses ANSI codes you can find here: https://github.com/yannvanhalewyn/prstack/blob/main/src/prstack/tui/app.clj#L149
@bkocin for sure, I've been following this area for a while, but it's only recently that I started using native-image etc. From what I learned it boils down to:
• not having reflection warnings
• using com.github.clj-easy/graal-build-time for automatically providing Clojure code build information to native-image
• that shell script ;-)
Not everything will play nicely of course, but majority of issues I've run into where Java libraries - not clojure itself, unless of course you do "fun" things like messing with the class loader, invoking code inside of def etc
I did see Gum! I wanted to try out this Java library https://github.com/mabe02/lanterna (that does OS native stuff with java bindings) which is why I am asking all "what can I do with Babashka and GraalVM" questions
I do happen to have a build flag for lanterna
but it's not tested recently
https://github.com/babashka/babashka/blob/master/doc/build.md#lanterna
Okay so use libraries like this do you usually have to include them in the babashka build or use a pod?
I also happen to have a lanterna pod :)
https://github.com/babashka/pod-registry/blob/master/examples/lanterna.clj
Well you are just making my day! Thank you both. I will check out the Lanterna pod first! I still want to try to do some native compiled GUI apps with Clojure so I will definitely dabble with that build script and some libraries I want to try out....
bb -e '(load-string (slurp ""))' The things you all shared with me really helped in my learning of the GraalVM (as well as how babashka is built) so thank you! Using babashka pods seems like the simplest little app I can make so I went that route for now.
Babashka conf update in #babashka-conf