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
and bb accepts both :clj and :bb
My world shattered
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.
right
@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
multiple jira issues: https://github.com/clojure/clojure/blob/master/changes.md#22-reader-conditionals
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}
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.
(and that's exactly what bb is using, it accepts both :bb and :clj )