Clojure's keyword namespacing convention Considered Harmful

There is one reason keywords accept a namespace: to associate them with data in “public” maps such as metas.

For instance, observe this lib: dvlopt.linux.gpio

(gpio/handle device
  {17 {::gpio/state false
       ::gpio/tag   :led-1}
   18 {::gpio/state true
       ::gpio/tag   :led-2}}
  {::gpio/direction :output})

To me there is no point in using namespaces for the keywords. It’s a config map, it’s private to this lib, the collision risk is null, so this should be avoided. This is something I see too often. Discuss.

3 Likes