Re: indirect-export in macro
Matthew Flatt 01 Dec 2005 17:00 UTC
At Thu, 1 Dec 2005 11:56:15 -0500 (EST), Andre van Tonder wrote:
>
> > At Thu, 1 Dec 2005 11:45:19 -0500 (EST), Andre van Tonder wrote:
> > > 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) ....)
> >
> > Yes, because the `make-export' expansion doesn't introduce a binding of
> > `quotient+remainder'; it merely refers to a binding of
> > `quotient+remainder' (as well as `indirect-export').
> >
> > In other words, the relevant predicate is not `bound-identifier=?' but
> > `free-identifier=?'. [In PLT Scheme, it's `module-identifier=?', but I
> > expect this predicate to be renamed `free-identifier=?' in the future.]
>
> Ah thanks, but I just realized that the example does not conform to the
> BNF specification of the library syntax in the document. So the
> example should not even be possible. Is this correct?
Oh, that's right. You need
(indirect-export (M quotient+remainder))
for some locally defined macro M. (Or am I missing something else, too?)
Matthew