Re: Invalid-token when dereferencing namespaced keywords.

2019-09-19 Thread Dieter Komendera
We have the common use-case that we want to use double-colon keywords for well known namespaces, without actually requiring the namespaces. (defmacro ns-alias "Set up a custom alias for use with namespace keywords." [ns as] `(do (create-ns '~ns) (alias '~as '~ns))) This proved u

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-30 Thread Philip Markgraf
Thank you Justin, Andy, Alex and Thomas. I now understand both the root of my issue (leading digits in keyword names is not allowed) and have a greater understanding of how keywords work, especially the reader's role in expanding double-colon keywords. On Wednesday, January 30, 2019 at 2:53:1

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-30 Thread Thomas Heller
To expand on what Alex already mentioned. There is no such thing as double-colon keywords. Double-colon is a reader alias mechanism that let the reader resolve them so you can type less. (ns foo.bar.xyz) ::hello this is resolved at read-time and identical to actually writing :foo.bar.xyz/hell

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Philip Markgraf
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 a

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Alex Miller
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 poste

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Philip Markgraf
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? Am I correct to use dou

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Alex Miller
There are two interrelated issues here. First, when you are using autoresolved keywords, the qualifier part must be an alias. Here it is a fully-qualified namespace (user). Instead, you should be using :user/015-00. Note that before Clojure 1.10, this would not produce an error - this was an ov

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Andy Fingerhut
I believe the original intent was that keywords with a digit immediately after the colon would not be supported, but due to a bug in the Clojure reader they were permitted. There was a brief time in 2013 where this bug was fixed, but there were enough extant Clojure code bases that used such keywo

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Philip Markgraf
Thank you. I apologize that my condensed example was in error. (Is the error you are showing that you can't create a namespaced keyword in a namespace you are not in?) However, the condition I originally describe occurs when the original namespace is properly created with ns: user=> (ns name1)

Re: Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Justin Smith
you are misusing the :: alias resolution operator, user is not an alias Clojure 1.9.0 (ins)user=> (ns foo) nil (ins)foo=> ::user/a RuntimeException Invalid token: ::user/a clojure.lang.Util.runtimeException (Util.java:221) (ins)foo=> :user/a :user/a On Tue, Jan 29, 2019 at 2:52 PM Philip Markgraf

Invalid-token when dereferencing namespaced keywords.

2019-01-29 Thread Philip Markgraf
I am moving some code to use spec and namespaced keywords under Clojure 1.10.0 (release). One group of keywords starts with a numeric character after the colon, which has worked fine in the non-namespaced context. Creating and using the namespaced keyword works correctly in the local namespace