tools.namespace

Support reader conditionals

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test

Description

The tools.namespace parser does not recognize reader conditionals.

refresh does not recognize files containing reader conditionals.

Patch calls read with :read-cond :allow. It checks for the presence of clojure.core/reader-conditional? to determine if reader conditionals (and the 2-argument arity of read) is supported.

The patch use the default platform feature, which should always be :clj since tools.namespace only runs under Clojure(JVM).

Sample project from original ticket: https://github.com/whodidthis/refresh-rc

Activity

Hide
Leon Grapenthin added a comment -

I can confirm having the same problem.

Show
Leon Grapenthin added a comment - I can confirm having the same problem.
Hide
Sean Doig added a comment -

Maybe the team don't agree but I'm not sure this is a bug - 1.7.0 hasn't landed yet.

In the interim those having problems can use this temporary fork, which is hardcoded to read :clj features.

Show
Sean Doig added a comment - Maybe the team don't agree but I'm not sure this is a bug - 1.7.0 hasn't landed yet. In the interim those having problems can use this temporary fork, which is hardcoded to read :clj features.
Hide
Magnar Sveen added a comment -

Can confirm that using Sean's temporary fork seems to solve the issue.

Show
Magnar Sveen added a comment - Can confirm that using Sean's temporary fork seems to solve the issue.
Hide
Alex Miller added a comment -

Someone else pinged me about this. Likely the read here needs to pass {:read-cond :allow} options to read (only on 1.7 as the options are an arity that was added in 1.7).

https://github.com/clojure/tools.namespace/blob/master/src/main/clojure/clojure/tools/namespace/parse.clj#L36

Show
Alex Miller added a comment - Someone else pinged me about this. Likely the read here needs to pass {:read-cond :allow} options to read (only on 1.7 as the options are an arity that was added in 1.7). https://github.com/clojure/tools.namespace/blob/master/src/main/clojure/clojure/tools/namespace/parse.clj#L36
Hide
Stuart Sierra added a comment -

Patch available to try as 0.2.11-SNAPSHOT or 0.2.11-20150619.155542-23

In Leiningen:

:dependencies [[org.clojure/clojure "1.7.0-RC2"]
                 [org.clojure/tools.namespace "0.2.11-SNAPSHOT"]]
  :repositories [["sonatype-oss-public"
                  "https://oss.sonatype.org/content/groups/public/"]]
Show
Stuart Sierra added a comment - Patch available to try as 0.2.11-SNAPSHOT or 0.2.11-20150619.155542-23 In Leiningen:
:dependencies [[org.clojure/clojure "1.7.0-RC2"]
                 [org.clojure/tools.namespace "0.2.11-SNAPSHOT"]]
  :repositories [["sonatype-oss-public"
                  "https://oss.sonatype.org/content/groups/public/"]]
Hide
Stuart Sierra added a comment -

Included in release 0.2.11

Show
Stuart Sierra added a comment - Included in release 0.2.11

People

Vote (6)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: