tools.reader

cljs.tools.reader does not handle double-colon keywords

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    Clojure 1.9.0-alpha14 with ClojureScript 1.9.293.

Description

In tools.reader 1.0.0-beta3, cljs.tools.reader/read-string incorrectly parses double-colon keywords such as ::blah and ::s/blah.

(read-string "::blah") returns a keyword with an empty-string namespace "", equivalent to:

(keyword "" "blah")

(read-string "::s/blah") throws a reader exception:

#error {:message "Invalid token: ::s/test", :data {:type :reader-exception}}.

In contrast, the JVM Clojure version returns the expected contextually namespaced keywords.

Activity

Hide
Nicola Mometto added a comment -

This is not a problem with tools.reader, rather an inherent problem with how tools.reader has to work around clojurescript's lack of reified namespaces.

To allow resolving namespaces, cljs.tools.reader relies on the value of `cljs.core/ns` and `cljs.tools.reader/alias-map`, which the user of `cljs.tools.reader` is responsible for setting up.

Show
Nicola Mometto added a comment - This is not a problem with tools.reader, rather an inherent problem with how tools.reader has to work around clojurescript's lack of reified namespaces. To allow resolving namespaces, cljs.tools.reader relies on the value of `cljs.core/ns` and `cljs.tools.reader/alias-map`, which the user of `cljs.tools.reader` is responsible for setting up.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: