I'm using clojure.tools.reader/read for reading clojure and cljs forms from files.
Everything works fine but reading namespaced keywords like ::keyword
get read as :user/keyword.
I know the reader uses ns dynamic var to figure out the current namespace for reading symbols and keywords but I don't know how to use it to read a non existing namespace, like the one from the file I'm just reading.
I'm trying a (in-ns file-ns-symbol) before doing the read so it creates the ns before reading and it works but sometimes I'm getting java.lang.IllegalStateException: Can't change/establish root binding of: *ns* with set
Just doing
(binding [*ns* file-ns-symbol]
(reader/read ...))
doesn't work since it will try to call (the-ns file-ns-symbol) for a ns that doesn't exist.
Any ideas or pointers on how to do this?
Thanks!