[plt-scheme] mzscheme and R6RS macrology

From: Andreas Rottmann (a.rottmann at gmx.at)
Date: Thu Dec 25 10:01:49 EST 2008

Hi!

I have trouble getting the following code to run under mzscheme (it
works fine on Ikarus):

;;$ cat mz-test/bar.sls
#!r6rs

(library (mz-test bar)
  (export bar-definer)
  (import (rnrs))
  
  (define (bar-definer alist)
    (lambda (stx)
      (syntax-case stx ()
        ((k name sym)
         (let ((val (cond ((assq (syntax->datum #'sym) alist)
                           => cdr)
                          (else
                           #f))))
           (with-syntax ((v val))
             #'(define name 'v))))))))
;;$ cat mz-test/foo.sls
#!r6rs

(library (mz-test foo)
  (export foo)
  (import (rnrs))
  
  (define (foo)
    '((a . 1) (b . 2))))
;;$ cat test.scm
#!r6rs

(import (rnrs)
        (for (mz-test bar) expand)
        (for (mz-test foo) expand))

(define-syntax def (bar-definer (foo)))

(def x b)

(display x)
(newline)

;;$ PLTCOLLECTS=":`pwd`" mzscheme -f test.scm
;;mz-test/bar.sls:16:16: compile: unbound identifier (and no #%top
;;syntax transformer is bound) in: define

Under Ikarus, the program sucessfully runs and prints "2", as intended.

Perhaps someone can shed some light on this?

Thanks, Rotty
-- 
Andreas Rottmann         | Rotty at ICQ      | 118634484 at ICQ | a.rottmann at gmx.at
http://rotty.uttx.net    | GnuPG Key: http://rotty.uttx.net/gpg.asc
Fingerprint              | C38A 39C5 16D7 B69F 33A3  6993 22C8 27F7 35A9 92E7
v2sw7MYChw5pr5OFma7u7Lw2m5g/l7Di6e6t5BSb7en6g3/5HZa2Xs6MSr1/2p7 hackerkey.com

Make free software, not war!


Posted on the users mailing list.