|
|
|
|
|
by patrec
2038 days ago
|
|
Well, that's the standard Common Lisper opinion. I don't buy it though -- I don't get the impression that it's a problem in clojure (which does not have scheme-style hygenic macros, but shares the single namespace for variables and functions) either. |
|
In a Lisp-1, we have to worry about this:
Since the macro is not defining anything (its expansion is not introducing a binding for list), the ordinary gensym approach is not applicable.THe problem persists into a Lisp-2 like Common Lisp, in this form:
Since local functions are rarer than local variables, and extra care can be taken in how hey are named, Lisp-2 mitigates the problem. Common Lisp goes a step further and makes it undefined behavior if code redefines a standard function (lexically or otherwise).Hygienic macros solve this aspect of the issue as well. A hygienic (mac ...) can use (list ...) in its expansion. The hygiene mechanism ensures that this calls that list which is lexically visible at the macro definition (probably the global one in the library) even if the target site shadows list with its own definition.