In #edamame there is now a edamame/parse-ns-form function which returns a map which could be used with rewrite-clj's sexpr options as well (if you massage it in the right form, of course)
we could add this to the docs of rewrite-clj maybe
Very interesting! Will give it a whirl sometime soon!
it's the same as this:
https://github.com/borkdude/ns-parser/blob/bbdb60ec67af0c8e7adf820b71966bd3bee6569d/test/borkdude/ns_parser_test.cljc#L8
but I moved that parse-ns-form into edamame core instead of a separate lib
Cool. Curiosity: A while back we had thought rewrite-clj should not take on the job of interpreting namespaces. Edamame is now doing so, do you think rewrite-clj should/could also be doing so?
Yeah. I was on the fence but it came up quite often that I just bit the bullet. We could do it as an option, similar to edamame.
What I did in edamame is :auto-resolve-ns true and if the alias still isn't found based on that, I fall back on the :auto-resolve options
it could also be argued that :auto-resolve should be tried first, then based on the ns state and then falling back on auto-resolve again
but I'll wait for some feedback before I change it
Yeah, the :auto-resolve support being there is good, but I expect it goes unused because folks just have no idea what to hook up to properly interpret nses.
in rewrite's case, it defaults to something that doesn't crash so it's not usually necessary to configure, but in edamame's case it will crash
and s-expressing nodes isn't what people do a lot maybe
ya
true