How do I namespace keywords in event data?

Plenty of libraries have all their public functions in one namespace. Some will even import all the functions they expose from their original namespaces into a single namespace for easy consumption. Arguably some multi-namespace libraries would be better off with a single namespace.

Obviously this isn’t true for all libraries, I guess it’s up to you to decide if you have enough API surface area to warrant splitting it up.

Namespaces should be globally unique, especially when you’re going to use them with spec. What if another library also defines a http/request spec? Who “owns” the http namespace?

To really be a good citizen maybe it should even be com.weavejester.ring/request.

This discussion would also be different if we had an easy way to define keyword namespace aliases without having to load the namespace with the same name, however it seems we’re nowhere near to any solution (see CLJ-2123 and CLJ-2030), so you really have two options if you don’t want consuming your library to be a major PITA.

  • use short single segment namespaces for keywords a la ring/request, so you don’t need an alias ({:ring/keys [request response]}), at the risk of clashing with other libs
  • use namespaces for your keywords that people will likely be requiring in the same place where they will be accessing said keywords