[racket] macro help redux

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Tue Jun 8 17:43:54 EDT 2010

I feel like I'm getting there, but macros still do things that confuse me.

According to the Macro Stepper, I've written a macro that expands to:

(module fields racket
  (#%module-begin
   (require "tables.rkt")
   (require "../date-utils.rkt")
   (begin
     (define-struct
      date-field
      (contract)
      #:transparent)
     (define (create-date-field
              #:contract
              (contract db-date?))
       (make-date-field contract))
     (provide/contract
      (create-date-field
       (-> #:contract any/c date-field?))))))

At the next step of the expansion, I get the error:

expand: unbound identifier in module
db-date?

The only problem is that "../date-utils.rkt" provides db-date? and if
I put everything inside the #%module-begin into its own DrRacket
definitions window, it runs without error. For some reason, db-date?
isn't available when it's needed, but I can't figure out how to make
it available.

What am I doing wrong?

Todd


Posted on the users mailing list.