Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fully qualified keyword #399

Merged
merged 1 commit into from Sep 28, 2017
Merged

Use fully qualified keyword #399

merged 1 commit into from Sep 28, 2017

Conversation

bfabry
Copy link
Contributor

@bfabry bfabry commented Sep 28, 2017

The :: syntax is used for autoresolving things in the current namespace, ie aliases, it doesn't work with fully qualified names as those aren't in the current ns.

Clojure 1.9.0-beta1
Java HotSpot(TM) 64-Bit Server VM 1.8.0_131-b11
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (require '[clojure.core :as core])
nil
boot.user=> ::clojure.core/foo

clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Invalid token: ::clojure.core/foo
             java.lang.RuntimeException: Invalid token: ::clojure.core/foo
boot.user=> :clojure.core/foo
:clojure.core/foo
boot.user=> ::core/foo
:clojure.core/foo

@w01fe
Copy link
Member

w01fe commented Sep 28, 2017

Thanks! (side note: those namespaces are deprecated, if you're using them you should switch to the https://github.com/plumatic/schema-generators/ project instead. )

@w01fe w01fe merged commit 4b530ee into plumatic:master Sep 28, 2017
@bfabry bfabry deleted the patch-1 branch September 28, 2017 18:21
@w01fe
Copy link
Member

w01fe commented Sep 29, 2017

(Does this issue only happen if you load those experimental namespaces, or from the core schema library? I will also cut a release as soon as I can.)

@bfabry
Copy link
Contributor Author

bfabry commented Sep 29, 2017

@w01fe I didn't actually check, we do have code that requires experimental.generators though and I'd expect it only happens if you use those

@w01fe
Copy link
Member

w01fe commented Sep 29, 2017

OK great, thanks!

@puredanger
Copy link

While things like ::clojure.core/foo have worked in prior release, that has never been documented behavior, and in 1.9 we have tightened the reader to throw an error on this invalid behavior. The qualifier in an autoresolved keyword must be an alias in the current namespace.

If you really need :clojure.core/foo, just say :clojure.core/foo, not ::clojure.core/foo.

@w01fe
Copy link
Member

w01fe commented Oct 3, 2017

Just pushed up a 1.1.7 release with this change, thanks again for the fix. @puredanger got it, thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants