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
metadata added by read-string (as compared to clj implementation). #1665
Comments
@skat-kurt It's not recommended to use |
Thanks, using |
Nonetheless, I'll try to align bb's behavior to clj's. |
I'll have to stick with my original work-around for now. The original file I want to read contains a regex, which
Results in the java.lang.RuntimeException: No dispatch macro for: " exception, mentioned in another issue as well. That behavior is identical with standard clojure though. |
regexes aren't part of EDN, so if your file ends with |
You are right. A pity that the clojure.edn namespace isn't symetric. I mean, there is no Some background. The "edn" files form the basis to auto-generate leiningen compatible project.clj files and some of them need :userjar-merge-with in combination with regex, as seen in the example project.clj file https://gitlab.com/technomancy/leiningen/blob/master/sample.project.clj#L436. I'll find another way to express this in the source edn files, so that they become valid edn files and take it from there. |
Well, |
I think I'll go with introducing a reader tag for regex, so that the edn files at least become valid, while
|
@skat-kurt I recommend using something like edamame for this, which is built into babashka as well. You can tweak whatever you want to allow in your (require '[edamame.core :as e])
(e/parse-string "..." {:regex true :location? (constantly false)}) |
version
Babashka 1.3.186
platform
Arch Linux (6.7.3-arch1-2)
problem
read-string
on edn and then printing it back with *print-meta* bound to true gives different results between babashka and clojure.repro
The following file is on disk at PATH.
Now execute the following sequence of expressions.
expected behavior
I would execpt the output to be identical with the output that standard clojure prints. The babashka version is almost the same, but 1 expression (the list with symbols
comp
andodd?
got tagged with metadata (^{:line 9, :column 21}
).The actual edn file I want to read has some metadata tagging in it that I want to keep when writing a new file, but I don't want extra metadata from the read process. For now I have fixed this by postwalking the datastructure from
read-line
.eg.
The text was updated successfully, but these errors were encountered: