I think you missed the point of the last two emails.

In tools.analyzer Nicola and I use the keywords :ctx/statement,
:ctx/expr, :ctx.invoke/target and some others. The namespace "ctx" is
entirely synthetic. It has no representation in terms of a file or
actual Clojure ns form. It's just a conceptual namespace used in naming
a set of keyword values.

My reading of James and Jozef's last emails is that you can use exactly
this model, where you simply invent a prefix for your keywords, the
conventional name for which is a "namespace", and use that rather than
trying to use the :: syntax to generate namespace qualified keywords.
Having a dedicated namespace for your hierarchy just to use :: is
probably the wrong approach since you're presumably going to have to
write those namespaced keywords elsewhere in your codebase.

Reid
On 08/09/2014 03:21 PM, larry google groups wrote:
>
> > Keywords hierarchies need to be namespace qualified, but you can
> require 
> > namespaces and use the alias, as I demonstrated in my earlier example.
>
> I wasn't thinking clearly about what this meant, but now I see what
> you mean. I could potentially have all of my (derive) statements in
> one namespace, define the keywords there, and then any namespace that
> will use those keywords can require that namespace and use those
> keywords. Thank you for your help.
>
>
>
>
> On Saturday, August 9, 2014 4:02:59 PM UTC-4, James Reeves wrote:
>
>     Keywords hierarchies need to be namespace qualified, but you can
>     require namespaces and use the alias, as I demonstrated in my
>     earlier example.
>
>     To give a further example, suppose you have a namespace like:
>
>         (ns example.other)
>
>         (derive ::dog ::animal)
>         (derive ::cat ::animal)
>
>         (defmulti speak identity)
>
>     If you require this namespace, you can use the alias instead of
>     the fully qualified name in keywords:
>
>         (ns example.core
>           (require [example.other :as o]))
>
>         (defmethod o/speak ::o/dog [_] "bark")
>         (defmethod o/speak ::o/cat [_] "meow")
>
>     - James
>
>
>     On 9 August 2014 20:49, larry google groups <lawrenc...@gmail.com
>     <javascript:>> wrote:
>
>         Thank you for the responses. However, when I look here:
>
>         http://clojure.org/multimethods <http://clojure.org/multimethods>
>
>         I see that it says:
>
>         "You can define hierarchical relationships with (derive child
>         parent). Child and parent can be either symbols or keywords,
>         and must be namespace-qualified"
>
>         Is there any way I can establish a hierarchical relationship
>         without it being name-spaced qualified? I would like to be
>         able to (slingshot/throw+ {:type some-symbol}) and have this
>         be caught in a different namespace, but I need a way to match
>         the some-symbol, and I would ideally like it if some-symbol
>         might be part of a hierarchy, such that I'm matching again
>         some-symbol's parent. 
>
>         Is that possible? 
>
>         I guess I could hard-code all of the namespaces, such that the
>         symbols are all:
>
>          some-namespace/some-symbol 
>
>         but that does great reduce the flexibility of the system.
>
>
>          
>
>
>
>         On Saturday, August 9, 2014 3:30:33 PM UTC-4, James Reeves wrote:
>
>             Jozef is correct, but to give some examples:
>
>             (ns example.core
>               (:require [example.other :as other]))
>
>             (= ::foo :example.core/foo)
>             (= ::other/foo :example.other/foo)
>
>             (not= :foo :example.core/foo)
>             (not= :example.core/foo :example.other/foo)
>             (not= :other/foo ::other/foo)
>
>             - James
>
>
>
>             On 9 August 2014 19:14, Jozef Wagner <jozef....@gmail.com>
>             wrote:
>
>                 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
>                 clo...@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+u...@googlegroups.com
>
>                 For more options, visit this group at
>                 http://groups.google.com/group/clojure?hl=en
>                 <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+u...@googlegroups.com.
>
>                 For more options, visit
>                 https://groups.google.com/d/optout
>                 <https://groups.google.com/d/optout>.
>
>
>
> -- 
> 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
> <mailto:clojure+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.

Reply via email to