On Jan 16, 2013, at 12:03 PM, larry google groups wrote: > I am ignorant about the implications of using :: to namespace vars. > The fact that I have ::admin in one namespace: > > :users {"root"{:username "lawrence" > :password (creds/hash-bcrypt "admin_password") > :roles #{::admin} > :created_at "2013-01-08 14:00:00" > :telephone-numbers [{:country "USA" :number "434 825 > 7694"} > {:country "USA" :number "732 364 > 3640"}]} > "jane" {:username "jane" > :password (creds/hash-bcrypt "user_password") > :roles #{::user} > :created_at "2013-01-10 16:40:34" > :telephone-numbers []}} > > but then in the core name space I have: > > (derive ::admin ::user) > > and: > > (GET "/account" request (friend/authorize #{::user} {} (account > request))) > (GET "/admin" request (friend/authorize #{::admin} {} (admin > request))) > > I assume I need to change this. What are the implications? These > declarations of roles all need to reference the same namespace, yes?
::foo is unrelated to vars; that's just a keyword that happens to have a namespace component of *ns*. If you use `::foo` in namespace A, that is namespaced as `:A/foo`, whereas the same `::foo` in B is equivalent to `:B/foo`. For further understanding, I suggest taking a look at http://clojure.org/multimethods, or the hierarchy/multimethod/namespaced keyword section of your local Clojure book. The roles you use don't all have to be identically namespaced; that would defeat the point of using hierarchies to model relationships among independent sets of roles. However, if you want to refer to a given namespace's ::user, then you do need to refer to it that way, e.g. :ns-alias/user or :full.ns.name/user. Cheers, - Chas -- 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