Fork me on GitHub

Given a [foo :as-alias f] libspec, is tools.reader known to work with it? I'm getting a Invalid keyword: ::f/bar even though reader/*alias-map* is correctly bound (that is, to {f #namespace[foo]})

Alex Miller (Clojure team)21:03:21

tools.reader has not yet been updated

Alex Miller (Clojure team)21:03:57

are you using 1.11.0-rc1 with this?

Alex Miller (Clojure team)21:03:03

I'm try to work out what if anything would need to be updated. by default it relies on ns-aliases and that should be right if you are using 1.11.0-rc1


I'm indeed using rc1 and the result from ns-aliases

Alex Miller (Clojure team)22:03:02

% clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.11.0-rc1"} org.clojure/tools.reader {:mvn/version "1.3.6"}}}'
Clojure 1.11.0-rc1
user=> (ns ex (:require [foo :as-alias f]))
ex=> (require '[ :as r])
ex=> (r/read-string "::f/bar")

Alex Miller (Clojure team)22:03:07

ex=> (binding [r/*alias-map* {'g (create-ns 'goo)}] (r/read-string "::g/bar"))

Alex Miller (Clojure team)22:03:55

seems like it works to me


The codebase that exhibits this bug has a reading pattern more complex than that, will see if I can repro isolatedly

Alex Miller (Clojure team)22:03:14

the big thing here is that nothing has changed with reading

Alex Miller (Clojure team)22:03:40

so I would focus on what is happening with the require


Thanks! Yes it ended up being something internal. I should have known better since in another project (Eastwood) 1.11 as-alias is working perfectly with no tools.reader issues.