The keyword constructor has two signatures: [name] and [ns name] The keyword doc reads: "Returns a Keyword with the given namespace and name. Do not use : in the keyword strings, it will be added automatically."
Looking at the implementation and testing in the repl, for [name] the following works: user=> (keyword "abc") :abc user=> (keyword 'abc) :abc user=> (keyword :abc) :abc user=> However, for the second signature [ns name], only the arguments as string work: user=> (keyword "my-ns" "abc") :my-ns/abc user=> (keyword "my-ns" 'abc) ClassCastException clojure.lang.Symbol cannot be cast to java.lang.String clojure.core/keyword (core.clj:558) user=> (keyword "my-ns" :abc) ClassCastException clojure.lang.Keyword cannot be cast to java.lang.String clojure.core/keyword (core.clj:558) user=> (keyword 'my-ns "abc") ClassCastException clojure.lang.Symbol cannot be cast to java.lang.String clojure.core/keyword (core.clj:558) user=> (keyword *ns* "abc") ClassCastException clojure.lang.Namespace cannot be cast to java.lang.String clojure.core/keyword (core.clj:558) user=> The java implementation of clojure.lang.Keyword/intern shows that only a function signature of (String, String) is supported for the call made in [ns name]. The fairly small patch at: "https://gist.github.com/1956218" for clojure.core/keyword would add some conversions-to-string in the [ns name] code to allow for different data types on par with [name], and would also allow you to specify the ns as string/symbol/namespace. In Assembla I couldn't find any bug report related to this (?). Would this be considered a (usability) bug or just too much perfectionism? Regards, Frank. PS. same issue with (symbol name) and (symbol ns name)… -- 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