clojure-dev

vemv 2022-03-15T21:51:15.757619Z

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) 2022-03-15T21:53:21.773439Z

tools.reader has not yet been updated

Alex Miller (Clojure team) 2022-03-15T21:56:57.306079Z

are you using 1.11.0-rc1 with this?

Alex Miller (Clojure team) 2022-03-15T21:58:03.435699Z

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

vemv 2022-03-15T21:59:43.796219Z

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

Alex Miller (Clojure team) 2022-03-15T22:02:02.097509Z

% 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]))
nil
ex=> (require '[clojure.tools.reader :as r])
nil
ex=> (r/read-string "::f/bar")
:foo/bar

Alex Miller (Clojure team) 2022-03-15T22:04:07.195019Z

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

Alex Miller (Clojure team) 2022-03-15T22:04:55.538989Z

seems like it works to me

vemv 2022-03-15T22:05:52.135799Z

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) 2022-03-15T22:06:14.222119Z

the big thing here is that nothing has changed with reading

Alex Miller (Clojure team) 2022-03-15T22:07:40.217519Z

so I would focus on what is happening with the require

vemv 2022-03-15T22:33:08.614859Z

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.