-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S-expr-ed tagged literal results in unqualified reference to read-string #331
Comments
I think I get the rationale, but I need more words to explore/verify. BackgroundRewrite-clj emits (require '[rewrite-clj.node :as n]
'[rewrite-clj.parser :as p])
(-> "#inst \"2018-03-28T10:48:00.000\""
p/parse-string-all
n/sexpr)
;; => (read-string "#inst \"2018-03-28T10:48:00.000\"") ProblemThe implication is that the user might, in turn, eval this (-> "#inst \"2018-03-28T10:48:00.000\""
p/parse-string-all
n/sexpr
eval
((juxt type str)))
;; => [java.util.Date "Wed Mar 28 06:48:00 EDT 2018"] And that because SnagBut So we probably want to emit a qualifier that makes sense across platforms. Ideas:
RelatedNot scoped in this issue but worth mentioning:
(-> "#?(:clj x :cljs y)"
p/parse-string-all
n/sexpr)
;; => (read-string "#?(:clj x :cljs y)") Not sure how to handle this one. Would need user=> (clojure.core/read-string {:read-cond :allow} "#?(:clj x :cljs y)")
x Maybe handle reader conditionals better/differently with |
Yeah I think |
Ok, I think that sounds good. It won't deal with reader conditionals, but that would have to be a separate issue. |
Sexpr-ing a tagged literal results in an expression like
(read-string "#foo/bar 1)
.Imo this should be fully qualified to prevent clashes with referred vars from elsewhere.
PR incoming.
The text was updated successfully, but these errors were encountered: