[r6rs-discuss] [Formal] local imports

From: Abdulaziz Ghuloum <aghuloum>
Date: Thu Nov 16 00:14:46 2006

---
This message is a formal comment which was submitted to formal-comment_at_r6rs.org, following the requirements described at: http://www.r6rs.org/process.html
---
[Resent: please discard the previous one with incorrect headers]
Name        : Abdulaziz Ghuloum
Email       : aghuloum at cs.indiana.edu
Type        : enhancement
Priority    : minor
Component   : libraries
Version     : 5.91
One sentence summary: A local import form, similar in syntax to
libraries' import form, should be added to the set of valid R6RS
definitions.
Description:
The syntax of R6RS libraries contains a single library-global import
form.  One import form forces programmers to dump all imported
identifiers into one flat environment that is visible throughout the
library.  While some libraries (such as the r6rs library itself) are
typically used in every expression in the library, some libraries
are only used in small local regions of the library.  Using a single
global import form for a library, it is impossible to express the
region of code that depends on an imported library.  A library writer
may import libraries to fulfill a specific purpose within the body
of the library.  In the cycle of development, other libraries may be
chosen to fulfill the same purpose, or the dependence on the
original library is no longer required.  If the library imports tens of
such helper libraries, then isolating their extent may become a
refactoring nightmare.  A local import form supports an elegant solution
to the problem by allowing libraries to be imported only where they are
needed.
When I program in C, I usually add the required #include lines as
they are needed to make the compiler happy.  I am personally guilty
of almost never removing an #include line, even if it's no longer
needed.  I really wish not to do the same in my Scheme libraries.
Recommendation:
A local import form, with syntax identical to the library-level import
form, should be added to the set of valid definitions.  An import form
makes the bindings of the exporting libraries visible in the body where
the import form appears.
Received on Wed Nov 15 2006 - 21:20:04 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC