I have tried this with Clojure 1.7.0, 1.8.0 and 1.9.0-alpha10

(clojure.core/read-string (clojure.core/with-out-str (clojure.core/pr 
(clojure.core/keyword "A valid keyword")))) ;; => :A

This just seems wrong. It's valid to have an instance of 
clojure.lang.Keyword with a space in its name.

(clojure.core/with-out-str (clojure.core/pr (clojure.core/keyword "A valid 
keyword"))) => ":A valid keyword"

So, it seems like clojure.core/pr and clojure.core/read-string disagree 
about EDN.

Is EDN formally specified? https://github.com/edn-format/edn/issues/56 
seems to suggest it is not.

I ran into this problem using ptaoussanis/sente to pass EDN over a 
websocket. The EDN contained a keyword with a space in it, and the 
clojure(jvm) part of sente had no problem serializing it, but the 
ClojureScript part of sente barfed on it. I thought it was a bug in sente, 
however sente simply calls clojure.core/pr to do the serialization... so I 
played with pr vs read-string and found that they disagree.

The serialization that clojure.core/pr does on a keyword with a space in it 
seems broken to me:

user> (clojure.core/with-out-str (clojure.core/pr {:onekey 1
                                                   (clojure.core/keyword 
"two key") 2}))
"{:onekey 1, :two key 2}"

There doesn't seem to be any way to parse that unambiguously.

I think this is a bug. What do you think?

https://github.com/ptaoussanis/sente/issues/251

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to