This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Quick syncase/syntax-rules question.


Rob Browning <rlb@cs.utexas.edu> writes:

> So after some more experimentation, it looks like define-syntax
> doesn't do recursive expansions on the template replacements at all.
> Is that "correct"?  If so, it seems to substantially limit the
> usefulness of define-syntax/syntax-case.
> 
> (foobar) from the top level will fail with a module defined like this:
> 
>   (define-module (some module))
>   (use-modules (ice-9 syncase))
> 
>   (defmacro baz () 42)
> 
>   (define-syntax foobar
>     (syntax-rules ()
>       ((foobar) (baz))))
> 
>   (export-syntax foobar)

[I assume that you have done (use-modules (some module)) at toplevel.]

(foobar) fails because it expands to (baz) which doesn't have a
binding at toplevel.  If you export baz from (some module), it will
work.

This is of course a serious bug in the macro/module system: The baz
binding should not be looked up in the toplevel module but in the
lexical scope of foobar = (some module).

It will be possible to address this problem once Jost Boekemeier's
environment patches has been applied.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]