[plt-scheme] undefined identifiers after generating (require (all-except)) statement

From: Kimberley Burchett (kim.burchett at gmail.com)
Date: Tue Jul 25 21:01:31 EDT 2006

I'm have a macro that generates (require (all-except)) statements, but
they don't seem to actually import any identifiers.  That is, I get
"unbound variable in module" errors when referencing identifiers that
should have been imported.  Here's a simple test case:

;; define two variables, foo and bar
(module m1 mzscheme
  (provide (all-defined))
  (define foo 3)
  (define bar 4))

;; import everything but foo (i.e. only import bar)
(module m2 mzscheme
  (define-syntax (my-require stx)
    (syntax-case stx (all-except)
      [(_ (all-except mod id ...))
       #`(require (all-except mod id ...))]
      [(_ mod)  ;; require entire module
       #`(require mod)]))
  (my-require (all-except m1 foo))
  (display bar))
(require m2)  ;; should print 4

The problem seems to be specific to all-except, since if I change the
example to use (my-require m1) instead, then 4 is printed as expected.

Any suggestions?

-- 
Kimberley Burchett
http://www.kimbly.com/


Posted on the users mailing list.