unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Julian Graham <joolean@gmail.com>
Cc: Guile Users <guile-user@gnu.org>, Neil Jerram <neil@ossau.uklinux.net>
Subject: Re: wrapping `define-syntax'
Date: Wed, 15 Apr 2009 13:41:01 +0200	[thread overview]
Message-ID: <m37i1m401e.fsf@pobox.com> (raw)
In-Reply-To: <2bc5f8210904130655m4275f847x59be764b652eebd0@mail.gmail.com> (Julian Graham's message of "Mon, 13 Apr 2009 09:55:28 -0400")

Hi Julian,

On Mon 13 Apr 2009 15:55, Julian Graham <joolean@gmail.com> writes:

> Well, in R6RS, the body of `define-syntax' forms is evaluated in a
> higher "phase" -- meaning that there are additional bindings visible
> while it's being evaluated.

The final paragraph of 7.2 seems to imply that these additional bindings
may also be present for the runtime phase, which would obviate the need
for the temporary modules.

> [H]aving the modules containing the phased bindings in the uses list
> will make them visible in the closures used by syncase -- which, with
> Andy's syncase hygiene changes in place, will lead to the
> module-relative `@' forms being produced in the expansion.

This means you have to give names to those intermediate modules, because
syncase's output has to be serializable. It doesn't seem like named
temporary modules are a good idea.

Why not import the bindings needed at expansion time, evaluate keyword
definitions, then import other bindings needed at runtime, then evaluate
variable definitions and expressions? No temporary modules would be
necessary.

>> Hmm.  I don't really have much idea... but given that define-syntax is
>> syntax, does (define-syntax canonical-define-syntax define-syntax)
>> work any better?
>
> Nope: ERROR: invalid syntax define-syntax

I believe this is the correct incantation, but that our version of
psyntax punts on the issue. I think that it tries to expand the
right-hand side normally, but `define-syntax' as a bare keyword is
invalid syntax. (It could be an identifier syntax, after all.)

I don't know if syntax-case has a particular idiom for this (renaming an
existing macro at the toplevel, not lexically), or if we should hack in
a special case.

Cheers,

Andy
-- 
http://wingolog.org/




  reply	other threads:[~2009-04-15 11:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-12 22:55 wrapping `define-syntax' Julian Graham
2009-04-13  9:35 ` Neil Jerram
2009-04-13 13:39   ` Julian Graham
2009-04-13 13:55   ` Julian Graham
2009-04-15 11:41     ` Andy Wingo [this message]
2009-04-18 20:52       ` Julian Graham
2009-04-15 11:25 ` Andy Wingo
2009-04-17  3:42   ` Julian Graham

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=m37i1m401e.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-user@gnu.org \
    --cc=joolean@gmail.com \
    --cc=neil@ossau.uklinux.net \
    /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).