unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Chris Vine <vine35792468@gmail.com>
To: guile-user@gnu.org
Subject: Re: problems with syntax-case and with-syntax
Date: Mon, 28 Aug 2017 12:38:32 +0100	[thread overview]
Message-ID: <20170828123832.57798634@bother.homenet> (raw)
In-Reply-To: <87lgm4il3u.fsf@netris.org>

On Sun, 27 Aug 2017 20:36:53 -0400
Mark H Weaver <mhw@netris.org> wrote:
> Matt Wette <matt.wette@gmail.com> writes:
> 
> > Q1) The code below creates two macros.  One called `define-foo'
> > which generates a new identifier and then defines that to #t.  The
> > other, `define-foo/p', generates the same identifier (lexical
> > issue?) and another identifier, then "calls" define-foo and then
> > uses both identifiers in a `define'.  When executed I get this
> > error:
> >
> > scheme@(guile-user)> (define-foo/p abc)
> > ;;; <stdin>:2:0: warning: possibly unbound variable `wrap-abc'
> > <unnamed port>:2:0: <unnamed port>:2:0: In procedure module-lookup:
> > Unbound variable: wrap-abc
> >
> > What am I doing wrong here?  
> 
> The problem is that in Guile 2.2, whenever (define <id> ...) is found
> in the expanded code, where <id> was introduced by a macro (i.e. not
> passed as an explicit argument to the macro), Guile will rewrite the
> <id> into a new name based on the hash of the entire definition form.
> 
> I don't know of any way to make this work without passing 'wrap-abc'
> explicitly as an argument to the 'define-foo' macro.
> 
> FWIW, I've always been opposed to these non-standard semantics, but
> they were included in Guile 2.2 over my strenuous objections:
> 
>   https://lists.gnu.org/archive/html/guile-devel/2014-01/msg00061.html
>   https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00021.html
>   https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00042.html

How interesting.

There seems very little uniformity in how the different schemes which I
happen to have available deal with the issue of top level hygiene with
nested macros.  Given the example in paragraph 6.10.10 of the guile-2.2
manual, after the definitions of both 'foo' and 'bar' have both been
made the following schemes evaluate '(foo)' as 37:

  guile-2.0, chicken;

and the following evaluate it as 42:

  guile-2.2, chez, kawa.

Chris



      parent reply	other threads:[~2017-08-28 11:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-27 20:18 problems with syntax-case and with-syntax Matt Wette
2017-08-28  0:36 ` Mark H Weaver
2017-08-28  1:35   ` Mark H Weaver
2017-09-18 13:16     ` Matt Wette
2017-09-20 12:50       ` Matt Wette
2017-08-28  3:48   ` Matt Wette
2017-08-28  3:50   ` Matt Wette
2017-08-28 11:38   ` Chris Vine [this message]

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=20170828123832.57798634@bother.homenet \
    --to=vine35792468@gmail.com \
    --cc=guile-user@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).