Skip to content
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

Clojure 1.12 Array class syntax support #334

Open
PEZ opened this issue Sep 28, 2024 · 4 comments
Open

Clojure 1.12 Array class syntax support #334

PEZ opened this issue Sep 28, 2024 · 4 comments

Comments

@PEZ
Copy link

PEZ commented Sep 28, 2024

Hi! Clojure 1.12 adds new Array class syntax. Example:

(type (make-array Long 10)) => java.lang.Long/1

Unfortunatelly zprint croaks on this:

Invalid symbol: java.lang.Long/1.

And this makes Calva sad.

I haven't checked if this is upstream on rewrite-clj, but adding here to put it on your radar, unless it wasn't already.

@PEZ
Copy link
Author

PEZ commented Sep 28, 2024

I now checked the rewrite-clj issue tracker and couldn't find anything about this. But the issue search engine isn't exactly stellar, so I may just have missed it.

@PEZ
Copy link
Author

PEZ commented Sep 28, 2024

Hmmm... It is not this simple. This works fine:

  #_{zprint/zprint {:mvn/version "1.2.9"}}
  (require '[zprint.core :as zp])
  (zp/czprint-str "^[Long] a" 40 {:parse-string-all? true})
  ;;=> "^[Long] a"
  (zp/czprint-str "^Long/1 a" 40 {:parse-string-all? true})
  ;;=> "^Long/1 a"

I tried this in Clojure. So it may have something to do with that Calva uses the ClojureScript libraries. (And Clojure pre-11, come to think of it.) I'll go check from that end of things and see if I have just bothered you for no reason.

@PEZ
Copy link
Author

PEZ commented Sep 28, 2024

Hello again. I'm sorry for this getting messy. I now think I know why the above test didn't reproduce the problem. Right before that, I had tried this:

  #_{rewrite-clj/rewrite-clj {:mvn/version "1.1.48"}}
  (require '[rewrite-clj.zip :as z])
  (-> (z/of-string "^[Long] a")
      z/sexpr)
  (-> (z/of-string "^Long/1 a")
      z/sexpr)

And that made zprint use rewrite-clj 1.1.48. And we can read in the CHANGELOG for rewrite-cljs on v1.1.48 (which I of course should have done before I hunted in the issue tracker 🤦):

Add support for Clojure 1.12 array class syntax

Using zprint without first requiring the fixed rewrite-clj reproduces the problem.

@kkinnear
Copy link
Owner

Thank you very much for letting me know about this. I had missed this change in Clojure 1.12, and the corresponding upgrade required in rewrite-clj. In my tests as well, rewrite-clj 1.1.48 solves this problem. I will hasten the release of zprint 1.3.0 with the new rewrite-clj to to make this solution available to everyone. Again, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants