rewrite-clj 2021-07-24

@lee I may have found a bug in rewrite-clj:

user=> (require '[rewrite-clj.node :as node])
nil
user=> (defmacro let+ [local-name binding & body]
  `(let [~local-name ~binding]
     ~@body))
#'user/let+
user=> (node/coerce (macroexpand '(let+ y 1 (+ 1 2 y)))

)
<token: (let* [y 1] (+ 1 2 y))>

Hmmm... thanks very much for the report @borkdude! I shall take a peek sometime this weekend!

I will look into it myself too

@lee it's a missing NodeCoercable impl on clojure.lang.Cons

there are a few more of these types

I'll add a PR

Thanks! While I sip my morning coffee, you are being productive!

(I'm working in trying to support macros directly in clj-kondo)

(which probably won't work very well, but worth a try... again)

@lee is there something in rewrite-clj like sexpr which adds the location metadata of the node to the sexpr if possible?

else I think I would write it myself

@borkdude no, not that I know of!

👍 1

I'm using sexpr + coerce to transform between node -> sexpr -> node so perhaps people can use "normal" macros

and still get some precision with respect to locations