Fork me on GitHub
#rewrite-clj
<
2023-03-14
>
borkdude11:03:21

In #C04QVMQ39LG 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)

borkdude11:03:38

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

lread13:03:27

Very interesting! Will give it a whirl sometime soon!

borkdude13:03:04

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

lread13:03:24

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?

borkdude13:03:24

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.

borkdude13:03:24

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

borkdude13:03:12

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

borkdude13:03:21

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

lread14:03:04

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.

borkdude14:03:51

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

borkdude14:03:11

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