clj-kondo

https://github.com/clj-kondo/clj-kondo
borkdude 2020-05-31T11:00:50.273400Z

@dominicm The above might be a solution for your custom try+ macro. Wanna give it a try?

dominicm 2020-05-31T11:30:50.274Z

Interesting! I'll share this with #meander and see what comes up

dominicm 2020-05-31T11:32:54.275500Z

@borkdude is there a solution for when you don't know the type, or calculating the actual code form would be costly? My first thought is just to bind to nil

borkdude 2020-05-31T11:36:13.275800Z

@dominicm That might result in unused bindings, etc.

dominicm 2020-05-31T11:37:10.276900Z

Hmm. I guess that matching does check for the presence of the key as well...

dominicm 2020-05-31T11:38:07.278100Z

So I guess I'd need to implement a subset of meander in sci to get kondo to work with it

borkdude 2020-05-31T11:42:31.278600Z

yes, that's the idea. implement a function which expands into something that clj-kondo understands, which mimics the real macro

borkdude 2020-05-31T15:25:35.279400Z

@dominicm I believe I have one for slingshot here:

dominicm 2020-05-31T15:45:10.280400Z

I think step 1 is implementing meander. Then try/catch should be easy

borkdude 2020-05-31T15:57:05.280900Z

Personally I think this will be a powerful feature. You can even throw exceptions when validating the macro input.

borkdude 2020-05-31T18:53:27.282300Z

@dominicm In case you, or anyone else wants to play with this, here is some info: https://github.com/borkdude/clj-kondo/issues/811

borkdude 2020-05-31T19:13:09.283200Z

maybe @seancorfield would also be interested in this, since you recently wrote custom analyzers for jdbc macros which could now be done in user-space with the above.

seancorfield 2020-05-31T21:27:16.284600Z

I'll take a look when I'm back at work tomorrow. I haven't been following the discussion today.

borkdude 2020-05-31T21:27:27.284900Z

thanks!

2020-05-31T22:49:15.286400Z

Wouldn't most macroexpand passed to :macroexpand just be the macro code as is?