I'm trying to serialize some maps in Clojure and then reading it back into a 
map in Clojure Script. Occasionally my maps uses `\space` in lieu of an empty 
string like " ".

I notice that in Clojure Script, it doesn't know how to interpret \space using 
reader/read-string

Example 1:

    In Clojure: 
    entangle.single=> (pr-str {:foo \space})
    "{:foo \\space}"

    Then, deserializing in ClojureScript:
    entangle.client => (reader/read-string "{:foo \\space}")
    #<Error: Map literal must contain an even number of forms>
    Error: Map literal must contain an even number of forms
        at 
Function.cljs.reader.reader_error.cljs$core$IFn$_invoke$arity$variadic 
(http://localhost:10000/public/js/out/cljs/reader.js:156:8)
        at cljs$reader$reader_error 
(http://localhost:10000/public/js/out/cljs/reader.js:152:33)
        at cljs$reader$read_map 
(http://localhost:10000/public/js/out/cljs/reader.js:436:26)
        at cljs$reader$read 
(http://localhost:10000/public/js/out/cljs/reader.js:810:34)
        at cljs$reader$read_string 
(http://localhost:10000/public/js/out/cljs/reader.js:837:25)


Conversely, trying to serialize in ClojureScript and then deserializing in the 
server works:

Example 2:

    ClojureScript: 
    entangle.client=> (pr-str {:foo \space})
    "{:foo \" \"}"

    Deserializing this in the server:
    entangle.single=> (read-string "{:foo \" \"}")
    {:foo " "}


Why is this the case?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to