guile-user
[Top][All Lists]
Advanced

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

Re: bindings for free identifiers in (ice-9 syncase)


From: Andreas Rottmann
Subject: Re: bindings for free identifiers in (ice-9 syncase)
Date: Thu, 19 Mar 2009 17:32:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

Julian Graham <address@hidden> writes:

> Hi Guilers,
>
> Alright, I've been banging my head against this for several weeks now
> and only just had the time to sit down and research this: If you use a
> symbol in an `(ice-9 syncase)' macro definition that's bound in the
> lexical closure in which that definition lives, then that binding
> should be the one that gets used at transformation time.  At least,
> that's how I interpret the following bit of R5RS:
>
> "If a macro transformer inserts a free reference to an identifier, the
> reference refers to the binding that was visible where the transformer
> was specified, regardless of any local bindings that may surround the
> use of the macro."
>
> ...but that's not what Guile seems to do.  (I'm fiddling around in
> 1.9.0 HEAD, because the VM is awesome and because there are some
> already-committed syncase fixes that have been useful to me...)  If
> you create the following module:
>
> (define (foo-module)
>   #:use-module (ice-9 syncase)
>   #:export-syntax (foo-macro))
>
> (define (foo-function) (display "Hello, world!"))
>
> (define-syntax foo-macro
>   (lambda (stx)
>     (syntax-case stx ()
>       ((_) (syntax (foo-function))))))
>
> ...and then import `(foo-module)' into the REPL or somewhere else,
> evaluating `(foo-macro)' throws an error because `foo-function' can't
> be found.  What am I doing wrong?
>
Nothing, this is a deficiency in Guile:
https://savannah.gnu.org/bugs/?20941. I wonder why it is marked as
"invalid", though.

Regards, Rotty




reply via email to

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