On Fri, Sep 11, 2009 at 01:10:01AM -0400, Eli Barzilay wrote:
>
> But if you consider macros with a module system: it allows you to
> keep the abstraction barrier by letting you export a macro but not
> utility functions and values that the macro uses, and it allows you to
> define your own language (for example, a language with a new kind of
> `if') and still be able to import macros that are written in the usual
> Scheme language.
Both of these use cases work just fine with Common Lisp's defmacro,
because CL symbols are interned with respect to a package. A macro (or
anything else) whose definition contains a given symbol will continue to
refer to that same symbol, regardless of what might happen to different
symbols that happen to share its name.
One might almost be tempted to declare that defmacro is "perfect", but
then there are things like this:
(define-syntax with-thing
(syntax-rules ()
((_ a b c ...)
(let-syntax ((a (syntax-rules () ((_) b)))) c ...))))
(let ((x 1)) (with-thing y x (let ((x 2)) (y))))
And if we can deal with (lambda (x) --- (lambda (x) ---) ---) having two
different names both spelled "x", then surely we can handle modules, and
thus there's no need to pile on the feature of a CL-style package system.
--
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l)))))) (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k))))))) '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))
_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss