JSON as readable Clojure was discussed and shot down a while back, albeit with a weirder implementation: http://groups.google.com/group/clojure-dev/browse_thread/thread/5b066af1224efe8e/9ae78e878f873058 The idea of colons having special treatment in the context of maps is rather distasteful to me personally.
-Phil
I agree, this horrifies me. It isn't even as simple as "letting them
be whitespace", because presumably you want (read-string "{a: b}") to
result in (hash-map 'a 'b), but (read-string "{a :b}") to result in
(hash-map 'a :b). So you can't just say they're whitespace - you have
to recognize the context they're in to decide what they attach to, if
anything. The existing behavior is much cleaner.
+1
On Dec 20, 10:36 am, Alex Baranosky <alexander.barano...@gmail.com>
wrote:
2011/12/20 jweiss <jeffrey...@gmail.com>:
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
A.
This issue could be avoided by only treating a colon as whitespace when followed by a comma. As easy cut-paste of json seems to be the key motivation here, the commas are going to be there anyway: valid {"v":, 1234} vs syntax error {a-key: should-be-a-keyword}.
--
Except that's not valid JSON, so it's still not a simple cut and paste
solution. I personally think that confusing a colon with whitespace
under any circumstances is an unnecessary confusion leading to
unnecessary errors.
~Justin
+2