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: Tue, 3 Jul 2012 23:52:29 +0200 Message-ID: References: <877gumufmq.fsf@gnu.org> <87r4stss4d.fsf@gnu.org> <878vf0o7gs.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae934110149557b04c3f3ee35 X-Trace: dough.gmane.org 1341352362 32603 80.91.229.3 (3 Jul 2012 21:52:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 3 Jul 2012 21:52:42 +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 Tue Jul 03 23:52:41 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 1SmB1S-0004wX-6h for guile-devel@m.gmane.org; Tue, 03 Jul 2012 23:52:38 +0200 Original-Received: from localhost ([::1]:56705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmB1R-0006gw-01 for guile-devel@m.gmane.org; Tue, 03 Jul 2012 17:52:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmB1O-0006gc-0w for guile-devel@gnu.org; Tue, 03 Jul 2012 17:52:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SmB1M-0004KL-3r for guile-devel@gnu.org; Tue, 03 Jul 2012 17:52:33 -0400 Original-Received: from mail-yw0-f41.google.com ([209.85.213.41]:45046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmB1L-0004Jx-Re; Tue, 03 Jul 2012 17:52:32 -0400 Original-Received: by yhr47 with SMTP id 47so7802146yhr.0 for ; Tue, 03 Jul 2012 14:52:29 -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=HTHyuYnZF0s4RMrW8a+wlcfn5ZlAF5Kmnyd8UQmE6RY=; b=mHGWHQDquuKIp4iB3dkglL/Q4l9HHCj5hiHehbApzyBceK7G5D/5cRktLJj0lnNpZa sy1l3RS/exYv49c7a+ky3BDeZ9sC285t0jcTOl6pojCWRFIqg+XLjqs5QeIOU9YiWb+a Bu5sxKGm6mCnyAZ5R9PwP/JP+tE/uEWQF7a7DST9N8QlJ6ZWK1zAEPOyzlBNB37LUrxe oyu6nf4Y+bOiBHugBWE2QezJzZmnl06UDhg2PX0HDwJocImG0QkiRSD2WGFR1axDEQEH fMle/hL/XXI+ESnq3UdDZtwgbgEhBb2WOhiaSA2Fk0j668UFk0Sj59GGKiBnJtfywQs9 g/iA== Original-Received: by 10.50.217.199 with SMTP id pa7mr9696131igc.17.1341352349095; Tue, 03 Jul 2012 14:52:29 -0700 (PDT) Original-Received: by 10.50.41.196 with HTTP; Tue, 3 Jul 2012 14:52:29 -0700 (PDT) In-Reply-To: <878vf0o7gs.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.41 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:14702 Archived-At: --14dae934110149557b04c3f3ee35 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable You do not need gensyms if you try to mimic or implement my suggested #. . On the other hand when if you do this (define (f stx) #`(let ((x 1)) #,stx)) and use this with #`(let ((x 2)) #,(f #'x)) the resulting expanded code would produce 1 which is not what you want. So in the racket matcher I wrote I needed to do (with-syntax ((x (datum->syntax stx (gensym "x")))) #`(let ((x 2)) #,(f #'x)))))) Hope that this makes things clear! /Stefan On Tue, Jul 3, 2012 at 11:33 PM, Ludovic Court=E8s wrote: > Hey! > > Stefan Israelsson Tampe skribis: > > >> Stefan Israelsson Tampe skribis: > >> > >> > 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)) > > [...] > > > If you want to try another path using functions in stead of macros and > > working hard with #, and #,@ > > you will for complex macros like a matcher need to gensym by hand or > > destroy the readability of the > > code. As illustrated by the simple example above. > > Hmm, the example above does not use gensym. What am I missing? > > Ludo=92. > --14dae934110149557b04c3f3ee35 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable You do not need gensyms if you try to mimic or implement my suggested #. . = On the
other hand when if you do this

(define (f stx) #`(let ((x= 1)) #,stx))

and use this with

#`(let ((x 2)) #,(f #'x))<= br>
the resulting expanded code would produce 1 which is not what you want.=
So in the racket matcher I wrote I needed to do

(with-syntax ((x= (datum->syntax stx (gensym "x")))) #`(let ((x 2)) #,(f #'= x))))))

Hope that this makes things clear!

/Stefan

On Tue, Jul 3, 2012 at 11:33 PM, Ludovic Court=E8s <ludo@gnu.org= > wrote:
Hey!

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

>> Stefan Israelsson Tampe <stefan.itampe@gmail.com> skribis:
>>
>> > Maybe this help to see what I'm after,
>> >
>> > #'(let ((x v)) #.(f #'x))
>> >
>> > <=3D>
>> >
>> > (let-syntax ((g (lambda (stx) (syntax-case =A0stx ((_ x) (f #= 'x)))))
>> > =A0 =A0#'(let ((x v)) (g x))

[...]

> If you want to try another path using functions in stead of macros and=
> working hard with #, and #,@
> you will for complex macros like a matcher need to gensym by hand or > destroy the readability of the
> code. As illustrated by the simple example above.

Hmm, the example above does not use gensym. =A0What am I missing?

Ludo=92.

--14dae934110149557b04c3f3ee35--