I wouldn't consider this a bug or even an unfortunate behavior necessarily,
but potentially surprising and worth mentioning. The comment reader macro
#_ works just fine as long as nothing breaks the reader. The surprise
happens when you don't consider that for namespaced keywords using ns
aliases, the namespace resolution happens at reader-macro expansion time,
prior to evaluation. As a logical consequence of this is that seemingly
commented out code will fail at read-time if the ns alias or namespace
doesn't exist.
Clojure repro:
user=> (println #_(::fooo/bar))
RuntimeException Invalid token: ::fooo/bar
clojure.lang.Util.runtimeException (Util.java:221)
RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException
(Util.java:221)
user=> RuntimeException Unmatched delimiter: )
clojure.lang.Util.runtimeException (Util.java:221)
ClojureScript repro:
cljs.user=> (println #_(::fooo/bar))
cljs.user=> clojure.lang.ExceptionInfo: [line 1, col 23] Invalid keyword:
::fooo/bar. {:type :reader-exception, :ex-kind :reader-error, :file nil,
:line 1, :col 23}
at clojure.core$ex_info.invokeStatic(core.clj:4739)
at clojure.core$ex_info.invoke(core.clj:4739)
at clojure.tools.reader.impl.errors$throw_ex.invokeStatic(errors.clj:34)
at clojure.tools.reader.impl.errors$throw_ex.doInvoke(errors.clj:24)
...
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.