[r6rs-discuss] Import choices: flexibility vs. discoverability
John Cowan
cowan at ccil.org
Tue Oct 13 21:24:16 EDT 2009
Shiro Kawai scripsit:
> I don't understand. My application can work with and without
> Good-Module, but wants to use it if available.
> Somewhere in my app I need to say (import Good-Module) in
> order to use existing Scheme module Good-Module, right?
I'm doing a bad job of explaining. The idea is not that there are
Good-Module and Fallback-Module, but that there is a single module with
good and fallback implementations, and you use expand-time conditionals
to decide which you can use. The idea is that an application needs
whatever Scheme API it needs, but it can choose which implementation of
that API to use based on external circumstances.
Here's another example: A Posix module exports some list of identifiers.
There might be three implementations: one for actual Posix systems, one
for Windows systems with some of the function stubbed out, and one for
embedded systems with everything stubbed out. There's only a single module
file, but based on the presence or absence of "on-posix" and "on-windows"
cond-expand flags, it can decide which implementation to incorporate
using INCLUDE.
Note that "on-posix" doesn't mean there is a Posix module loaded, but that
(according to the implementation) the OS is a Posix one. Cond-expand
flags *include* the modules that have been loaded, but aren't limited
to just those: they can contain all sorts of implementation-specific or
semi-standard flags as well.
--
Mos Eisley spaceport. You will never John Cowan
see a more wretched hive of scum and cowan at ccil.org
villainy --unless you watch the http://www.ccil.org/~cowan
Jerry Springer Show. --georgettesworld.com
More information about the r6rs-discuss
mailing list