Subject: Re: The Lisp-Difference
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 20 Sep 2004 21:21:59 -0500
Newsgroups: comp.lang.lisp
Message-ID: <QvadnbvC2v_aDdLcRVn-pA@speakeasy.net>
Peter Seibel  <peter@javamonkey.com> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) writes:
| > 	(defun foo (x)
| > 	  (declare (transactional "ISOLATION LEVEL SERIALIZABLE")
| > 	  ...code...)
| >
| > so that, as someone else noted, you could have a compiler macro
| > for FOO that reached in, parsed the declaration, and rewrote the
| > function, perhaps into this:
| >
| > 	(defun foo (x)
| > 	  (with-transaction (:isolation-level :serializable)
| > 	    ...code...))
| 
| Uh, I'm not sure how a compiler macro is going to help--it's not going
| to see the definition of FOO, it's going to see the call to FOO, no?
| Seems more like you'd need to shadow DEFUN. But at that point you
| don't need to declare your declaration because the declaration is just
| data to your macro that will, presumably, never be seen by the compiler.
+---------------

D'oh!! What an oversight! (*blush*)  Thanks for the catch!

By the way, I was just about to write a self-followup suggesting
shadowing DEFUN, but not for the reason you note. Even if I hadn't
been so wrongheaded about using compiler macros, I was going to
suggest shadowing DEFUN anyway so you could automatically define
a compiler macro for every DEFUN that contained one of those magic
declarations in it... whereupon, as you note, the need for compiler
macros goes away completely.


-Rob

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