Keep in mind that :: is just a syntax sugar that is processed by the reader, before the compiler kicks in. ::foo is a shorthand for :your.current.ns/foo. Its purpose is to make it easy to create keywords that do not clash with other ones.
Keywords are equal (and identical) only when both of their namespaces and names are equal. :ns1/foo is thus not equal to :ns2/foo, nor to just :foo. :: is used in cases where you want to exploit this important property of keywords, so that your keyword won't e.g. clash with other keywords in a collection, contents of which you don't know. Jozef On Saturday, August 9, 2014 7:46:45 PM UTC+2, larry google groups wrote: > > Please forgive this stupid question, but I'm still trying to understand > exactly what the double "::" means. I have read that I can use (derive) to > establish a hierarchy and I can imagine how this would be useful for things > like throwing errors and catching them and logging, but I've also read that > "::" adds the namespace to the symbol, so I would assume that I can not > match ::logging from one namespace with ::logging from another? > > I'm thinking of this especially in my use of Slingshot, where I was > thinking of doing something like: > > (throw+ {:type ::database-problem :message "something wrong in the > database query"}) > > and then at a higher level in my code I was going to catch it with > something like: > > (derive ::database-problem ::logging) > > and then using Dire: > > (dire/with-handler! #'database/remove-this-item > [:type ::logging] > (fn [e & args] > (timbre/log (str " database/remove-this-item: The time : " > (dates/current-time-as-string) ( str e)))) > > but conceptually I am having trouble understanding how ::logging in one > namespace can match ::logging in another namespace. Perhaps I should just > use normal keywords? > > > -- 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. For more options, visit https://groups.google.com/d/optout.