[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] library syntax: "visiting" a library left undefined?

Aaron W. Hsu scripsit:

> 1) Evaluation of the library forms, but not the arbitrary code bodies of
> those forms, giving you information on the imports and exports of the
> library, and gives a specific code body for the following steps, based
> on the results of cond-expand;

Thanks, this is very helpful.  IIUC, I would say "examination" rather than
"evaluation" here, as cond-expanding is not really evaluation.

> 2) Visitation, which gives you definitions of the keywords in the
> library, but does not evaluate any of the code. This is akin in some
> systems to expansion; and finally,
> 3) Instantiation, which evaluates the code definitions and binds their
> exports, as well as evaluating the forms in the body that are found.

Okay.  I have changed the wording again to this:

    Similarly, during the expansion of a library {\cf foo}, if a syntax
    keyword imported from another library {\cf (bar)} is needed to
    expand the library, then the syntax definitions of {\cf (bar)}
    must be loaded and expanded before the expansion of {\cf (foo)}.

Does that sound right?

> Thus, one cannot separate out, in the general case, the expansion of a
> library body from a single keyword export. Thus, the real guarantee here
> is that the body of the library is expanded and all keyword definitions
> evaluated during visitation, before the keyword is used in the importing
> library. This is an important distinction semantically, as it
> fundamentally alters the observable behavior of importing and using a
> library keyword export.

Yes, I follow that.

> I hope that clarifies things. 

I think it does.

While I have your attention on phasing:  Am I right to say that given the
R6RS (as opposed to Racket) rule that an identifier cannot be defined
differently at different phases, that the correct implicit phase can
always be deduced, and that therefore the machinery of explicit phasing
is not actually required?  Or do you think that's a fallacy?
(Or am I misstating what R6RS allows?)

John Cowan  http://ccil.org/~cowan    cowan@x
There are books that are at once excellent and boring.  Those that at
once leap to the mind are Thoreau's Walden, Emerson's Essays, George
Eliot's Adam Bede, and Landor's Dialogues.  --Somerset Maugham

Scheme-reports mailing list