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

0 votes
in Spec by

The refer-clojure spec added in CLJ-2062 supports only limited quoting.

In Clojure 1.8, these are both allowed:

`
user=> (in-ns 'myns)

object[clojure.lang.Namespace 0x579d011c "myns"]

myns=> (clojure.core/refer-clojure :only '[+ -])
nil
myns=> (clojure.core/refer-clojure :only ['+ '-])
nil
`

But in 1.9/1.10, the first is valid but the second will throw:

`
Clojure 1.10.0
user=> (in-ns 'myns)

object[clojure.lang.Namespace 0x61e45f87 "myns"]

myns=> (clojure.core/refer-clojure :only '[+ -])
nil
myns=> (clojure.core/refer-clojure :only ['+ '-])
Syntax error macroexpanding clojure.core/refer-clojure at (REPL:1:1).
(quote +) - failed: #{(quote quote)} at: [:only :arg :quoted-spec :quote]
(quote +) - failed: simple-symbol? at: [:only :arg :spec] spec: :clojure.core.specs.alpha/only
(quote -) - failed: simple-symbol? at: [:only :arg :spec] spec: :clojure.core.specs.alpha/only
`

Cause: This is due to the way the quoted spec is defined, allowing only a quoted list rather than a quoted list of symbols or a list of quoted symbols. A similar issue is seen with import - (import (link: 'java.util 'Date)) fails in a similar way, but it's uncommon for people to invoke import by quoting the internal symbols rather than the outer list (import '(link: java.util Date)).

Proposed: To match support in 1.8, would need specs that include both quoted lists of symbols and lists of quoted symbols.

2 Answers

0 votes
by

Comment made by: alexmiller

Due to the rarity of this usage pattern (this is the first report in over 2 years since this was added), I'm going to mark this minor priority.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2461 (reported by alexmiller)
...