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, 10 Jul 2012 15:35:27 +0200 Message-ID: References: <877gumufmq.fsf@gnu.org> <87r4stss4d.fsf@gnu.org> <878vf0o7gs.fsf@gnu.org> <87pq85dj8o.fsf@gnu.org> <87sjd058ia.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae9340d8ba600aa04c479cd8a X-Trace: dough.gmane.org 1341927365 17089 80.91.229.3 (10 Jul 2012 13:36:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 10 Jul 2012 13:36:05 +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 10 15:36:00 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 1SoabY-0001uV-0A for guile-devel@m.gmane.org; Tue, 10 Jul 2012 15:35:52 +0200 Original-Received: from localhost ([::1]:60152 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoabX-0004HO-18 for guile-devel@m.gmane.org; Tue, 10 Jul 2012 09:35:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoabL-0003q7-9P for guile-devel@gnu.org; Tue, 10 Jul 2012 09:35:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoabC-0006Wd-5F for guile-devel@gnu.org; Tue, 10 Jul 2012 09:35:38 -0400 Original-Received: from mail-gh0-f169.google.com ([209.85.160.169]:34237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoabB-0006VT-SG; Tue, 10 Jul 2012 09:35:30 -0400 Original-Received: by ghrr18 with SMTP id r18so13014910ghr.0 for ; Tue, 10 Jul 2012 06:35:27 -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=4q+4b6uYQfNp1zX3G6NKJAlMwZkD89Sjr+O4oCwLRbM=; b=ob0sKREFQlI/GKHc5yxTyKCB5F3mtkfob7ZUqv3zflicCFNk8EN1zLkwnGGzX4ur1e 1CiRJput9ZIhW/wN2llVZDRFNbFxgIEfX4sTdkI22cklphweKvC1FUog2wn3u5UFbwgo sSOzzQaliVhOAGMOqMXOCq0Djav2ZXG43SgftMhkiKRuG0ldGwnj0aEYhASq4wRLZozH ++sOcxHXMJX6mBe7sGINS6wNXS1gzPO7jWJKFmNo0HPZesDphkQp+5o4NLXCdstNnjjU 7BKv9cqNqv2ArjcTjFB5A7yxdWezCj4/TZldSKLRAE761g06/MsIS1T7VDvSliti/wlk O6OQ== Original-Received: by 10.50.185.163 with SMTP id fd3mr11529123igc.22.1341927327137; Tue, 10 Jul 2012 06:35:27 -0700 (PDT) Original-Received: by 10.50.41.196 with HTTP; Tue, 10 Jul 2012 06:35:27 -0700 (PDT) In-Reply-To: <87sjd058ia.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.169 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:14726 Archived-At: --14dae9340d8ba600aa04c479cd8a Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I did miss something when trying in racket, it's a psyntax bug! Look! racket: (define-for-syntax (f x) #`(let ((x 1)) #,x)) > (define-syntax (g x) (syntax-case x ()((_ y) #`(let ((x y)) #,(f #'x)))) ) > (g 4) 4 In guile, scheme@(guile-user)> (define (f x) #`(let ((x 1)) #,x)) scheme@(guile-user)> (define-syntax g (lambda (x) (syntax-case x () ((_ y) #`(let ((x y)) #,(f #'x)))))) scheme@(guile-user)> (g 4) $1 =3D 1 ! I much prefer rackets version here. I will file a bug report and also try to understand what spec that racket is following! On Tue, Jul 10, 2012 at 10:24 AM, Ludovic Court=E8s wrote: > Hi! > > Stefan Israelsson Tampe skribis: > > > | It=92s true that it=92s annoying that the wrong binding is silently u= sed. > > | Do you think it=92s common enough to justify new syntax? > > > > Yes this highlights a comon problem when implementing racket match with > #`. > > Sure, but it=92s not good-style. ;-) In general, =91syntax-case=92 is g= reat, > but it=92s low-level plumbing to be used with care, compared to > =91syntax-rules=92. > > > I do think > > that the best solution is to somehow extend the syntax expander to mimi= c > my > > sugested > > #. and #.@. The simple solution is to rewrite according to > > > > #`(... #.((x y) (f #'x #'y))) > > > > -> > > > > #`(let-syntax ((g (lambda (x) (syntax-case x () ((_ x y) (f #'x #'y))))= )) > > (... (g x y)) > > Unlike syntax-{quote,unquote,...}, #. has no non-syntax-prefixed > equivalent. And what it does is non-trivial. So I don=92t feel > comfortable with this extension, FWIW. > > [...] > > > I also feel that the issue needs to be > > liffted up to the > > community of at least syntax-case user crowd before doing anything Ill > try > > to spur > > some discussions on it and come back later! > > Yes, this should be discussed on c.l.s or scheme-reports. > > Thanks, > Ludo=92. > --14dae9340d8ba600aa04c479cd8a Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I did miss something when trying in racket, it's a psyntax bug!

= Look!

racket:
(define-for-syntax (f x) #`(let ((x 1)) #,x))
&g= t; (define-syntax (g x) (syntax-case x ()((_ y) #`(let ((x y)) #,(f #'x= ))))
)
> (g 4)
4

In guile,
scheme@(guile-user)> (define (f= x) #`(let ((x 1)) #,x))
scheme@(guile-user)> (define-syntax g (lambd= a (x) (syntax-case x () ((_ y) #`(let ((x y)) #,(f #'x))))))
scheme@= (guile-user)> (g 4)
$1 =3D 1
!

I much prefer rackets version here. I will file a bug = report and also try to understand what spec that racket is following!

On Tue, Jul 10, 2012 at 10:24 AM, Ludovic = Court=E8s <ludo@gnu.org> wrote:
Hi!

Stefan Israelsson Tampe <stefan.itampe@gmail.com> skribis:

> | It=92s true that it=92s annoying that the wrong binding i= s silently used.
> | Do you think it=92s common enough to justify new syntax?
>
> Yes this highlights a comon problem when implementing racket match wit= h #`.

Sure, but it=92s not good-style. =A0;-) =A0In general, =91syntax-case= =92 is great,
but it=92s low-level plumbing to be used with care, compared to
=91syntax-rules=92.

> I do think
> that the best solution is to somehow extend the syntax expander to mim= ic my
> sugested
> #. and #.@. The simple solution is to rewrite according to
>
> #`(... #.((x y) (f #'x #'y)))
>
> ->
>
> #`(let-syntax ((g (lambda (x) (syntax-case x () ((_ x y) (f #'x #&= #39;y))))))
> =A0 =A0 =A0 (... (g x y))

Unlike syntax-{quote,unquote,...}, #. has no non-syntax-prefixed
equivalent. =A0And what it does is non-trivial. =A0So I don=92t feel
comfortable with this extension, FWIW.

[...]

> I also feel that the issue needs to be
> liffted up to the
> community of at least syntax-case user crowd before doing anything Ill= try
> to spur
> some discussions on it and come back later!

Yes, this should be discussed on c.l.s or scheme-reports.

Thanks,
Ludo=92.

--14dae9340d8ba600aa04c479cd8a--