Email list hosting service & mailing list manager

indirect-export in macro Andre van Tonder (01 Dec 2005 16:45 UTC)
Re: indirect-export in macro Matthew Flatt (01 Dec 2005 16:49 UTC)

indirect-export in macro Andre van Tonder 01 Dec 2005 16:45 UTC

I have a question regarding what exactly it is that is being exported.
It might be helpful to pin down the semantics of this more carefully,
although this might be dependent on the pending issue of the macro
system.

The document says:

"A indirect-export form, in contrast, can appear in a macro expansion."

Since identifiers introduced by an expansion are distinct
(in the sense of bound-identifier=?) from library-toplevel
identifiers, would the following work?

  (library "let-div" "scheme://r6rs"
    (define-syntax make-export
       (syntax-rules ()
         ((_)
          (indirect-export (quotient+remainder)))))

    (make-export)
    (define (quotient+remainder n d) ....)

or would I have to say instead:

  (library "let-div" "scheme://r6rs"
    (define-syntax make-export
      (lambda (exp)
       (syntax-case exp ()
         ((k)
          (with-syntax ((source-quotient+remainder
                          (datum->syntax-object (syntax k)
                                                'quotient+remainder)))
            (syntax
              (indirect-export (source-quotient+remainder)))))

    (make-export)
    (define (quotient+remainder n d) ....)

Regards
Andre