I'm working on a config file format in EDN, and in doubt: should I use 
keywords or symbols as map keys.

After all, the colon is an extra keyboard press - an extra effort for users.

As EDN parser doesn't evaluate expressions, there is no need to quote 
symbols when using them as EDN map keys (unlike clojure map literals)

I mean, 

(edn/read-string "{a 1 b 2}")

works, while using a clojure map literal would require quoting A and B:

{'a 1 'b 2}

So, is it a good idea to use symbols instead of keywords as map keys in a 
config file?

Probably, an advantage of keywords that they look different visually, so a 
reader easily distinguishes keys from values; But proper indentation, 
optional commas between the key-value pairs in map may be enough for a 
reader to understand everything immediately.
 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/b4c1d021-a624-482b-9e75-fa5c08057a42%40googlegroups.com.

Reply via email to