From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: Re: Enhancement to the syntax system? Date: Mon, 2 Jul 2012 22:43:10 +0200 Message-ID: References: <877gumufmq.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8f234cbf8cd51e04c3ded892 X-Trace: dough.gmane.org 1341261800 27440 80.91.229.3 (2 Jul 2012 20:43:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 Jul 2012 20:43:20 +0000 (UTC) Cc: guile-devel@gnu.org To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jul 02 22:43:19 2012 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 1SlnSo-0005kt-R1 for guile-devel@m.gmane.org; Mon, 02 Jul 2012 22:43:19 +0200 Original-Received: from localhost ([::1]:53009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlnSn-0001Cw-RB for guile-devel@m.gmane.org; Mon, 02 Jul 2012 16:43:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlnSk-0001C2-Oo for guile-devel@gnu.org; Mon, 02 Jul 2012 16:43:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SlnSi-0003qr-Rl for guile-devel@gnu.org; Mon, 02 Jul 2012 16:43:14 -0400 Original-Received: from mail-yw0-f51.google.com ([209.85.213.51]:55090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlnSi-0003qI-Ky; Mon, 02 Jul 2012 16:43:12 -0400 Original-Received: by yhnn12 with SMTP id n12so5544889yhn.38 for ; Mon, 02 Jul 2012 13:43:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ldzrfrgXzJwRq2e15LmcVEnPsrg1bzK6aOG80aIISxQ=; b=f9DXyeTAvRnEYwol4DZlV7ucxTOa1v0Tm9hCKOx+3QvqQ2oZFmq1G1qEfZYywl8Lrz cWoyYwENyfT82MgYa/1lzJypm2n9O6oP76kodBKj+/MzPSB/8aKubi3O0rRm1EZdSmyd jB/UtOBcaS0tkXg7ru1BLVgqGBklW0NYFcUhhNsFCg+HQ5+Vlg2Hvzmv6oggcIhktwpg YefCOhsvbHiXMnXibE9NQTMBvX0MdcNOYMEdglY0NcsjkubzBzQHv1tqNfhSP7PLNVli 7oMXCUy0Trel8+sOLDPlXU32YpvJXxFYbXaxNktF2qb102qLt7gjvdP0HMMCut5hRjA8 D1dg== Original-Received: by 10.50.104.228 with SMTP id gh4mr6384632igb.71.1341261790106; Mon, 02 Jul 2012 13:43:10 -0700 (PDT) Original-Received: by 10.50.41.196 with HTTP; Mon, 2 Jul 2012 13:43:10 -0700 (PDT) In-Reply-To: <877gumufmq.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.51 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:14689 Archived-At: --e89a8f234cbf8cd51e04c3ded892 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Maybe this help to see what I'm after, #'(let ((x v)) #.(f #'x)) <=3D> (let-syntax ((g (lambda (stx) (syntax-case stx ((_ x) (f #'x))))) #'(let ((x v)) (g x)) Now I would like to have a corresponding #.@ notation as well but can't find an analog for that :-( /Stefan On Mon, Jul 2, 2012 at 9:28 PM, Ludovic Court=E8s wrote: > Hi Stefan, > > Stefan Israelsson Tampe skribis: > > > Hygiene is harder to maintain. e.g. I kept on hitting this kind of cod= e > > snippets > > > > #'(let ((x v)) > > #,(f rest #'x)) > > > > The problem with this code is hygiene, I need to make a gensym and use > > with-syntax to bound x to that gensym in order to be safe > > at the macro expansion. > > What do you mean? Here =91x=92 leads to a newly introduced binding. > > Likewise, the code below doesn=92t introduce bindings non-hygienic > bindings, and is non-ambiguous: > > (macroexpand '(let-syntax ((f (lambda (s) > (syntax-case s () > ((_ x y) > #`(let ((p x)) > (+ p #,(identity #'y)))))))) > (f 1 2))) > > =3D> # p p-28239) (const 2)))> > > Thanks, > Ludo=92. > > > --e89a8f234cbf8cd51e04c3ded892 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Maybe this help to see what I'm after,

#'(let ((x v)) #.(f #= 'x))

<=3D>

(let-syntax ((g (lambda (stx) (syntax-ca= se=A0 stx ((_ x) (f #'x)))))
=A0=A0 #'(let ((x v)) (g x))

Now I would like to have a corresponding #.@ notation as well but can't= find an analog
for that :-(

/Stefan

On Mon, Jul 2, 2012 at 9:28 PM, Ludovic Court=E8s &= lt;ludo@gnu.org> wrote:
Hi Stefan,

Stefan Israelsson Tampe <stef= an.itampe@gmail.com> skribis:

> Hygiene is harder to maintain. e.g. =A0I kept on hitting this kind of = code
> snippets
>
> #'(let ((x v))
> =A0 =A0 #,(f rest #'x))
>
> The problem with this code is hygiene, I need to make a gensym and use=
> with-syntax to bound x to that gensym in order to be safe
> at the macro expansion.

What do you mean? =A0Here =91x=92 leads to a newly introduced binding= .

Likewise, the code below doesn=92t introduce bindings non-hygienic
bindings, and is non-ambiguous:

=A0 (macroexpand '(let-syntax ((f (lambda (s)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (syntax= -case s ()
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((_= x y)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= #`(let ((p x))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0(+ p #,(identity #'y))))))))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (f 1 2)))

=A0 =3D> #<tree-il (let (p) (p-28239) ((const 1)) (apply (toplevel +)= (lexical p p-28239) (const 2)))>

Thanks,
Ludo=92.



--e89a8f234cbf8cd51e04c3ded892--