Subject: Re: The Lisp-Difference
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 20 Sep 2004 20:39:31 -0500
Newsgroups: comp.lang.lisp
Message-ID: <E8Kdnc0x0drOG9LcRVn-sA@speakeasy.net>
Pascal Costanza  <costanza@web.de> wrote:
+---------------
| >   (declare transactional)
| > Never heard of this. Can someone explain?
| 
| There is a discussion about a DEFINE-DECLARATION macro in CLtL2
| (Section 8.5). This was dropped for ANSI Common Lisp.
+---------------

Actually, there *is* a trace of it left in ANSI CL. See the
CLHS "Declaration DECLARATION":

	(declaration name*) 
	...
	Advises the compiler that each name is a valid but
	potentially non-standard declaration name. The purpose
	of this is to tell one compiler not to issue warnings
	for declarations meant for another compiler or other
	program processor. 

So if one were to say:

	(declaim (declaration transactional))

then it becomes legal to later write things such as this:

	(defun foo (x)
	  (declare transactional)
	  ...code...)

or even something like this [for SQL fans]:

	(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...))


-Rob

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