Hey, guys! Could you please give me a piece of advice?
I am working on https://github.com/Liverm0r/DartClojureClojure> translator. Started it as just a function that converts an AST to string code representation, and then read-string (to effectively pprint the result with proper indentation).
Then I decided to make some improvements to generated code — for example, to convert (and (< 1 2) (< 2 3)) to (< 1 2 3), or to use specific to flutter macro s when appropriate.
So the code transformations looks like:
AST -> String -> Quoted list '() -> Improved '()
Now I want to get rid of step -> String and I see 2 options:
1. Write clojure as '() and then manipulate this structures with clojure.zip and clojure.walk (I do it now).
2. Write clojure with rewrite-clj/node and manipulate with rewrite-clj/zip.
First approach has more performance benefits as you do not create intermediate objects.
Second one has more features, extended zip api, and allows to print typed hints, like ^:private (I didn't get how not to lose this hints when printing the result as quoted list).
May be there is something I don's see and don't take into account?
@arturdumchev I can imagine that the transformation is only done once, so performance doesn't really matter that much?
Yes, only once. And as I see usages — it will be a small pieces of code