unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: Marijn <hkBst@gentoo.org>
Cc: "Ludovic Courtès" <ludo@gnu.org>, guile-devel@gnu.org
Subject: Re: Enhancement to the syntax system?
Date: Wed, 4 Jul 2012 10:04:15 +0200	[thread overview]
Message-ID: <CAGua6m0vk6SpWot5VCD3AoUV0Jtp1hBj96kCbQu9F4WL8vH6Vg@mail.gmail.com> (raw)
In-Reply-To: <4FF3F4FB.4050007@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 1986 bytes --]

Funny,  for guile I get,
scheme@(guile-user)> (define (f x) #`(let ((x 1)) #,x))
scheme@(guile-user)> (define-syntax m (lambda (x) (syntax-case x () ((_)
#`(let ((x 2)) #,(f #'x))))))
scheme@(guile-user)> (m)
$1 = 1

I ported the racket matcher to guile and worked in that environment, so
this illustrate the problem.
In racket the same idea will error out as you say (I did not find anything
wrong with your example).
I do prefer the racket behavior of bailing out because it can help
detecting the bug in stead of silently
behave against the intention for newbies. My original code where this issue
comes from is located in
compat/racket/match/match.scm in the syntax-parse repo at

https://gitorious.org/guile-syntax-parse/guile-syntax-parse

This is the racket matcher implemented using syntax-parse!

These bugs should have been corrected though in that code!

/Stefan

On Wed, Jul 4, 2012 at 9:47 AM, Marijn <hkBst@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Stefan,
>
> On 03-07-12 23:52, Stefan Israelsson Tampe wrote:
> > 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.
>
> I tried it in Racket:
>
>
> (define-for-syntax (f stx) #`(let ((x 1)) #,stx))
>
> (define-syntax (m stx)
>   (syntax-case stx ()
>     ((_) #`(let ((x 2)) #,(f #'x))) ))
>
> (m)
>
>
> but I get error messages which I don't know what to do about. Do you
> have running examples of code not producing the result you want?
>
> Marijn
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.19 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk/z9PsACgkQp/VmCx0OL2xMNACbBJKq9nZJKTzCJbdnq0iPgJoE
> rSwAn2yJ1JTLMUn6v5ZR/PatxcGxgVrU
> =HFFX
> -----END PGP SIGNATURE-----
>

[-- Attachment #2: Type: text/html, Size: 2642 bytes --]

  reply	other threads:[~2012-07-04  8:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-30 15:22 Enhancement to the syntax system? Stefan Israelsson Tampe
2012-07-02 19:28 ` Ludovic Courtès
2012-07-02 20:43   ` Stefan Israelsson Tampe
2012-07-02 22:41     ` Ludovic Courtès
2012-07-03 14:37       ` Stefan Israelsson Tampe
2012-07-03 21:33         ` Ludovic Courtès
2012-07-03 21:52           ` Stefan Israelsson Tampe
2012-07-04  7:47             ` Marijn
2012-07-04  8:04               ` Stefan Israelsson Tampe [this message]
2012-07-09 15:52             ` Ludovic Courtès
2012-07-09 17:40               ` Stefan Israelsson Tampe
2012-07-10  8:24                 ` Ludovic Courtès
2012-07-10 13:35                   ` Stefan Israelsson Tampe
2012-07-10 14:34                     ` Marijn
2012-07-10 14:51                       ` [racket-dev] " Eli Barzilay
     [not found]                         ` <20476.16781.257276.194149-a5nvgYPMCZcx/1z6v04GWfZ8FUJU4vz8@public.gmane.org>
2012-07-10 15:03                           ` Matthew Flatt
2012-07-10 15:26                             ` [racket-dev] " Ludovic Courtès
2012-07-10 15:44                               ` Stefan Israelsson Tampe
2012-07-10 17:47                                 ` Stefan Israelsson Tampe
2012-07-10 16:48                             ` Eli Barzilay
2014-05-03 21:29                             ` Marijn Schouten (hkBst)
2012-07-10 15:44                           ` Ryan Culpepper
2012-07-10 15:22                     ` Ludovic Courtès
2012-07-10  7:36               ` Stefan Israelsson Tampe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGua6m0vk6SpWot5VCD3AoUV0Jtp1hBj96kCbQu9F4WL8vH6Vg@mail.gmail.com \
    --to=stefan.itampe@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=hkBst@gentoo.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).