babashka 2026-09-04

% clj
Clojure 1.12.5
user=> (= "false" (Boolean. false))
false
but
% bb
Babashka v1.13.220
Type :repl/help for help
user=> (= "false" (Boolean. false))
java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String [at <repl>:1:1]

✅ 1

what kind of edge case is this 😂

% bb
Babashka v1.13.220
Type :repl/help for help
user=> (= "false" (Boolean. true))
false

😆 1

I will check

just (Boolean. false) seems to be failing, lol

it's a when vs when-some issue in reflection code

(Boolean. nil) works as a workaround

definitely a head scratcher

Alex Miller (Clojure team) 2026-09-04T11:03:57.995699Z

You should not use the Boolean constructors ever.

Alex Miller (Clojure team) 2026-09-04T11:04:27.468809Z

Clojure relies on the standardized use of the Boolean singleton values

ah so it's a feature that bb didn't support, got it, thanks :) (I fixed it anyway)

Alex Miller (Clojure team) 2026-09-04T11:06:11.290209Z

Those constructors have been deprecated and marked for removal since Java 9 and will probably actually be removed with Valhalla

👍 1

> You should not use the Boolean constructors ever. legacy codebase, with hacks on top of hacks to overcome unknown bugs. We know the kind. But yes, if given the chance, I will remove them.

A kind of crazy experiment. Calling JavaScriptCore from bb via FFI and using squint on bb to compile cljs -> JS and then evaluate it via FFI on JSC. Also works with callbacks so you can call bb.slurp etc from JS.

;; Run with: bb run examples/hello.cljs

(println "hello from JavaScriptCore")

(println (->> (range 10)
              (map #(* % %))
              (filter odd?)
              vec))

;; JavaScript is right there
(println (.toFixed (js/Math.sqrt 2) 5))
(println (js/JSON.stringify #js {:engine "JavaScriptCore" :compiler "squint"}))

;; and so is babashka: bb.slurp runs in the Clojure process
(let [deps (js/bb.slurp "bb.edn")]
  (println "bb.edn is" (count deps) "characters"))

(str "done")

🤯 10
🤭 2

I wrote a c library that does token counts faster than anything else out there, and it runs from bb and clojure using babashka.ffi. Great idea to add that borkdude.

❤️ 1

The repo babashka-dev-builds is handy when you want bleeding edge babashka. @borkdude ever considered providing a bb version of the install script for those that already have bb & where bb is easier to use than bash ?

Sort of like deps.clj but for installing dev babashka

why maintain another script if there's already one

☝️ 1

Fair enough. I might try porting it for my own use for when I want to install dev on windows. The existing bash script works great on Linux, not so much on Windows.

the bash script works in Git bash on Windows

Tried it in git bash. 1) It wants to download the tarball with the Linux binary. 2) I get permission errors: cannot create regular file './bb': Permission denied Of course, I may well be doing something wrong

You're not doing this in WSL or WSL2 or something right?

These tweaks were specifically made for Git bash, Cygwin etc and also tested there. https://github.com/babashka/babashka/blob/6a724d2e8568d00530ab17f55172260e498a3e4e/install#L184-L186 I'm also using this myself in Github Actions on Windows

but if there's bugs in there I'm open to receive improvements

No, but there's more than one bash in the Git4Windows tree. Maybe I used the wrong one. I'll try again & report back

Yes, but there's more than one file called bash. I suspect i need to use the one called git-bash

yes, try git-bash.exe

That worked. On Windows I tend to use git directly from cmd.exe, so not so familiar with git-bash. Maybe I should get familiar. Thanks for the input!

I think Github Actions uses this as well for bash emulation. Great that it works for you. The git-bash console probably doesn't have many benefits over the new Windows Terminal stuff. Most people tend to use powershell I believe. Do what works for you