Scope leakage

0 views
Skip to first unread message

Mike Austin

unread,
Nov 14, 2021, 12:39:11 AM11/14/21
to PiLuD
I just leaned that even inside functions, “def” in Clojure will set a top level binding. Not what I expected, being a new-ish language.

;; Note that if you use def inside a let block, your interned variable is within
;; the current namespace and will appear OUTSIDE of the let block.

user=> (let [y 1] (def z y) y) 1
user=> z
1

Reply all
Reply to author
Forward
0 new messages