From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules Date: Thu, 09 Jan 2014 18:07:16 -0500 Message-ID: <87fvowwy8r.fsf@netris.org> References: <87bo0del31.fsf@netris.org> <871u0i8zvx.fsf@gnu.org> <8761puxmim.fsf@netris.org> <87ppo2w5zb.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389309012 2323 80.91.229.3 (9 Jan 2014 23:10:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jan 2014 23:10:12 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jan 10 00:10:18 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W1Ojx-0005go-MD for guile-devel@m.gmane.org; Fri, 10 Jan 2014 00:10:17 +0100 Original-Received: from localhost ([::1]:54597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1Ojx-0002as-8S for guile-devel@m.gmane.org; Thu, 09 Jan 2014 18:10:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1Ojo-0002Zd-0P for guile-devel@gnu.org; Thu, 09 Jan 2014 18:10:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1Oji-0001jF-N8 for guile-devel@gnu.org; Thu, 09 Jan 2014 18:10:07 -0500 Original-Received: from world.peace.net ([96.39.62.75]:42505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1Oji-0001cZ-63; Thu, 09 Jan 2014 18:10:02 -0500 Original-Received: from turntable.mit.edu ([18.160.0.29] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1W1OjM-0003RH-UN; Thu, 09 Jan 2014 18:09:42 -0500 In-Reply-To: <87ppo2w5zb.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 08 Jan 2014 21:53:12 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16795 Archived-At: ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Mark H Weaver skribis: > >> ludo@gnu.org (Ludovic Court=C3=A8s) writes: >> >>> Does something like this work: >>> >>> (define-syntax define-inline >>> (with-ellipsis --- >>> (syntax-rules () >>> ((_ (name parms ---) exp ---) >>> (define-syntax name >>> (syntax-rules () >>> ((_ args (--- ---)) >>> ((lambda (parms ---) exp ---) >>> args (--- ---))))))))) >> >> No, because as noted in the docs, the custom ellipsis does not propagate >> to the generated code. > > OK, right; it=E2=80=99d work with =E2=80=98with-ellipsis=E2=80=99 repeate= d after the inner > =E2=80=98define-syntax=E2=80=99 I suppose. Yes. > Actually my question was more about the ellipsis escaping form > (... ...). It is affected by =E2=80=98with-ellipsis=E2=80=99, right? Yes, so the following works: (define-syntax define-inline (with-ellipsis --- (syntax-rules () ((_ (name parms ---) exp ---) (define-syntax name (with-ellipsis (--- ---) (syntax-rules () ((_ args (--- ---)) ((lambda (parms ---) exp ---) args (--- ---)))))))))) Needless to say, the whole point of custom ellipses is to avoid having to ever escape ellipses, but you can still do it. >> Note that as currently implemented, the effect of 'with-ellipsis' >> also does not propagate into nested syntax definition forms such as >> 'let-syntax', 'letrec-syntax', and 'define-syntax'. We could go either >> way on this. > > Well, I think it=E2=80=99s fine this way, but then again I=E2=80=99ve bee= n living in > world without that feature. ;-) > > How does R7RS syntax-rules behave in that respect? I guess we should > just follow suit. In R7RS, custom ellipsis is not part of the lexical environment, and thus does not propagate at all. A custom ellipsis affects only the patterns and templates of the 'syntax-rules' macro it is passed to. I ended up making the effect of 'with-ellipsis' propagate into syntax definition forms, since the semantics seem simpler to me. I pushed this and the 'syntax-error' patch to stable-2.0. Thanks! Mark