Skip to content

Commit 9e3d853

Browse files
committed
doc data_readers.cljc, closes #568
1 parent df83fbb commit 9e3d853

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

content/reference/reader.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Clojure's reader supports a superset of https://github.com/edn-format/edn[extens
195195
== Tagged Literals
196196
Tagged literals are Clojure's implementation of edn https://github.com/edn-format/edn#tagged-elements[tagged elements].
197197

198-
When Clojure starts, it searches for files named `data_readers.clj` at the root of the classpath. Each such file must contain a Clojure map of symbols, like this:
198+
When Clojure starts, it searches for files named `data_readers.clj` or `data_readers.cljc` at the root of the classpath. Each such file must contain a Clojure map of symbols, like this:
199199

200200
[source,clojure]
201201
----
@@ -210,7 +210,9 @@ The key in each pair is a tag that will be recognized by the Clojure reader. The
210210
----
211211
by invoking the Var `#'my.project.foo/bar` on the vector `[1 2 3]`. The data reader function is invoked on the form AFTER it has been read as a normal Clojure data structure by the reader.
212212

213-
Reader tags without namespace qualifiers are reserved for Clojure. Default reader tags are defined in https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/default-data-readers[default-data-readers] but may be overridden in `data_readers.clj` or by rebinding https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/%2Adata-readers%2A[pass:[*data-readers*]]. If no data reader is found for a tag, the function bound in https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/%2Adefault-data-reader-fn%2A[pass:[*default-data-reader-fn*]] will be invoked with the tag and value to produce a value. If pass:[*default-data-reader-fn*] is nil (the default), a RuntimeException will be thrown.
213+
Reader tags without namespace qualifiers are reserved for Clojure. Default reader tags are defined in https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/default-data-readers[default-data-readers] but may be overridden in `data_readers.clj` / `data_readers.cljc` or by rebinding https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/%2Adata-readers%2A[pass:[*data-readers*]]. If no data reader is found for a tag, the function bound in https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/%2Adefault-data-reader-fn%2A[pass:[*default-data-reader-fn*]] will be invoked with the tag and value to produce a value. If pass:[*default-data-reader-fn*] is nil (the default), a RuntimeException will be thrown.
214+
215+
If a `data_readers.cljc` is provided, it is read with the same semantics as any other cljc source file with reader conditionals.
214216

215217
=== Built-in tagged literals
216218

0 commit comments

Comments
 (0)