|Reading "%" with the ClojureScript reader||Jonas Enlund||7/22/13 9:20 AM|
According to the edn spec '%' is a valid symbol and it's currently being used in datomics datalog to refer to rules. The ClojureScript reader is not able to read "%" as a symbol as shown by the following repl session:
cljs.user> (ns cljs.user (:require [cljs.reader :refer [read-string]]))
cljs.user> (read-string "%")
The reason for the error is at where '%' is explicitly called out to throw the above error (probably to leave room for future extensions?).
Given the edn spec and the fact that the symbol can be read with the Clojure reader (and the new Clojure edn reader), should we lift this restriction and allow "%" to be read by the ClojureScript reader?
If all agree I can open an issue+patch on JIRA where I remove the line at .
|Re: Reading "%" with the ClojureScript reader||David Nolen||7/23/13 9:06 AM|
Ticket + patch welcome, thanks!
|Re: Reading "%" with the ClojureScript reader||gfredericks||7/23/13 1:29 PM|
Was the point of the error to be able to read forms like "#(%5)" correctly? E.g., on clj-jvm we have
(read-string "#(%5)") => (fn* [p1__3878# p2__3879# p3__3880# p4__3881# p5__3877#] (p5__3877#))
Would cljs have the same behavior if the error were removed? should it?
|Re: Reading "%" with the ClojureScript reader||Jonas Enlund||7/23/13 1:51 PM|
The clojurescript reader does not implement the #(...) reader macro.