Some claim that a single namespace in LISP leads to unhygienic macros. http://community.schemewiki.org/?hygiene-versus-gensym
http://www.nhplace.com/kent/Papers/Technical-Issues.html
What precisely is it about having single, dual or multiple namespaces that leads to macro hygiene?
Lisp-2 means you have two namespaces: one for functions, one for the other stuff.
This means you're less likely to rebind a function value (or var value) in a macro, unwittingly.
In Lisp-1, since there's one namespace, you're (statistically, but not practically) twice as likely to hit an existing definition.
In reality, Lisp-1s have hygiene covered with things like
gensym
and Scheme's confusingly wide array ofsyntax-structure
-like macros that keep things hygienic.As best I can tell, the issue is mostly a straw-man argument: it's only an issue in the poorer or older implementations.
Clojure offers hygienic macros through
gensym
or the reader macromyvar#
(the#
is essentiallygensym
).And you don't have to worry about local scope rebinding your function in your macros, either: Clojure is all clean:
And here's some variable hygiene:
Notice our sexy
gensym
'dx#
.