guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wrapping `define-syntax'


From: Andy Wingo
Subject: Re: wrapping `define-syntax'
Date: Wed, 15 Apr 2009 13:41:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi Julian,

On Mon 13 Apr 2009 15:55, Julian Graham <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]