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

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jul 26 00:01:08 EDT 2006

At Tue, 25 Jul 2006 19:23:47 -0700 (PDT), Danny Yoo wrote:
> I think 
> what's going on is that REQUIRE is trying to use the whole syntax object 
> to introduce the identifiers non-hygienically, but that's not working out 
> because the syntax object here:
> >     [(_ (all-except mod id ...))
> >      #`(require (all-except mod id ...))]
> has a different color than the input stx, since that syntax object is 
> freshly created by the macro. 

Not the whole `require' form, but the `all-except' part. So, this
works, too:

  (module m2 mzscheme
    (define-syntax (my-require stx)
      (syntax-case stx (all-except)
        [(_ (all-except mod id ...))
                #'(all-except mod id ...))))]
        [(_ mod)  ;; require entire module
         #'(require mod)]))
    (my-require (all-except m1 foo))
    (display bar))

See also 12.3.5 in the current MzScheme manual:


Since the names bound by the `require' are not explicitly mentioned in
the `require' form, it's not clear to me where the context should
originate. Maybe it would be better to always use the module name
instead of the clause as a whole, but I'm not sure.


Posted on the users mailing list.