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 yo

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 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 comp

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 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 anyway because it

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

2010-03-01 Thread MarkSwanson
On Mar 1, 7:00 am, James Reeves wrote: > On Mar 1, 2:19 am, MarkSwanson 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

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

2010-03-01 Thread Michał Marczyk
On 2 March 2010 01:21, MarkSwanson 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 wrote: > Per RFC2616, HTTP headers are named by "token"s: > > to

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 a

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

2010-03-01 Thread James Reeves
On Mar 1, 2:19 am, MarkSwanson 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 complexity of possible

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 integrat

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

2010-02-28 Thread MarkSwanson
On Feb 28, 10:34 am, joshua-choi 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 because it doesn’t do

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 to

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 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 wrote: > Hello, > > Consider the following valid JSON: > > Clojure=>

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 (ke