Welcome! Please see the About page for a little more info on how this works.

+3 votes
in Docs by
retagged by

The current docstrings:

clojure.core/keyword
([name] [ns name])
  Returns a Keyword with the given namespace and name.  Do not use :
  in the keyword strings, it will be added automatically.

clojure.core/symbol
([name] [ns name])
  Returns a Symbol with the given namespace and name. Arity-1 works
  on strings, keywords, and vars.

The arglists suggest that the first arity is to be used for simple idents only.
However, the underlying implementation explicitly handles the case when there's / in the value, and even the argument is named nsname:

static public Symbol intern(String nsname){
	int i = nsname.indexOf('/');
	if(i == -1 || nsname.equals("/"))
		return new Symbol(null, nsname);
	else
		return new Symbol(nsname.substring(0, i), nsname.substring(i + 1));
}

One example where some existing code relies on this behavior: transit-clj

Perhaps, the docstrings should be updated to reflect that?

1 Answer

+2 votes
by
selected by
...