(def ok "whatever")
creates a variable called ok
at compile time. The compiler scans the entire form to compile it, finds that you will define a variable called ok
and create it for you (without binding) before your form is actually executed. When the def
form is actually executed, the runtime value of the expression will be assigned to the var user/ok
variable. In your example, this never happens, because var is already created, and the if
branch goes the other way.
Using bound?
a terrible idea as a substitute, as it checks for something completely different: does the named var (which must exist) have a constant or local stream binding.
amalloy
source share