summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Listopadov <andreyorst@gmail.com>2022-10-30 11:51:28 +0300
committerAndrey Listopadov <andreyorst@gmail.com>2022-10-30 11:51:28 +0300
commit5232de8401af5fe1ebcd9f5fcdbee9e5c2b90051 (patch)
treef16383b168a20103ca9f244c268b35ee47966fd7
parent1e445990065936a07cf1e33be2ea5c48799ac289 (diff)
check if namespace symbol is in scope before binding
Prevents the situation when cljlib was loaded in the REPL which had a side effect on setting the compile-time `current-ns` variable, and thus affected the REPL too, resulting in such macros like `def` and its variants trying to bind to a non-existent namespace.
-rw-r--r--init-macros.fnl2
1 files changed, 1 insertions, 1 deletions
diff --git a/init-macros.fnl b/init-macros.fnl
index 7ee918b..3efed1c 100644
--- a/init-macros.fnl
+++ b/init-macros.fnl
@@ -149,7 +149,7 @@ string is given, it's value is set to `true` in the meta table."
[{:private true} name val]))
`(local ,name ,val)
[name val]
- (if current-ns
+ (if (in-scope? current-ns)
`(local ,name
(let [v# ,val]
(tset ,current-ns ,(tostring name) v#)