babashka 2025-10-03

Why does babashka takes what comes first here, instead of trying :bb first, then :clj? Why is it order-dependent?

reader conditionals are always order dependent

😮 1

and bb accepts both :clj and :bb

My world shattered

➕ 1

Everything I believed in is a lie

it accepts :clj as well since in many cases the code is the same for clj and bb and many libs just use a clj reader conditional which works fine with bb

yeah sorry about that :)

Given that Rich doesn’t like order dependence, and this is such an obvious case where it shouldn’t be... Hard to believe

I know right

I mean, looks like a nice feature in this case no?

what exactly do you mean? I can understand your sentence in multiple ways and I don't know which is the intended way

I mean, if I want to prioritize one over the other, so in the case of reader conditional I can understand order mattering.

@didibus if you want to prioritize e.g. :clj over :bb just don’t write :bb

Perhaps there is a JIRA issue about the design of this stuff

or perhaps @fogus or @alexmiller can enlighten us: is there a note/reason about why reader conditional are ordered and not unordered like a map expression:

#?{:clj 2 :cljs 2}

Alex Miller (Clojure team) 2025-10-03T20:21:11.051799Z

The expectation was that only one platform feature was active so the ordering was not presumed to matter in this case. But the reader can be given arbitrary features in https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/read (via :features option) and that can be used with arbitrary features to read arbitrary code and in that case you may wish to prioritize and ordering gives you the ability to prioritize.

👍 1

(and that's exactly what bb is using, it accepts both :bb and :clj )