From: Mark H Weaver <mhw@netris.org>
To: marco.maggi-ipsu@poste.it
Cc: 16158@debbugs.gnu.org
Subject: bug#16158: psyntax: bug in bound-identifier=?
Date: Mon, 16 Dec 2013 11:38:55 -0500 [thread overview]
Message-ID: <87y53keoo0.fsf@netris.org> (raw)
In-Reply-To: <87d2kxfd69.fsf@governatore.luna> (Marco Maggi's message of "Mon, 16 Dec 2013 08:49:34 +0100")
Hi,
Marco Maggi <marco.maggi-ipsu@poste.it> writes:
> Mark H Weaver wrote:
>> While reading psyntax.scm, I noticed that the definition of 'bound-id=?'
>> does not match the definition in "Syntax Abstraction in Scheme" by
>> Dybvig, Hieb, and Bruggeman.
>>
>> The paper states "Two identifiers that are bound-identifier=? are also
>> free-identifier=?".
>
> I think you are referring to this paragraph from the paper[1] (page 12):
>
> Two identifiers that are bound-identifier=? are also
> free-identifier=?, but two identifiers that are free-identifier=?
> may not be bound-identifier=?. An identifier introduced by a macro
> transformer may refer to the same enclosing binding as an identifier
> not introduced by the transformer, but an introduced binding for one
> will not capture references to the other.
Yes.
>> The following expression shows that this is not the case in Guile 2.0:
>>
>> (let* ((x 1) (s1 #'x)
>> (x 2) (s2 #'x))
>> (list (bound-identifier=? s1 s2)
>> (free-identifier=? s1 s2)))
>> => (#t #f)
>
> The expander in Ikarus/Vicare also returns this value.
I think that indicates a bug in Ikarus/Vicare.
>> Racket reports (#f #f) for the same expression.
>
> Racket is different because its expander implements a variant of phase
> separation; if the whole form is evaluated at phase N, the "x" in "#'x"
> should be searched among the bindings at phase N-1 (if any)
I don't see how that's relevant to this example.
> Your code works, but when you actually try to use the
> identifiers for something:
>
> #!r6rs
> (import (rnrs))
> (define-syntax doit
> (lambda (stx)
> (let* ((x 1) (s1 #'x)
> (x 2) (s2 #'x))
> #`(let ((#,s1 123))
> #,s2))))
> (doit)
Whether #`(let ((#,s1 123)) #,s2) works is equivalent to asking whether
s1 and s2 are 'bound-identifier=?', by definition. That's precisely
what 'bound-identifier=?' is supposed to be used for: to determine
whether a binding for one should capture the other.
I don't see why you think #`(let ((#,s1 123)) #,s2) should work. Why
would you use two identifiers with different binding names (s1 and s2)
to construct that code? Can you construct a more realistic example?
Thanks,
Mark
next prev parent reply other threads:[~2013-12-16 16:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-16 0:04 bug#16158: psyntax: bug in bound-identifier=? Mark H Weaver
2013-12-16 0:11 ` Mark H Weaver
2013-12-16 7:49 ` Marco Maggi
2013-12-16 16:38 ` Mark H Weaver [this message]
2013-12-17 4:03 ` Mark H Weaver
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=87y53keoo0.fsf@netris.org \
--to=mhw@netris.org \
--cc=16158@debbugs.gnu.org \
--cc=marco.maggi-ipsu@poste.it \
/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).