[R6RS] Re: modules

Richard Kelsey kelsey
Tue Aug 31 08:03:00 EDT 2004

   Date: Tue, 31 Aug 2004 01:07:26 -0500 (EST)
   From: "R. Kent Dybvig" <dyb at cs.indiana.edu>

   The (eval `(lambda () (foo ,v))) was
   just a simple abstraction of the issue of what happens if a program
   constructs and evaluates a module and the constructed module contains a
   pointer to a large data structure, nested within a syntax-rules template.

That wasn't clear to me.  One of the difficulties with this
discussion is that everyone has their own set of extensions
that need to be accommodated.  Your example pointed out a
problem with implicit exports in the presence of the following

 - static analyses that care about what is exported,
   implicitly or explicitly
 - an EVAL that accepts whole modules
 - the right-hand sides of a syntax-rules are examined
   lazily (meaning that nothing is looked at until it
   is known not to be a quoted value)

Which is all fine, but it isn't what everone will do.
For comparison, Scheme 48 has the EVAL, because modules are
created using expressions, but not the other two.  To support
linking executable images Scheme 48 does scan the right-hand
sides of syntax-rules to find the implicit exports and has a
mechanism for declaring the implicit exports of other syntax
definitions.  We could disable the syntax-rules scanning when
not creating an executable image, but it has never mattered
enough to bother.

It doesn't seem reasonable for people who don't care about the
efficiency/safety/whatever gains of some static analyses, or who
are using implementations that don't do such analyses, to have
to add what are, for them, pointless declarations.  There are
lots of ways code can be tweaked to run faster in particular
implementations; an optional declaration for implicit exports
will just be one more of them.  Adding an optional way to
declare the type of an expression or variable might be even
more beneficial.

Requiring declarations for implicit exports is likely to create
portability problems.  Implementations that don't care about
them are likely to ignore them entirely and not report errors.
Code created in such an implementation will likely break when
used elsewhere.

More information about the R6RS mailing list