unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* bindings for free identifiers in (ice-9 syncase)
@ 2009-03-19 15:16 Julian Graham
  2009-03-19 16:32 ` Andreas Rottmann
  2009-03-21 12:04 ` Andy Wingo
  0 siblings, 2 replies; 7+ messages in thread
From: Julian Graham @ 2009-03-19 15:16 UTC (permalink / raw)
  To: guile-user

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?


Regards,
Julian




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-25  0:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19 15:16 bindings for free identifiers in (ice-9 syncase) Julian Graham
2009-03-19 16:32 ` Andreas Rottmann
2009-03-19 18:22   ` Julian Graham
2009-03-19 20:28     ` Neil Jerram
2009-03-19 19:53   ` Neil Jerram
2009-03-21 12:04 ` Andy Wingo
2009-03-25  0:42   ` Neil Jerram

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).