From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.user Subject: Re: Need help to understand a macro Date: Fri, 19 Mar 2010 17:15:57 +0100 Message-ID: <8739zwffsy.fsf@gmx.at> References: <20100319085701.GA31143@raven.wolf.lan> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1269016798 18003 80.91.229.12 (19 Mar 2010 16:39:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 19 Mar 2010 16:39:58 +0000 (UTC) Cc: guile-user@gnu.org To: Andy Wingo Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Mar 19 17:39:52 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NsfEg-0000Tz-PJ for guile-user@m.gmane.org; Fri, 19 Mar 2010 17:39:47 +0100 Original-Received: from localhost ([127.0.0.1]:49090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsfEf-0005if-Kz for guile-user@m.gmane.org; Fri, 19 Mar 2010 12:39:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nserr-0003o1-7a for guile-user@gnu.org; Fri, 19 Mar 2010 12:16:11 -0400 Original-Received: from [140.186.70.92] (port=60355 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nsern-0003l5-CQ for guile-user@gnu.org; Fri, 19 Mar 2010 12:16:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nserk-0005ww-Hk for guile-user@gnu.org; Fri, 19 Mar 2010 12:16:06 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:52158) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Nserk-0005wc-7G for guile-user@gnu.org; Fri, 19 Mar 2010 12:16:04 -0400 Original-Received: (qmail invoked by alias); 19 Mar 2010 16:16:01 -0000 Original-Received: from 83-215-154-5.hage.dyn.salzburg-online.at (EHLO nathot.lan) [83.215.154.5] by mail.gmx.net (mp056) with SMTP; 19 Mar 2010 17:16:01 +0100 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX19XRA1b1FBXhDmCPM9G64eLCakBDBAQ3576nOLUL2 OSBBK1bZbMvLyy Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by nathot.lan (Postfix) with ESMTP id 85D453A6A1; Fri, 19 Mar 2010 17:16:00 +0100 (CET) Original-Received: from nathot.lan ([127.0.0.1]) by localhost (nathot.lan [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iDVscVJq9TKS; Fri, 19 Mar 2010 17:15:57 +0100 (CET) Original-Received: from delenn.lan (delenn.lan [192.168.3.11]) by nathot.lan (Postfix) with ESMTP id 749643A695; Fri, 19 Mar 2010 17:15:57 +0100 (CET) Original-Received: by delenn.lan (Postfix, from userid 1000) id 40E40752E0; Fri, 19 Mar 2010 17:15:57 +0100 (CET) In-Reply-To: (Andy Wingo's message of "Fri, 19 Mar 2010 15:28:39 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.64000000000000001 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7681 Archived-At: Andy Wingo writes: > Hi, > > On Fri 19 Mar 2010 09:57, Josef Wolf writes: > >> (show-expansion (defstruct tree height girth age leaf-shape leaf-color)) > > (macroexpand '(defstruct ...)) > > You might want to surround that with (pretty-print ...) from (ice-9 > pretty-print). > >> Of course this is possible. After all, code is data and data is code. > > Sorta. Syntax-rules/syntax-case macros operate on syntax objects, not on > raw s-expressions. This allows them to preserve referential > transparency. So the result of expansion might not look like what you > would expect. > > Read up on syntax-rules and syntax-case macros, when you get some time. > I used to love defmacros but I don't use them any more. > defmacros are bound to bite you in the proverbial ass real hard when you combine them with modules, so it's best to avoid them like the plague. At least that's my experience, FWIW. Regards, Rotty -- Andreas Rottmann --