Fork me on GitHub
#rewrite-clj
<
2021-07-24
>
borkdude13:07:31

@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))>

lread13:07:31

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

borkdude13:07:01

I will look into it myself too

borkdude15:07:53

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

borkdude15:07:07

there are a few more of these types

borkdude15:07:12

I'll add a PR

lread15:07:55

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

borkdude15:07:07

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

borkdude15:07:24

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

borkdude15:07:03

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

borkdude15:07:28

else I think I would write it myself

lread20:07:54

@borkdude no, not that I know of!

👍 3
borkdude20:07:27

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

borkdude20:07:42

and still get some precision with respect to locations