From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: macros, procedure->macro Date: 15 Jul 2002 22:48:38 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <87fzyk4t09.fsf@zagadka.ping.de> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1026766201 754 127.0.0.1 (15 Jul 2002 20:50:01 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 15 Jul 2002 20:50:01 +0000 (UTC) Cc: Neil Jerram , 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 17UCn9-0000C3-00 for ; Mon, 15 Jul 2002 22:50:00 +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 17UCmQ-0007Qs-00; Mon, 15 Jul 2002 16:49:14 -0400 Original-Received: from dialin.speedway42.dip170.dokom.de ([195.138.43.170] helo=zagadka.ping.de) by fencepost.gnu.org with smtp (Exim 3.35 #1 (Debian)) id 17UClt-0007QD-00 for ; Mon, 15 Jul 2002 16:48:41 -0400 Original-Received: (qmail 1478 invoked by uid 1000); 15 Jul 2002 20:48:39 -0000 Original-To: Dirk Herrmann In-Reply-To: Original-Lines: 33 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:806 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:806 Dirk Herrmann writes: > (define-macro (foo x) `(list ,(bar x) ,x)) > (define-macro (bar x) `(* ,x ,x)) > will work, because the macro definition will not be expanded. Careful, Dirk. :) The term 'macro definition' is not really helpful here, I think. On the lowest level, a macro can be thought of as an ordinary function that is called during compilation. In order to run this function, the macros that it uses must be expanded, like in any other function. The literal data structures that are embedded in the function are not expanded, of course (just as they aren't for any other function). However, a 'quasi-quote' form is not a literal data structure, while 'quote' is. 'foo' from above is equivalent to (define-macro (foo x) (list 'list (bar x) x)) Thus, the function of the 'foo' macro makes use of the 'bar' macro, which therefore needs to be defined when the compiler macro-expands 'foo's function, which might be just after it reads it in. Had it been (define-macro (foo x) (list 'list '(bar x) x)) then '(bar x)' would be a literal data structure and the definition for 'bar' would be needed when the 'foo' macro is expanded, which happens probably after 'bar' has been defined. (Dirk, I don't think you need this detailed lecturing, but I couldn't stop myself.) _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel