<srfi minus 97 at srfi dot schemers dot org>
. See
instructions here to subscribe to
the list. You can access previous messages via
the archive of the mailing list.
Over the past ten years, numerous libraries have been specified via the Scheme Requests for Implementation process. Yet until the recent ratification of the Revised6 Report on the Algorithmic Language Scheme, there has been no standardized way of distributing or relying upon library code. Now that such a library system exists, there is a real need to organize these existing SRFI libraries so that they can be portably referenced.
This SRFI is designed to facilitate the writing and distribution of code that relies on SRFI libraries. It identifies a subset of existing SRFIs that specify features amenable to provision (and possibly implementation) as libraries (SRFI Libraries) and proposes a naming convention for this subset so that these libraries may be referred to by name or by number.
(rnrs base)
by exporting the same
bindings as (rnrs base)
, but with the altered semantics.
Combining several such SRFIs would not work as intended, but it may be
a sensible alternative to omission. On the other hand, this might be
seen as a perversion of the original author's intent that these
semantics really be the semantics of the standard bindings.#!<identifier>
lexemes. Should this SRFI incorporate those SRFIs that are excluded
for extending the lexical syntax and define the appropriate
#!srfi-N
lexeme?(bytevector?
b)
imply (blob? b)
and vice versa?With the advent of R6RS, it has become possible to write and distribute portable Scheme code as libraries. However, there is no agreed upon way to refer to SRFI libraries, leaving implementors to create their own conventions thus thwarting portability of code which relies on SRFIs. So there is an immediate and obvious need for standardized SRFI library names.
The naming convention proposed in this document enjoys the following properties:
This specification includes a list of library names for existing SRFIs that specify libraries. These names are assigned according to a naming convention given below.
Although R6RS's notion of a library is the one used here, this SRFI attempts to minimize assumptions made about a Scheme systems conformance to R6RS so that systems may support SRFI Libraries without necessarily supporting all of R6RS.
The purpose of this SRFI is to name SRFI libraries in a consistent and uniform manner, both in the case of existing SRFIs and in the case of SRFIs yet to be written.
A SRFI library reference consists of two required components:
srfi
,:n
.Discussion: Several current Scheme
implementations supporting SRFIs use names consisting of
srfi
and the relevant SRFI number. For example, Larceny,
PLT Scheme, Scheme 48 all do. Use of these components also has
precedents in SRFIs 0 and 7.
Discussion: Since this SRFI is
only concerned with the naming of SRFI libraries, the
srfi
prefix is included to clearly distinguish it as a
SRFI reference, and the number component is included to disambiguate
among SRFIs, while allowing for simple naming without clashes or
authorities. During the discussion period, it was made clear some
would prefer libraries not be distinguished as SRFIs and that names be
strictly mnemonic. Such a requirement broadens the scope of this
proposal from a convention for SRFI libraries to the more general case
of Scheme libraries and poses a much more difficult problem to solve.
Instead, the particular problem is solved in such a way as to
hopefully not interfere with future more general naming
conventions.
Additionally, a SRFI library reference consists of one or more optional mnemonic components following the naming convention described below.
A SRFI library reference has the following form,
(srfi :<uinteger 10> <identifier> ...)
,
where <identifier>
is one of the included
SRFI library names defined below, and <uinteger
10>
is one of the included SRFI numerals given below.
The non-terminals <uinteger 10>
and
<identifier>
are defined as given in R6RS Chapter
4, Lexical syntax.
Discussion: The ":" prefix is used in order to make the SRFI number component an identifier, as required by R6RS. Several Scheme implementors expressed the importance of R6RS conformance and supported the colon prefix as a reasonable, if somewhat arbitrary, way to render the number as an identifier.
A SRFI Library can be referenced by number, as in
(srfi :1)
,
or equivalently using the library's name, as in
(srfi :1 lists)
.
Discussion: Even though the latter uses a library name, the SRFI number must still be supplied. This is done to ensure fairness and uniqueness—a SRFI should not be able to prevent other SRFIs from using the same name, but at the same time, SRFI library references should remain unambiguous.
Discussion: Since the number-only naming scheme ensures both uniqueness and fairness, the named-library scheme is redundant, but it is included to make library imports more readable. Although the same could be achieved via a comment, comments are not checked. The named-library scheme can thus be used to increase the likelihood that the correct library is imported.
The remaining identifier subforms are used to name sublibraries
within a SRFI Library. For example, SRFI 41, Streams, defines
primitive
and derived
libraries within the
streams
library. These can be referenced as
(srfi :41 streams primitive)
,
(srfi :41 streams derived)
.
Mnemonic library names are chosen according to the following
conventions: Libraries that define datatypes are typically pluralized
(e.g., arrays
, basic-string-ports
).
Libraries that provide new expression forms are named by the name of
their new form (e.g., let-values
, rec
,
and-let*
). Libraries that define a single procedure (or
that have a primary procedure) are given the name of the procedure
(e.g., error
, cat
). Libraries that provide
a large API of syntaxes and values are named in a descriptive manner
derived from their title (e.g., lightweight-testing
,
real-time-multithreading
). This naming convention is
consistent with the names chosen in the R6RS Standard
Libraries.
Discussion: There is opportunity
for grouping related SRFIs together. For example, SRFI 28, Basic
Format Strings, and SRFI 48, Intermediate Format Strings, could be
grouped into a common format
library with
simple
and intermediate
components. This
has been avoided, preferring instead to follow a one SRFI, one
(top-level) library convention. Although within a single SRFI,
several sub-libraries can be defined, thus achieving grouping. This
simplifies the naming convention and prevents the need for a naming
authority which decides what shall and shall not be grouped together.
Instead, grouping must be achieved by the SRFI process, as it should.
The criterion for inclusion in the set of SRFI Libraries is that the finalized SRFI only specify a set of bindings which can be provided as a library. SRFI Libraries need not be implementable as an R6RS library, but they must specify an interface which could be used as if it were. This means, for example, that lexical syntax extensions cannot be a part of a SRFI Library. SRFIs that specify global semantic changes to Scheme also cannot be SRFI Libraries. For example, a Lazy Scheme SRFI or a SRFI that fixed order of evaluation in procedure application could not be a SRFI Library because these features cannot be provided as a set of bindings.
Some SRFIs specify alternative semantics to standard Scheme
bindings. In some cases, such as SRFI 5's let
, it's
clear that making the alternative binding for let
available as a library binding is desirable. Authors that wish to
use SRFI 5's let
, rather than R6RS's let
,
simply import the SRFI 5 binding and exclude the R6RS binding for
let
(or rename to avoid the clash).
Other SRFIs, however, define alternative bindings that are intended
to be used throughout a Scheme system. For example, SRFI 63's
equal?
and most of SRFI 70, Numbers, are defined like this.
But if the author intends for these bindings to replace the
standard bindings, then there is no way of making this feature
available as a library, so the SRFI cannot be a SRFI Library.
The approach taken in this SRFI is that a SRFI is excluded as a
SRFI Library if it explicitly states the binding is to replace the
standard one. For example, SRFI 70, Numbers, is excluded because it
explicitly revises the text of R5RS, thus intending to make
a global semantic change to the language which cannot be provided as a
library. On the other hand, SRFI 63, Homogeneous and Heterogeneous
Arrays, is included and provides a binding for equal?
because the SRFI 63 document does not explicitly state this should
replace the standard equal?
binding.
The following SRFI library names are defined:
SRFI | Library names | Title |
1 | lists | List Library |
2 | and-let* | AND-LET*: an AND with local bindings, a guarded LET* special form |
5 | let | A compatible let form with signatures and rest arguments |
6 | basic-string-ports | Basic String Ports |
8 | receive | receive : Binding to multiple values |
9 | records | Defining Record Types |
11 | let-values | Syntax for receiving multiple values |
13 | strings | String Libraries |
14 | char-sets | Character-Set Library |
16 | case-lambda | Syntax for procedures of variable arity |
17 | generalized-set! | Generalized set! |
18 | multithreading | Multithreading support |
19 | time | Time Data Types and Procedures |
21 | real-time-multithreading | Real-time multithreading support |
23 | error | Error reporting mechanism |
25 | multi-dimensional-arrays | Multi-dimensional Array Primitives |
26 | cut | Notation for Specializing Parameters without Currying |
27 | random-bits | Sources of Random Bits |
28 | basic-format-strings | Basic Format Strings |
29 | localization | Localization |
31 | rec | A special form for recursive evaluation |
38 | with-shared-structure | External Representation for Data With Shared Structure |
39 | parameters | Parameter objects |
41 | streams, streams primitive, streams derived | Streams |
42 | eager-comprehensions | Eager Comprehensions |
43 | vectors | Vector Library |
44 | collections | Collections |
45 | lazy | Primitives for expressing iterative lazy algorithms |
46 | syntax-rules | Basic Syntax-rules Extensions |
47 | arrays | Array |
48 | intermediate-format-strings | Intermediate Format Strings |
51 | rest-values | Handling rest list |
54 | cat | Formatting |
57 | records | Records |
59 | vicinities | Vicinity |
60 | integer-bits | Integers as Bits |
61 | cond | A more general cond clause |
63 | arrays | Homogeneous and Heterogeneous Arrays |
64 | testing | A Scheme API for test suites |
66 | octet-vectors | Octet Vectors |
67 | compare-procedures | Compare Procedures |
69 | basic-hash-tables | Basic hash tables |
71 | let | LET -syntax for multiple values |
74 | blobs | Octet-Addressed Binary Blocks |
78 | lightweight-testing | Lightweight testing |
86 | mu-and-nu | MU and NU simulating VALUES & CALL-WITH-VALUES, and their related LET-syntax |
87 | case | => in case clauses |
95 | sorting-and-merging | Sorting and Merging |
SRFIs are not libraries, they are requests for features. Thus, several SRFIs specify features which cannot be provided as a library and those SRFIs are intentionally omitted here. For example, SRFIs which specify extensions to concrete syntax or extensions to the semantics of top-level programs cannot be provided as libraries and are therefore omitted from this SRFI. The following table lists omitted (finalized) SRFIs and the reason for their omission.
SRFI | Title | Reason for omission |
0 | Feature-based conditional expansion construct | Modifies semantics of top-level programs. |
4 | Homogeneous numeric vector datatypes | Modifies lexical syntax. |
7 | Feature-based program configuration language | Defines a configuration language distinct from Scheme. |
10 | #, external form | Modifies lexical syntax. |
22 | Running Scheme Scripts on Unix | Does not specify a library. |
30 | Nested Multi-line Comments | Modifies lexical syntax (subsumed by R6RS). |
34 | Exception Handling for Programs | Subsumed by R6RS. |
36 | I/O Conditions | Subsumed by R6RS. |
37 | args-fold: a program argument processor | Does not specify a library. |
40 | A Library of Streams | Deprecated by SRFI 41, Streams. |
49 | Indentation-sensitive syntax | Modifies lexical syntax. |
55 | require-extension | Modifies semantics of top-level programs. |
58 | Array Notation | Modifies lexical syntax. |
62 | S-expression comments | Modifies lexical syntax (subsumed by R6RS). |
70 | Numbers | Modifies standard semantics for number system. |
72 | Hygienic macros | Modifies macro expansion semantics. |
88 | Keyword objects | Modifies lexical syntax. |
89 | Optional positional and named parameters | Modifies syntax and semantics of application, which cannot be provided by a library. Dependent on lexical syntax modification (SRFI 88). |
90 | Extensible hash table constructor | Dependent on lexical syntax modification (SRFI 88). |
94 | Type-Restricted Numerical Functions | Dependent on number system modification (SRFI 70). |
This section addresses any issues relevant to each existing SRFI's use and implementation in an R6RS Scheme system.
SRFI 42, Eager Comprehensions, defines qualifiers, which
are used as macro keyword literals, and some of these conflict with
names provided by (rnrs base)
. This SRFI does not
specify whether these qualifier names are provided as bindings.
Discussion: It is not clear whether these keywords should or should not be provided as bindings by this library based on the original text of the SRFI. And if provided as bindings, it remains unclear to which values they should be bound. During the discussion period, no clear agreement could be made on what should be specified. Therefore the issue is simply left to resolution in a later SRFI devoted to eager comprehensions in R6RS-compatible Schemes.
The relation between SRFI 9, Defining Record Types and
R6RS Records is left unspecified. For example, it is not
specified whether record?
holds of SRFI 9 record values,
or whether SRFI 9 records are opaque, or if the type name is bound to
a rtd.
Discussion: It is not clear what the proper relationship should be and no clear consesus came about as a result of the discussion period.
Authors of future SRFIs that specify libraries may choose names as they please, but they are encouraged to use library names following the naming convention of this SRFI. If names are chosen that are not compatible with the referencing scheme given here, authors should specify alternative names that can be used to refer to the library consistent with this specification.
SRFI 41, Streams, for example, specifies that its libraries are
named by (streams)
, (streams primitive)
, and
(streams derived)
, but according to this SRFI, they must
also be named with the prefix (srfi :41 *)
.
Both SRFI 0, Feature-based conditional expansion construct, and
SRFI 7, Feature-based program configuration language, use feature
identifiers of the form srfi-N
, with the expectation
"that features will eventually be assigned meaningful names (aliases)
by the SRFI editors to make reading and writing code less tedious than
when using srfi-N
feature identifiers."
It is recommended that implementations which support SRFIs 0 or 7 use the SRFI names defined here as aliases. SRFI feature identifiers are constructed by
-
",:n
" as "n
".For example, the feature identifier for SRFI 1,
List Library, is srfi-1
, or equivalently,
srfi-1-lists
. Feature identifiers for sub-libraries are
constructed in the same way, so for example the feature identifier for
the streams primitive library is
srfi-41-streams-primitive
.
For discussions, I thank Will Clinger, Aziz Ghuloum, Dave Herman, Olin Shivers, Andre van Tonder, and my fellow SRFI editors. I also thank all those who participated during the draft period of this SRFI.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. REMEMBER, THERE IS NO SCHEME UNDERGROUND. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.