Fork me on GitHub
#clojure
<
2020-12-08
>
gphilipp12:12:57

👋 https://github.com/clojure/data.xml has been on 0.2.0-alpha6 for over 2 years, with the latest stable being 0.0.8, yet https://github.com/cognitect-labs/aws-api is itself stable and https://clojurians-log.clojureverse.org/aws/2020-03-15 with 0.0.8 and requires 0.2.0-alpha6 instead. Is there anything preventing the rollout of a 1.0 version of org.clojure/data.xml @alexmiller?

👍 3
Alex Miller (Clojure team)14:12:01

To be honest, I don’t know. data.xml is run by Herwig. I’ve asked him this question a couple times and have not gotten an answer. It was originally alpha because of the namespace mapping approach I believe. I can certainly ask again :)

gphilipp15:12:30

:thinking_face: Actually there’s a rather big breaking change between the 2 versions as clojure.data.xml.Element isn’t there anymore in 0.1.0 as it’s been moved to clojure.data.xml.node. Since we’re using both cognitect/aws-api and circleci.tests (https://github.com/circleci/circleci.test/blob/master/src/circleci/test/report/junit.clj#L6), I’m kinda stuck 😢. I’ll have to move away from circleci.test I reckon.

Alex Miller (Clojure team)15:12:16

I have not looked at that. doing a quick skim, seems like users of data.xml are pretty split on 0.0.x and 0.2.0-alphaY

gphilipp17:12:37

Even the default behaviour of clojure.data.xml/parse-str in both versions is different. They should be different libraries at that point so that both could coexist.

clj -Sdeps '{:deps {org.clojure/data.xml {:mvn/version "0.0.8"}}}'
Clojure 1.10.1
user=> (require '[clojure.data.xml])
nil
user=>  (clojure.data.xml/parse-str "<tag1>\n  <tag2>bar</tag2>\n</tag1>")
#clojure.data.xml.Element{:tag :tag1, :attrs {}, :content (#clojure.data.xml.Element{:tag :tag2, :attrs {}, :content ("bar")})}
vs
clj -Sdeps '{:deps {org.clojure/data.xml {:mvn/version "0.2.0-alpha6"}}}'
Clojure 1.10.1
user=> (require '[clojure.data.xml])
nil
user=> (clojure.data.xml/parse-str "<tag1>\n  <tag2>bar</tag2>\n</tag1>")
#xml/element{:tag :tag1, :content ["\n  " #xml/element{:tag :tag2, :content ["bar"]} "\n"]}

Jakub Holý (HolyJak)12:12:19

Hello! How can I require a namespace with unknown tagged literal (`#uknown-tagged-literal` in this case)? I have tried

(binding [*default-data-reader-fn* (fn [tag value] nil)]
      (require namespace))
expecting the data to simply become nil but the only effect is that the former exception, > ExceptionInfo: /path/to/unknown_tagged_literal.cljc [line 4, col 38] No reader function for tag uknown-tagged-literal. has been replaced with > Caused by: clojure.lang.Compiler$CompilerException: Syntax error reading source at (metagetta_test_special/unknown_tagged_literal.cljc:4:41). > Caused by: java.lang.RuntimeException: No dispatch macro for: u >  at clojure.lang.Util.runtimeException (Util.java:221) >   clojure.lang.LispReader$DispatchReader.invoke (LispReader.java:851) >   clojure.lang.LispReader.read (LispReader.java:285) >   clojure.lang.LispReader.readDelimitedList (LispReader.java:1398) >   clojure.lang.LispReader$ListReader.invoke (LispReader.java:1243) >   clojure.lang.LispReader.read (LispReader.java:285) >   clojure.lang.LispReader.read (LispReader.java:216) >   clojure.lang.Compiler.load (Compiler.java:7631) For more details you can see the code at https://github.com/cljdoc/cljdoc-analyzer/pull/33/files and the errors in the commit message here https://github.com/cljdoc/cljdoc-analyzer/pull/33/commits/fd2ac5449d45e7431ac1dfb1dc7dbc85949772a2 🙏 (My intention is to allow #cljdoc to read sources even if they contain unknown tagged literals; it only cares about top-level publics so it should not matter most of the time.)

3
borkdude12:12:04

@holyjak you can use tagged-literal

❤️ 3
Jakub Holý (HolyJak)14:12:22

Thanks a lot, that fixed it! I guess my problem was that my *default-data-reader-fn* returned nil , perhaps it must return something non-nil not to fail downstream.

Jakub Holý (HolyJak)14:12:22

Thanks a lot, that fixed it! I guess my problem was that my *default-data-reader-fn* returned nil , perhaps it must return something non-nil not to fail downstream.

Yehonathan Sharvit15:12:11

Hello! Are there any forbidden characters inside a keyword? I tried to convert a string with special chars and hebrew chars and I couldn’t make the keyword function fails

(keyword "aa/bbשלום/dd.dd/a:::$$$ :a")

Alex Miller (Clojure team)16:12:46

officially, from the reader reference the allowed set is "alphanumeric characters and *, +, !, -, _, ', ?, <, > and =". Hebrew chars would imo fall under "alphanumeric". / and : have special constraints that are further elaborated on in the text.

Yehonathan Sharvit11:12:04

Thank you for the detailed clarification

mpenet15:12:22

yes, the reader has some rules (https://clojure.org/reference/reader) but it's not all enforced, but you'll get broken behavior if you do not respect them in some cases

mpenet15:12:34

(keyword "")

mpenet15:12:50

they will be unreadable essentially

mpenet16:12:07

(keyword "" "")
=> :/

mpenet16:12:25

it can get weird fast

Yehonathan Sharvit16:12:14

I have no intended plan to break the rules but I am willing to use https://github.com/tolitius/cbass#finding-by-the-row-key for retrieving value on HBase. cbass find-by functions automatically keywordize column names. I am asking myself if it could break in some edge cases

Alex Miller (Clojure team)16:12:12

programmatically created keyword objects are fine and useful for things like these - you get into trouble when you venture into print/read roundtripping

Alex Miller (Clojure team)16:12:36

if that's a thing you expect to do, you should use strings instead

Yehonathan Sharvit16:12:01

Thanks for the clarification

Yehonathan Sharvit16:12:28

So basically any string could be programmatically converted to a keyword?

borkdude16:12:23

You can test this using clojure.spec.gen.alpha :)

borkdude16:12:09

If I'm not mistaken, a keyword is interned using a symbol and that in turn is represented by strings internally: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Symbol.java#L20-L21 So I think it should work for all strings.

Carlo21:12:55

some time ago I saw on youtube someone using an emacs setup to step into a function so that the result of each form was printed as he went along (for debugging). Do you know what that could have been?

borkdude21:12:25

Maybe the cider debugger?

Carlo21:12:22

yes, that was probably it, although it doesn't seem to work with clojurescript https://github.com/clojure-emacs/cider/issues/1416 is there an alternative for clojurescript?

dpsutton21:12:49

i'm not aware of any debugger for cljs. Cursive and CIDER each only support Clojure as far as I am aware

didibus23:12:31

It is editor agnostic.

🙌 3