From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dirk Herrmann Newsgroups: gmane.lisp.guile.user Subject: Re: macros, procedure->macro Date: Sun, 14 Jul 2002 23:35:45 +0200 (CEST) Sender: guile-user-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1026682625 21817 127.0.0.1 (14 Jul 2002 21:37:05 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 14 Jul 2002 21:37:05 +0000 (UTC) Cc: guile-devel@gnu.org, guile-user@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17Tr39-0005fm-00 for ; Sun, 14 Jul 2002 23:37:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17Tr2M-0000Wk-00; Sun, 14 Jul 2002 17:36:14 -0400 Original-Received: from sallust.ida.ing.tu-bs.de ([134.169.132.52]) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17Tr1w-0000WJ-00; Sun, 14 Jul 2002 17:35:48 -0400 Original-Received: from localhost (dirk@localhost) by sallust.ida.ing.tu-bs.de (8.9.3+Sun/8.9.1) with ESMTP id XAA23736; Sun, 14 Jul 2002 23:35:45 +0200 (CEST) Original-To: Neil Jerram In-Reply-To: Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:747 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:747 On 14 Jul 2002, Neil Jerram wrote: > >>>>> "Dirk" == Dirk Herrmann writes: > > Dirk> On 13 Jul 2002, Neil Jerram wrote: > >> Thanks, that's helpful. So we won't support references to a macro > >> that is defined in a following top-level form, as in: > >> > >> (define-macro (foo x) `(list ,(bar x) ,x)) > >> (define-macro (bar x) `(* ,x ,x)) > >> > >> or is there a cunning plan that still allows us to support this? > > Dirk> I don't see why recursive macros shouldn't be possible. [...] > Dirk> However, there are things that won't work any more: > Dirk> (define (foo) (bar)) > Dirk> (define-macro (bar) #f) > Dirk> (foo) > > For the purposes of current discussion, I don't see the difference > between this example and my one above. (Note that my `(bar x)' above > is unquoted, so equivalent to your `(bar)'.) What do you intend to be > the key difference? (Perhaps you meant `(define foo (bar))'?) To clarify I would like to re-state my answer to a previous mail to you: On 10 Jul 2002, Neil Jerram wrote: > I think the perhaps the point is not at what stage macro expansion > happens, but how universal it is. In other words, is macro expansion > performed universally like reading, and so only blocked by quoting, or > is it performed like evaluation, and so blocked/delayed by any number > of special forms including lambda and if. Macro expansion is neither performed like reading, nor like evaluation. Macro expansion is blocked by quoting _and_ macro definitions. It is not blocked by lambda or other special forms. Since macro expansion is blocked by macro definitions, recursive macro definitions are possible. Given this, it should be clear why (define (foo) (bar)) (define-macro (bar) #f) (foo) will not work: The first line is expanded at once. In contrast, (define-macro (foo x) `(list ,(bar x) ,x)) (define-macro (bar x) `(* ,x ,x)) will work, because the macro definition will not be expanded. However, it may be that different macro implementations with different behaviours can co-exist. For example, I don't see why you shouldn't be able to mix calls to procedure->memoizing-macro with calls to define-macro. Then, for each of the different macro systems the behaviour would have to be defined separately. Not all possible systems will comply with the demand for a system that supports compilation and efficient execution, though. Best regards, Dirk Herrmann _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user