From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31450 invoked by alias); 20 Aug 2009 17:44:06 -0000 Received: (qmail 31442 invoked by uid 22791); 20 Aug 2009 17:44:06 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_BOGUSMX X-Spam-Check-By: sourceware.org Received: from sebabeach.org (HELO sebabeach.org) (64.165.110.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Aug 2009 17:44:00 +0000 Received: from sspiff.sspiff.org (seba.sebabeach.org [10.8.159.10]) by sebabeach.org (Postfix) with ESMTP id E81376E3D0 for ; Thu, 20 Aug 2009 10:43:58 -0700 (PDT) Message-ID: <4A8D8B5E.8080404@sebabeach.org> Date: Thu, 20 Aug 2009 17:44:00 -0000 From: Doug Evans User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: cgen@sourceware.org Subject: Re: Opinions wanted: What should (.list pmacro-name 42) do? References: <4A8D8838.9090708@sebabeach.org> In-Reply-To: <4A8D8838.9090708@sebabeach.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00065.txt.bz2 Doug Evans wrote: > Hi. > > What should the output of > > (define-pmacro (foo a) (add a 1)) > (.list foo 42) > > be? > > Currently the result is ( 42) > where is the pmacro object for "foo". > > It's not ideal because it means that a pmacro object "escapes" > pmacro-processing and can be seen by, for example, rtl compilation. > > However, it's not that unexpected. The user asked for a list > containing two objects, the pmacro and 42. > This is akin to saying (list + 42) in Scheme. > > We *could* have the pmacro evaluator re-examine the result and if it > sees ( mumble) then re-expand it. That's what we do for > symbols today (i.e. if the result of pmacro-expansion is a symbol that > names a pmacro, we re-evaluate it), but that has problems, e.g. > http://sourceware.org/ml/cgen/2009-q3/msg00052.html > and I'm leaning toward removing that behavior. > > It's not clear to me what The Right Thing to do is. > Opinions? > [For completeness' sake ...] An alternative is of course to flag any pmacros that "escape" as errors. We need to do that anyway for cases like (.list 42 foo).