Fork me on GitHub
#clj-kondo
<
2023-12-12
>
mpenet09:12:16

would clj-kondo be able to catch fn calls that take predicates/fn argument but get a macro passed instead? ex : (apply or [...])

mpenet09:12:30

currently it doesn't, at least for that simple example

borkdude09:12:14

in general it should catch "cannot pass macro as a value" I think. I made an attempt at this at one point, but it was more difficult than I thought :) could have a stab at it again

borkdude09:12:47

I think this could now possible be solved via the type system. If a var has type :macro and any argument to a non-macro has type :macro we could warn, or so

borkdude09:12:04

plz upvote the issue 1725

anthony-galea09:12:16

Would it be useful also to make suggestions in specific cases? ex: (some identity) for (apply or) ?

mpenet09:12:24

will do. Thanks for the (insanely) quick reply

Rachel Westmacott12:12:18

I seem to be experiencing an issue where a namespace require is considered unused, but I am in fact using it.

(ns foo (:require [my-ns :as my-alias]))     (do-something-with-symbol 'my-alias/bar)

borkdude12:12:04

In this case the alias is not used, unless you use

`my-alias/bar
vs
'my-alias/bar

borkdude12:12:44

backtick = syntax-quote, uses alias resolving, normal quote does not

gratitude 1
Noah Bogart15:12:14

hook question/request: I'd like to be able to check if an object is a var. when i print it, it says <var: #'my-var>, and if i print the type, it says clj_kondo.impl.rewrite_clj.node.reader_macro.ReaderNode, but I can't check (instance? clj_kondo.impl.rewrite_clj.node.reader_macro.ReaderNode obj) because sci can't resolve that. i just realized i can check the :tag, but is that the right way to do it? (= :var (:tag obj))

borkdude15:12:47

it's better to use api/tag btw since :tag may not always give the right answer

👍 1
Noah Bogart16:12:57

Cool, thank you