From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules Date: Wed, 08 Jan 2014 21:53:12 +0100 Message-ID: <87ppo2w5zb.fsf@gnu.org> References: <87bo0del31.fsf@netris.org> <871u0i8zvx.fsf@gnu.org> <8761puxmim.fsf@netris.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 1389214415 32519 80.91.229.3 (8 Jan 2014 20:53:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jan 2014 20:53:35 +0000 (UTC) Cc: guile-devel@gnu.org To: Mark H Weaver Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jan 08 21:53:41 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 1W1085-0004y9-A1 for guile-devel@m.gmane.org; Wed, 08 Jan 2014 21:53:33 +0100 Original-Received: from localhost ([::1]:48904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1084-00029h-W2 for guile-devel@m.gmane.org; Wed, 08 Jan 2014 15:53:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W107t-00029N-U6 for guile-devel@gnu.org; Wed, 08 Jan 2014 15:53:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W107o-00031j-FJ for guile-devel@gnu.org; Wed, 08 Jan 2014 15:53:21 -0500 Original-Received: from hera.aquilenet.fr ([141.255.128.1]:41475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W107o-00031F-1r for guile-devel@gnu.org; Wed, 08 Jan 2014 15:53:16 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id AB3931AC5; Wed, 8 Jan 2014 21:53:13 +0100 (CET) Original-Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OfxZzSH0F4Ne; Wed, 8 Jan 2014 21:53:13 +0100 (CET) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 4B8E116D4; Wed, 8 Jan 2014 21:53:13 +0100 (CET) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 =?utf-8?Q?Niv=C3=B4se?= an 222 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <8761puxmim.fsf@netris.org> (Mark H. Weaver's message of "Wed, 08 Jan 2014 15:10:41 -0500") User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 141.255.128.1 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:16792 Archived-At: Mark H Weaver skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Mark H Weaver skribis: >> >>> In the end, here's how this works: 'with-ellipsis' binds a special >>> identifier named #{ $sc-ellipsis }# using a new 'ellipsis' binding type. >>> The new ellipsis identifier is stored within the binding. In order to >>> determine whether an identifier X is an ellipsis, the binding for >>> #{ $sc-ellipsis }# is looked up in the lexical environment of X. If the >>> binding is found and has binding-type 'ellipsis', then X is compared to >>> the identifier stored in the binding using 'bound-id=3D?'. Otherwise, X >>> is compared to '...' using 'free-id=3D?' as was done before. >> >> This looks nice! Thanks for providing the detailed reasoning, that=E2= =80=99s >> insightful. >> >> 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 repeated = after the inner =E2=80=98define-syntax=E2=80=99 I suppose. Actually my question was more about the ellipsis escaping form (... ...). It is affected by =E2=80=98with-ellipsis=E2=80=99, right? (It = may be a obvious question, but I=E2=80=99m not familiar with the implementation.) [...] > It is important that the custom ellipsis does not propagate to the > generated code, so that we can use 'with-ellipsis' to implement R7RS > 'syntax-rules', which allows a custom ellipsis as its first operand, > before the literals list. In R7RS 'syntax-rules', the custom ellipsis > does not propagate to generated code. Yes, that make sense. > 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 been = living in world without that feature. ;-) How does R7RS syntax-rules behave in that respect? I guess we should just follow suit. >> Could you wrap lines to 80 columns in psyntax.scm? > > Ordinarily I try to keep lines to 80 columns, but psyntax.scm already > has a great deal of code that violates that rule. Fixing that would be > a rather large commit, and I'm not sure it would be an improvement. OK (I do find it hard to read long lines, FWIW.) Thanks! Ludo=E2=80=99.