I thought Clojure automatically loads namespaces for vars used to read tagged literals in the source code, but apparently it isn't.
Given a library that defines data_readers.clj with following content:
{foo/bar my.library.foo/bar
foo/baz my.library/baz}
An attempt to read #foo/bar [1 2 3]
will result in this exception:
Syntax error reading source at (REPL:1:69).
Attempting to call unbound fn: #'my.library.foo/bar
To avoid this exception you need to require
the library namespace before using reader tags.
It would be more convenient to be able to use library reader tags just by adding it to the classpath without explicit require step.
I don't know why it's made this way...
If the reasoning is clojure.core startup time, perhaps the actual load of the var ns might happen at the first tagged literal read time?
If the reasoning is security implications of unexpected code execution, maybe the behavior of requiring data reader namespaces could be configured with *read-eval*
?