Welcome! Please see the About page for a little more info on how this works.
Tools.reader accepts this symbol: MyClazz:/3 while it does not accept the symbol MyClass:. This seems inconsistent. That's the main subject of this "ask".
MyClazz:/3
MyClass:
Incidentally I noticed that this commit https://github.com/clojure/tools.reader/commit/31adc06cd56753ed5a3cd443cea32158ba68c45c#diff-11ba7fe0994caede16eeb1c6ed52fc3aba112849ce1fd23dff0b9fb72441a09fR111 uses a regex + re-matches to check if the string sym is a 1-sized numeric string. I noticed that this causes a slight performance regression compared to version 1.4.2. I think the check can be implemented using a somewhat more elaborate but more performant check:
sym
E.g. this version seems to be roughly 6x faster than the re-matches approach:
user=> (defn array-dim? [^String s] (and (= 1 (.length s)) (some-> (try (Integer/parseInt s) (catch Exception e nil)) pos?))) #'user/array-dim? user=> (time (dotimes [i 10000000] (array-dim? "1"))) "Elapsed time: 45.287416 msecs"
user=> (defn array-dim2? [^String s] (re-matches #"[1-9]" s)) #'user/array-dim2? user=> (time (dotimes [i 10000000] (array-dim2? "1"))) "Elapsed time: 304.30275 msecs" nil
Note how clojure's own reader implemented it:
https://github.com/clojure/clojure/commit/1fa5b038a434da34f787e3aec56f9cb48ed4dd99#diff-9216bc4fd055e0567fa034ec14a8ba470d36ba5be16418c8f2e2ebe1939bbb21R259
Ticket created https://clojure.atlassian.net/browse/TRDR-74