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
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
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
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
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
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
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
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
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)
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
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
11 matches
Mail list logo