[racket-dev] processing the internal-context of a mod?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Apr 27 22:28:33 EDT 2013

Sorry for the delay!...

At Thu, 25 Apr 2013 16:35:40 -0600, Danny Yoo wrote:
> > I'm trying to understand the case analysis so that I can properly
> > generate the code to construct the namespace.  The documentation says
> > I have four things to keep track of for internal-context:
> >
> >     case 1: #f: it's empty
> >     case 2: #t: it's all the requires
> >     case 3: stx: it's the lexical context of the wrapped syntax object
> >     case 4: (vectorof stx): ???
> >
> > Case 2 seems fairly straightforward to me: to construct the namespace
> > for a module, I take all the symbols defined in its prefix, and
> > combine that with all the exports of all the required modules.
> 
> Followup:
> 
> I have yet to synthesize a case other than case 2 or 3, so I have to
> admit I still don't understand.

I don't think case 1 can happen anymore.

To provoke the badly documented case 4, create a submodule via
`module*':

 #lang racket/base
 (module* m #f)

The vector corresponds to the layers of modules --- inside out, so
bindings from earlier elements of the vector can "shadow" bindings from
later elements.

> In my own experiments, if the internal context is a syntax object,
> then it's an object whose datum is #f, and whose wraps consist only of
> module-rename wraps.  Am I guaranteed that the syntax objects
> associated to the module's internal context only consist of
> module-rename wraps?

Yes.


Posted on the dev mailing list.