[R6RS] modules

Richard Kelsey kelsey
Wed Aug 25 11:27:31 EDT 2004


   From: William D Clinger <will at ccs.neu.edu>
   Date: Fri, 20 Aug 2004 17:40:23 -0400

   In my first post, I should have pointed out the interaction between
   these two issues:

     * Are module exports settable by the exporting module and/or importing
       module? (I prefer that modules be used to control scope, not mutation
       policy, so I would say that variables are settable.  one can always
       export accessors/setters for hidden exports to obtain finer control.)

     * Must one declare "implicit" exports, i.e., local identifiers,
       references to which may be contained in the expanded output of an
       exported macro?  (I prefer yes, since this improves security and
       gives the implementation a chance to treat the remaining variables
       more efficiently.)

   My views on these two issues are, in decreasing order of preference:

       1.  no and yes

Now that I have thought about this a bit more, this is my preference
as well, with caveat that I would prefer that the declarations of
"implicit" exports be done automatically for uses of SYNTAX-RULES.
When there is ambiguity about what references a macro might introduce,
as there can be with other kinds of macro definitions, then any needed
declaration should be part of the macro definition, not part of any
module declaration.  I think that this makes it easier to keep the
declarations correct, as well as allowing them to be done automatically
for sufficiently simple macro definitions, such as those using
SYNTAX-RULES.

As to whether "implicit" exports are themselves settable, I am a bit
torn.  My main reason for wanting explicit exports to be immutable is
so that readers of a module's code can determine which of its bindings
are possibly set.  This doesn't apply to "implicit" exports, because
the macros that produce the SET! are in the same module as the
variable being SET!.  Automatic analysis is another matter, and for
that it would be helpful if "implicit" exports were not settable.

                                            -Richard


More information about the R6RS mailing list