Accept and ignore colon between key and value in map literals

Description

Original title was 'treat colons as whitespace' which isn't a problem description but a (flawed) implementation approach

For JSON compatibility
known problems when no spaces - x:true and y:false

Environment

None

Activity

Show:
David Nolen
February 27, 2012, 5:19 PM

Clojure is no longer a language hosted only on the JVM. Clojure is also hosted on the CLR, and JavaScript. In particular ClojureScript can't currently easily deal with JSON literals - an extremely common (though problematic) data format. By allowing colon whitespace in map literals - Clojure data structures can effectively become an extensible JSON superset - giving the succinctness of JSON and the expressiveness of XML.

+1 from me.

Tim McCormack
November 14, 2012, 1:27 AM

Clojure is only hosted on the JVM; ClojureScript is hosted on JS VMs. If this is useful for CLJS, it should just be a CLJS feature.

Mike Anderson
December 11, 2012, 5:51 AM

-1 for this whole idea: that way madness lies....

If we keep adding syntactical oddities like this then the language will become unmaintainably complex. It's the exact opposite of simple to have lots of special cases and ambiguities that you have to remember.

If people want to use JSON that is fine, but then the best approach use a specific JSON parser/writer, not just paste it into Clojure source and expect it to work.

Las
December 11, 2012, 10:54 AM

-1 for reasons mentioned by Allan Malloy and Mike Anderson

Bozhidar Batsov
October 19, 2014, 9:06 AM

-1 Don't repeat the mistake made in Ruby...

Assignee

Unassigned

Reporter

Stuart Halloway

Labels

Approval

None

Patch

None

Fix versions

Priority

Major
Configure