This is a proposal for factoring small Scheme into feature groups.
I am publishing this document to invite wide comment. There is nothing
official about it. However, I retain sole responsibility for it,
including all errors.
The charter for small Scheme allows for a great deal of optionality in
the small Scheme language. In particular, the charter says:
Features of the language should be marked as optional if their
implementation is likely to be burdensome for some target uses
(for example, floating point arithmetic, file I/O, "load",
"eval", and read/eval/print loops may not make sense for small
or embedded systems).
In addition, there is a great deal of non-obvious optionality specified
in R5RS. For example, there are several procedures that need not
exist if the implementation only supports real numbers. What follows
is a first cut at factoring R5RS plus my proposals from earlier posts
(now found in living-document form at http://tinyurl.com/thing-one )
into a core plus 14 feature groups.
The intention is that the names of the feature groups can be used in the
cond-expand syntax of SRFI-0, which I have included in my basic proposal.
That way, a portable program can detect the absence of a feature group
it depends on and either work around the problem or report failure,
as the case may be.
It is important to note that feature groups are orthogonal to modules.
If a feature group is present, its identifiers are bound in the base
module just like all the core features. Doing otherwise would just be
extra bookkeeping for programmers and bureaucracy for standardizers.
There are 182 core features which are not enumerated here.
For a complete list of features, including their presence in
the IEEE, R4RS, R5RS-requird, and R5RS-complete standards, see
http://tinyurl.com/feature-groups . The column "Report order" represents
the order of elements in the R5RS, with my proposed additions inserted
in roughly appropriate places.
The following 15 feature groups control the binding of the following
52 identifiers:
The "bignums" feature group provides unlimited-size exact integers.
No identifiers are bound by this feature group, but the results of
certain procedures are changed.
The "ratios" feature group provides unlimited-size exact integers.
No identifiers are bound by this feature group, but the results of
certain procedures are changed.
The "flonums" feature group provides bounded inexact rational numbers,
and binds the 10 identifiers exp, log, sin, cos, tan, asin, acos, atan,
sqrt, expt.
The "ieee-float" feature group provides IEEE flonums. It does not bind
any identifiers, but activates certain features of various numerical
procedures, and provides the lexical syntaxes +inf.0, -inf.0, and +nan.0
for non-rational IEEE numbers.
The "complex-numbers" feature group provides non-real complex numbers,
and binds the 6 identifiers angle, imag-part, magnitude, make-polar,
make-rectangular, real-part.
The "delay" feature group binds the 4 identifiers delay, lazy, force,
eager.
The "eval" feature group binds the 3 identifiers eval, null-environment,
scheme-report-environment. The identifier load is also bound if the
files feature group is present.
The "repl" feature group implies the presence of a REPL, and binds the
1 identifier interaction-environment. It cannot be available if the
"eval" feature group is not.
The "multiple-values" feature group provides multiple value returns,
and binds the 5 identifiers call-with-values, let-values, let*-values,
receive, values.
The "files" feature group provides access to an external file system, and
binds the 8 identifiers call-with-input-file, call-with-output-file,
delete-file, file-exists?, open-input-file, open-output-file,
with-input-from-file, with-output-to-file. The identifier load is also
bound if the eval feature group is present.
The "reader" feature group binds the 2 identifiers read, case-folding.
The "writer" feature group binds the 2 identifiers display, write.
The "binary" feature group provides simple byte-level I/O, and binds the
5 identifiers peek-u8, port-u8-position, read-u8, set-port-u8-position!,
write-u8. It cannot be available if the "files" feature group is not.
The "environment" feature group provides access to an external
environment, and binds the 4 identifiers environment-variable,
environment-variables, command-line, and quit.
The "transcripts" feature group binds the 2 identifiers transcript-on,
transcript-off.
I am proposing the removal of 3 R5RS procedures from small Scheme.
The char-ready? procedure does not exist in IEEE Scheme and
doesn't, in general, do what users will expect. The string-set! and
string-fill! procedures I believe should be removed in order to make
small Scheme strings immutable. I will defend this in a separate message,
noting here only that string-fill! is not in IEEE Scheme.
--
John Cowan [email protected] http://www.ccil.org/~cowan
Is it not written, "That which is written, is written"?
_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss