Fork me on GitHub
#clj-kondo
<
2020-05-31
>
borkdude11:05:50

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

dominicm11:05:50

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

dominicm11:05:54

@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

borkdude11:05:13

@dominicm That might result in unused bindings, etc.

dominicm11:05:10

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

dominicm11:05:07

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

borkdude11:05:31

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

borkdude15:05:35

@dominicm I believe I have one for slingshot here:

dominicm15:05:10

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

borkdude15:05:05

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

borkdude18:05:27

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

borkdude19:05:09

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.

seancorfield21:05:16

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

didibus22:05:15

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