babashka

Niki 2025-10-03T09:13:30.975209Z

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

borkdude 2025-10-03T09:17:09.644019Z

reader conditionals are always order dependent

😮 1
borkdude 2025-10-03T09:17:22.959299Z

and bb accepts both :clj and :bb

Niki 2025-10-03T09:18:06.919619Z

My world shattered

➕ 1
Niki 2025-10-03T09:18:18.729989Z

Everything I believed in is a lie

borkdude 2025-10-03T09:18:23.777809Z

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

borkdude 2025-10-03T09:18:34.806849Z

yeah sorry about that :)

Niki 2025-10-03T09:19:46.270379Z

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

borkdude 2025-10-03T09:22:46.052839Z

I know right

2025-10-03T17:49:53.181619Z

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

borkdude 2025-10-03T17:50:53.158489Z

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

2025-10-03T18:27:54.998159Z

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

borkdude 2025-10-03T19:05:30.333179Z

right

Niki 2025-10-03T19:11:28.856309Z

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

borkdude 2025-10-03T19:13:06.331009Z

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

borkdude 2025-10-03T19:15:05.524369Z

multiple jira issues: https://github.com/clojure/clojure/blob/master/changes.md#22-reader-conditionals

borkdude 2025-10-03T19:17:26.581979Z

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
borkdude 2025-10-03T20:32:20.934169Z

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