[R6RS] Modules, a second question

Richard Kelsey kelsey
Tue Sep 28 10:17:19 EDT 2004

   From: William D Clinger <will at ccs.neu.edu>
   Date: Tue, 28 Sep 2004 09:43:59 -0400

   > The bad consequence is that it will be hard for a compiler to deliver
   > applications that won't be linked against the whole r6rs runtime
   > system.  It is likely to be very hard to produce small Scheme
   > executables...

   I don't understand this argument.  To produce a small executable,
   you link in only the things that might be referenced (directly or
   indirectly) by the program.  That involves a static analysis of
   the program.  With the module system, the program is divided into
   modules, so the static analysis must be applied to modules.  So
   what?  It's the same problem.

Manuel's original question was whether (import foo) requires
evaluating foo's top-level forms even if nothing from foo is
referenced in the final program.  If the top-level forms have
to be evaluated no matter what then the static analysis gets
harder.  To drop foo's top-level forms from the image it isn't
enough to show that nothing from foo is referenced.  You also
have to show that foo's top-level forms have no observable side

Not having any module system has the same problem.  Manuel's
suggestion, a separate 'import' ('import-library', perhaps)
that has the 'evaluate only if referenced' semantics would
offer a work around.

More information about the R6RS mailing list