pika-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pika-dev] On macros and modules


From: Matthew Dempsky
Subject: [Pika-dev] On macros and modules
Date: 17 Jun 2004 20:31:31 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

I've been thinking about how to properly support macros and modules
over the past few days, and I've more or less come to a point that I'm
wondering what the advantages would be of the proposed macro system
(as described in Pika's design notes along with previous mailing list
discussions) over Clinger's explicit renaming macros.

For those unfamiliar with explicit renaming macros, they're quite
similar to what Tom's proposed with the key differences being that
instead of calling HYGIENIC-BINDING-OF, a second parameter is passed
to the transformer procedure (typically called rename) which does
pretty much the same thing (except that it's functional, so multiple
calls return the same new identifier).  The other difference is we
propose using EQV? for matching identifiers from the input expression
(for example to properly handle ELSE or => in COND) while e.r. macros
have one more parameter (typically compare) which determines if two
identifiers refer to the same binding in the environment where the
expression being expanded comes from.

To demonstrate the differences, here's an example of how let1 is
implemented in Tom's macros:

      (make-transformer
        (lambda (exp)
          (let ((id             (cadr exp))
                (init           (caddr exp))
                (exp            (cadddr exp))
                (_lambda        (binding-of lambda)))
            `((,_lambda (,id) ,exp) ,init))))

while explicit renaming style would be:

      (make-transformer
        (lambda (exp rename compare)
          (let ((id             (cadr exp))
                (init           (caddr exp))
                (exp            (cadddr exp))
                (_lambda        (rename 'lambda)))
            `((,_lambda (,id) ,exp) ,init))))

The only major difference I can see between how these impact use is
that explicit renaming macros can support r5rs's:

        (let ((=> #f))
          (cond (#t => 'ok)))                  ==> ok

(I know there's some disagreement on whether this is actually a good
idea, but for full r5rs compliance we need a way to support it.)

Are there any advantages the proposed macro system has over
e.r. macros that I'm missing?

-jivera





reply via email to

[Prev in Thread] Current Thread [Next in Thread]