My actual case is using the keyword across two files (namespaces), using the ns/:require/:as constructs in the file that did not define the keyword. (The REPL example was created to give a minimal replication of the leading digit issue.)
So, now I am really wondering what the intent with spec and namespaced keywords is. When should we use single-colon keywords and when should we use the double-colon variety? On Tuesday, January 29, 2019 at 8:48:00 PM UTC-8, Alex Miller wrote: > > > > On Tuesday, January 29, 2019 at 10:07:29 PM UTC-6, Philip Markgraf wrote: >> >> Thank you, Alex and Andy. This answers my question regarding leading >> digit in keywords. >> >> >> Alex, >> You describe an error with autoresolved keywords in my example. Is this >> also true of the second example I posted (in response to Justin), which >> does not use the user namespace? >> > > Yes > > >> Am I correct to use double-quote inside a namespace, and double-quote, >> namespace-alias, slash when using the keyword in another namespace? >> > > No, in all of these cases you are using fully-qualified namespaces, not > aliases. The double-colon is only for autoresolving based on the aliases of > the current namespace, and you are not using aliases in any of your > examples. > > For example, you could have done the following to use an autoresolved > keyword based on the alias n1: > > (ns name2 (:require [name1 :as n1])) > (::n1/015-00 name1/ex2) ;; invalid token > > Although note that you will still run into the second problem of qualified > keywords with leading digit names, so the latter won't work. For something > like this, you'll need to avoid the leading digit in the keyword name. > > Or you can programmatically create the keyword if you must: > > ((keyword "name1" "015-00") n1/ex2) . ;; "2" > > > -- 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.