| John Thingstad 2008-01-29, 9:00 am |
| På Tue, 29 Jan 2008 10:02:34 +0100, skrev Pascal Costanza <pc@p-cos.net>:
>
> You say that Scheme macro systems are too complicated. However, there is
> an important technical aspect there related to the Lisp-1 vs. Lisp-n
> issue: If you go for a Common Lisp-style macro system, a Lisp-1 makes
> macro programming more unreliable than a Lisp-n. Since a Lisp-1 squeezes
> all names into a single namespace, the likeliness for having accidental
> nameclashes is much higher. Lisp-n simply provides more 'air to
> breathe', so to speak.
>
Yes. I seem to hear this a lot.
I have two points.
1. lexical variables seem more important in avoiding naming conflicts than
context sensitive symbol binding. (List-2)
2. packages provide a more robust way of avoiding name conflicts.
in particular in a lisp-1 you could persumably write
(defpackage :my-package) ; no (:use :cl)
(in-package :my-package)
(defmacro sort! (sequence operator)
(lw:rebinding (sequence operator)
`(setf ,sequence (cl:sort ,sequence ,operator))))
(defun test ()
(let ((list (cl:list 3 2 1)))
(cl:print list)
(sort! list cl:< )
list))
and it would output:
(3 2 1)
(1 2 3)
(Ok so it is difficult to demonstrate for such a small example)
--------------
John Thingstad
|