As you can tell from the almost absurd level of configurability in zprint, I am skeptical of the overall utility of a formatter which enforces the “one true way” for formatting Clojure source. However, it seems clear that there is at least some interest in a Clojure source formatter which doesn’t have any options.
Personally, I haven’t yet found a set of formatter options I like 100% of the time for my own code, which is why I implemented the ;!zprint {}
directive capability in source files – so I could sometimes change the formatting for a particular function or, more usually, a particular data definition in a file.
I have put considerable effort into creating the capability in zprint to implement the community style, and to get that you just say {:style :community}
. That said, I have seen very little code in the wild that actually adheres to my understanding of the community style. But maybe the time has come for a single style.
I am currently working on an issue in zprint which involves some source code rewriting in Leiningen project.clj files, and my implementation approach would equally support modifying ns
declarations, so zprint is already moving in that direction. If there are other things it can’t do, I’d be more than happy to look into enhancing it.
I don’t imagine removing the current level of configurability from zprint, but I would certainly be open to both:
- Creating a new style which embodies the “fixed” formatting that you all agree on.
- Creating a version of zprint which has no configurability but just does that fixed style.
With graalvm it runs very fast (<55ms startup), and for environments where graalvm isn’t suitable, the appcds/jvm approach works well (<900ms startup). It also runs fine in cljs
.
I will be happy to do considerable implementation to help realize the goals that you have set out. Just to be clear, I’m not volunteering to play a significant role in driving the community to a consensus on what the format should look like. Not least because my personal opinions on the subject (e.g. the current zprint defaults) are moderately far afield from the current community approach, though I greatly respect the work it has taken to create the community approach.