[gambit-list] Strange side effect after redefinition of apply

Sascha Ziemann ceving at gmail.com
Tue Jan 17 05:39:31 EST 2012


I got a strange side effect with my silex apply hack. I was able to
simplify it down to this test case where I define the two macros apply
and token.

The file a.scm works:

$ cat a.scm
(define gambit-apply apply)
(define-syntax apply
  (syntax-rules (string-append)
    ((_ string-append list)
     (append-strings list))
    ((_ func list)
     (gambit-apply func list))))

(display (gambit-apply string-append (list "a")))
(newline)

$ gsi -:s a.scm
a

The file b.scm works also:

$ cat b.scm
(define-syntax token
  (syntax-rules ()
    ((_ name value)
     (cons name value))
    ((_ name)
     (cons name '()))))

(define (b)
  (token "b"))

(display (car (b)))
(newline)

$ gsi -:s b.scm
b

But when I concatenate the two files I get an error:

$ cat a.scm b.scm > c.scm
$ gsi -:s c.scm
*** ERROR IN #<procedure #2>, "c.scm"@7.7 -- Unbound variable: gambit-apply

How could gambit-apply get lost?



More information about the Gambit-list mailing list