[plt-scheme] modules, macros, and #%mred-kernel

From: Aleks Bromfield (abromfie at cs.brown.edu)
Date: Fri Sep 1 18:40:35 EDT 2006

I am trying to define the following macro:

    (define-syntax (define/ocaml stx)
    (syntax-case stx ()
      [(_ (name args ...) body ...)
       (syntax
        (define name
          (lambda (tab args ...)
            (let* ([defs (send tab get-defs)]
                   [ints (send tab get-ints)]
                   [frame (send tab get-frame)]
                   [process-obj (send tab get-debug-process)]
                   [proc (process-proc process-obj)]
                   [in (process-in process-obj)]
                   [out (process-out process-obj)]
                   [err (process-err process-obj)])
               body ...))))]))

As far as I can tell, it works; that is, when I type it into the
toplevel and then type (define/ocaml (test a b c) (send defs insert
"hello")), it only says that "tab" is not a valid object (which it
isn't). But when I put the same macro into a module, provide it, and
require the module from a different one, the same test case fails
because "defs" is not defined.

It seems like I need to put (require-for-syntax my-module) at the top
of the module using this syntax. But doing that gives me the following
error:

dynamic-require: unknown module: #%mred-kernel

Does anyone know what I should do about this?

~ Aleks


Posted on the users mailing list.