Welcome! Please see the About page for a little more info on how this works.
Hello! I'm not sure if this is a bug, so I'll report here and ask, "is this expected?"
It seems that defrecord and deftype forms don't have access to bindings in their lexical closure. Both of the following type declarations fail in Clojure 1.10.1 with " Unable to resolve symbol: x in this context":
defrecord
deftype
(defprotocol ID (id [x] x)) (let [x 10] (deftype TType [] ID (id [_] x))) (let [x 10] (defrecord TRecord [] ID (id [_] x)))
Cheers!
This is expected, and not a bug - this is doc'ed in the deftype docstring.