[R6RS] Flonum operators and modules
Marc Feeley
feeley
Thu May 19 10:37:33 EDT 2005
It was suggested at the Snowbird meeting that it might be interesting
to add flonum specific operators such as fl+, fl<, etc to Scheme (where
all arguments and numeric results are inexact reals). I assume this is
still on the table and will be discussed at the Boston meeting. I'm
favourable to this idea in principle but I believe these operations
should be put in a library module named "fl". Moreover, there should
be a "fully qualified" notation of the form
module.ident (or module:ident, or module#ident it doesn't matter
to me)
that combines the operations of locally using the named module,
importing ident from that module, and accessing ident. This would lead
to code like
(define (ffib x)
(if (fl.< x 2.0)
1.0
(fl.+ (ffib (fl.- x 1.0)) (ffib (fl.- x 2.0)))))
Note that the module.ident notation can be easily implemented through a
global environment, so there is very little to add to existing
implementations of Scheme. There would be some changes needed to the
module system so that an identifier of the form module.ident is treated
specially. A definition of an exported variable "bar" in module "foo"
would translate to a definition of the global variable "foo.bar". If
"bar" is not exported then a unique name could be generated, or a
special name like "foo..bar" would be used. The advantages are that it
simplifies integration of the module system in existing implementations
of Scheme and it simplifies the debugging process because the debugger
can use fully qualified names to name procedures/variables in a module
and it allows the user, when in the debugger, to easily access or call
procedures in a specific module (at least the exported ones, but
possibly the non exported ones if the "foo..bar" notation is used by
the module system). It does mean that a program cannot contain more
than one (top-level?) module of a given name (Kent: is this
one-top-level-module-of-a-given-name constraint part of your module
proposal?).
Marc
More information about the R6RS
mailing list