Fork me on GitHub
#clojurescript
<
2023-12-30
>
hifumi12301:12:20

What’s a good way to determine if I am in Clojure or ClojureScript in a macro that uses information of lexical bindings? Is it safe to do sth like

(if (contains? &env :ns)
  (keys (:locals &env))
  (keys &env))
or is there a better way? where “better” means “less likely to incorrectly treat Clojure as ClojureScript”

Bob B02:12:24

do reader conditionals do what you want?

hifumi12302:12:30

I am not using self-hosted ClojureScript, so macros run in Clojure and I cannot rely on reader conditionals here

p-himik07:12:38

Don't know about :locals, but (:ns &env) is the way to distinguish the platforms, yes.