rewrite-clj

borkdude 2023-03-14T11:28:21.529019Z

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)

borkdude 2023-03-14T11:28:38.955609Z

we could add this to the docs of rewrite-clj maybe

lread 2023-03-14T13:31:27.666859Z

Very interesting! Will give it a whirl sometime soon!

borkdude 2023-03-14T13:39:04.688169Z

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

lread 2023-03-14T13:53:24.298939Z

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?

borkdude 2023-03-14T13:54:24.494009Z

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.

borkdude 2023-03-14T13:57:24.727359Z

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

borkdude 2023-03-14T13:58:12.606489Z

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

borkdude 2023-03-14T13:58:21.352029Z

but I'll wait for some feedback before I change it

lread 2023-03-14T14:00:04.888949Z

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.

borkdude 2023-03-14T14:00:51.649669Z

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

borkdude 2023-03-14T14:01:11.295569Z

and s-expressing nodes isn't what people do a lot maybe

lread 2023-03-14T14:01:31.123459Z

ya

lread 2023-03-14T14:01:35.251129Z

true