Re: bug: clojure.contrib.json should not default to use keywords.

2010-03-01 Thread James Reeves
On Mar 1, 2:19 am, MarkSwanson mark.swanson...@gmail.com wrote: For an example outside of JSON: recently Compojure changed how it works so the HTTP request properties are all converted to keywords by default. I can see the appeal, but now anyone using Compojure has the increased incidental

Re: bug: clojure.contrib.json should not default to use keywords.

2010-03-01 Thread MarkSwanson
   separators = ( | ) | | | @ | , | ; | : | \ |   | / | [ | ] | ? | = | { | } | SP | HT As far as I can see, all valid HTTP headers are thus valid Clojure   keywords. You don't have to worry. According to the Clojure reader page SP and HT are not allowed. Also, I've re-read the reader

Re: bug: clojure.contrib.json should not default to use keywords.

2010-03-01 Thread Michał Marczyk
On 2 March 2010 01:21, MarkSwanson mark.swanson...@gmail.com wrote: According to the Clojure reader page SP and HT are not allowed. Well, according to Richard's post, they're not allowed in HTTP header names either: On 1 March 2010 03:26, Richard Newman holyg...@gmail.com wrote: Per RFC2616,

Re: bug: clojure.contrib.json should not default to use keywords.

2010-03-01 Thread MarkSwanson
On Mar 1, 7:00 am, James Reeves weavejes...@googlemail.com wrote: On Mar 1, 2:19 am, MarkSwanson mark.swanson...@gmail.com wrote: For an example outside of JSON: recently Compojure changed how it works so the HTTP request properties are all converted to keywords by default. I can see the

Re: bug: clojure.contrib.json should not default to use keywords.

2010-03-01 Thread Phil Hagelberg
On Sun, Feb 28, 2010 at 7:34 AM, joshua-choi rbysam...@gmail.com wrote: As a small note, according to http://clojure.org/reader, Clojure keywords and symbols are allowed to contain only alphanumeric characters, *, +, !, -, _, and ?. Spaces aren’t allowed, but the keyword function allows them

Re: bug: clojure.contrib.json should not default to use keywords.

2010-03-01 Thread Phil Hagelberg
On Sun, Feb 28, 2010 at 6:26 PM, Richard Newman holyg...@gmail.com wrote: For an example outside of JSON: recently Compojure changed how it works so the HTTP request properties are all converted to keywords by default. I can see the appeal, but now anyone using Compojure has the increased

Re: bug: clojure.contrib.json should not default to use keywords.

2010-03-01 Thread Richard Newman
Actually, HTTP headers are case-insensitive, so you can't really trust a regular map of keywords for all purposes. You'd have to reify a maplike construct (maybe a clojure.lang.IAssociative?) to take care of case differences. No idea if ring or compojure does this already yet. I don't see why

Re: bug: clojure.contrib.json should not default to use keywords.

2010-02-28 Thread Stuart Sierra
Mark, Thank you! I argued for this for months, but everyone kept insisting on keywords by default. Now you just have to convince the other 2 people who actually use clojure.contrib.json. -SS On Feb 27, 3:55 pm, MarkSwanson mark.swanson...@gmail.com wrote: Hello, Consider the following

Re: bug: clojure.contrib.json should not default to use keywords.

2010-02-28 Thread Heinz N. Gies
I use c.c.json heavily in my project and I kind of agree, it should be strings since in the json definition keys have to be strings, only problem is serialization as in how to serialize a keyword them? Regards, Heinz On Feb 28, 2010, at 15:36 , Stuart Sierra wrote: Mark, Thank you! I

Re: bug: clojure.contrib.json should not default to use keywords.

2010-02-28 Thread joshua-choi
As a small note, according to http://clojure.org/reader, Clojure keywords and symbols are allowed to contain only alphanumeric characters, *, +, !, -, _, and ?. Spaces aren’t allowed, but the keyword function allows them anyway because it doesn’t do any checking for validity for performance. I’m

Re: bug: clojure.contrib.json should not default to use keywords.

2010-02-28 Thread MarkSwanson
On Feb 28, 10:34 am, joshua-choi rbysam...@gmail.com wrote: As a small note, according tohttp://clojure.org/reader, Clojure keywords and symbols are allowed to contain only alphanumeric characters, *, +, !, -, _, and ?. Spaces aren’t allowed, but the keyword function allows them anyway

Re: bug: clojure.contrib.json should not default to use keywords.

2010-02-28 Thread Richard Newman
For an example outside of JSON: recently Compojure changed how it works so the HTTP request properties are all converted to keywords by default. I can see the appeal, but now anyone using Compojure has the increased incidental complexity of possible keyword violations. Imagine if you were

bug: clojure.contrib.json should not default to use keywords.

2010-02-27 Thread MarkSwanson
Hello, Consider the following valid JSON: Clojure= (def mq {\Question one\:\test\}) #'user/mq Clojure= (read-json mq) {:Question one test} So the default behaviour fails to work correctly for a common case. The Clojure failure is not exactly obvious either: (read-string (str mq)) request

Re: bug: clojure.contrib.json should not default to use keywords.

2010-02-27 Thread MarkSwanson
Actually, I shouldn't have worded this as a json issue. It's really a core problem that keywords with spaces can't be serialized/ deserialized. A keyword is basically a String, and the language definition does not preclude keywords from having spaces. (keyword a b c) works, and so does (get m