Subject: Re: how can I do this with macros?
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 18 Aug 2003 11:26:14 -0500
Newsgroups: comp.lang.lisp
Message-ID: <KeCcnYhGprK7Y92iXTWc-w@speakeasy.net>
Wade Humeniuk <wade@nospam.nowhere> wrote:
+---------------
| "Lowell" <lkirsh@cs.ubc.ca> wrote:
| > I created a (simple) function called make-alias which creates a function 
| > with the same semantics as another function. It which works like this:
| > How can I do this?
| 
| (defmacro macro-alias (alias macro)
|   (let ((body (gensym)))
|     `(defmacro ,alias (&body ,body)
|        `(,',macro ,@,body))))
+---------------

Is the GENSYM really necessary in this case, given that the *only* thing
the aliased macro does is expand into a single call of the original?
Wouldn't this be good enough?

  (defmacro macro-alias (alias macro)
    `(defmacro ,alias (&body body)
       `(,',macro ,@body)))

I understand how in general you want to be careful about variable capture,
but in this case won't the variable BODY have disappeared before the aliased
macro ever expands? And thus there won't be any BODY to capture?

What am I missing?


-Rob

-----
Rob Warnock, PP-ASEL-IA		<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607