by WANG Zheng (ufo5260987423)
This SRFI is currently in draft status. Here is an explanation of each status that a SRFI can hold. To provide input on this SRFI, please send email to srfi-261@nospamsrfi.schemers.org
. To subscribe to the list, follow these instructions. You can access previous messages via the mailing list archive.
This SRFI proposal addresses systemic compatibility issues exposed by
the SRFI-97-defined library reference format
(srfi :<SRFI number> <identifier> ...)
and
advocates for two more modernized, portable and readable alternatives:
(srfi srfi-<SRFI number>)
and
(srfi <identifier>-<SRFI number>)
.
srfi-
prefix is
used in order to make the SRFI number component an identifier, as
required by R6RS.SRFI 97 minimized assumptions made about a Scheme system's
conformance to that systems may support SRFI Libraries without needing
to support all of the R6RS and R7RS library systems.
However, its SRFI library reference format
(srfi :<SRFI number> <identifiers> ...)
introduces portability and toolchain challenges due to the colon
:
character. This design stems from R6RS's prohibition
against unsigned integers as standalone library name components (e.g.,
(1 lists)
is invalid). This proposal advocates replacing
it with (srfi srfi-<SRFI number>)
and
(srfi <identifier>-<SRFI number>)
, resolving
three core issues:
C://
). Mapping
(srfi :1)
to paths like srfi/:1/
fails on
Windows and requires error-prone workarounds elsewhere. Hyphens
-
are universally valid, enabling predictable paths like
srfi/srfi-1/
.(srfi
1)
), while implementations like Larceny already phase out
colons for newer SRFIs. The srfi-
prefix retains
backward compatibility while harmonizing with R7RS
trends.:
is a reserved
character in URI syntax (RFC 3986), mandating percent-encoding (e.g.,
srfi%3A1), while the hyphen -
is an unreserved character
that requires no escaping, ensuring cleaner and more human-readable
URIs.Discussion: Should this proposal be a patch or replacement to SRFI 97?
This specification adopts the principle of minimal modifications, and it includes the following: a portable library-referencing scheme without changing the existing infrastructure for all past and future SRFI libraries, two reserved and restricted reference schemes to make SRFI 97 and R7RS convenient, an extended naming convention for selecting library names, and an enumeration of library names selected for all currently finalized SRFIs that specify libraries.
A SRFI library reference should at least have the form
(srfi srfi-<uinteger 10>)
,
where <uinteger 10>
is a SRFI number, defined as
a non-terminal given in R6RS Chapter 4, Lexical syntax.
Discussion: The
srfi-
prefix is used in order to make the SRFI number component an identifier, as required by R6RS.
A SRFI Library can be referenced by number, as in
(srfi srfi-1).
A SRFI library reference also should have the readable form
(srfi <identifier>-<uinteger 10>)
,
where <identifier>
is one of the included SRFI
library names defined below, and <uinteger 10>
is a
SRFI number. The non-terminals <uinteger 10>
and
<identifier>
are defined as given in R6RS Chapter
4, Lexical syntax.
A SRFI Library can be referenced equivalently using the library's name, as in
(srfi lists-1),
though which may be incompatibility with Windows's and Unix's filesystem.
Discussion: Restriction on portable set of characters may cause incompatible update to previous proposals. Further discussion is required.
Only for SRFI library references with SRFI number less than 261 could continually reserve the following SRFI 91's naming manner as equivalent reference forms,
(srfi :<uinteger 10> <identifier> ...),
in which the colon prefix :
plays the same role to make
SRFI number <uinteger 10>
an identifier, and other
non-terminals are defined as given in the portable references.
So that, a SRFI with number less than 261 can be referenced equivalently as in
(srfi :1),
or equivalently using the library's name, as in
(srfi :1 lists).
Mnemonic library names are chosen according to the SRFI 97's 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, in which *
, ?
and
many other characters are allowed. However, such characters are not
legal for the filesystem in Windows, Unixes, or URIs. All SRFI library
names may be uniformly named in
srfi-<uinteger 10>
format with additional proper
file-name extensions, and library locating affairs can be
reserved for various implementations.
Discussion: SRFI 103 proposed a standard for locating files containing libraries with list-of-symbols library names for Unixes and Windows, and above illegal library file names were suggested to be encoded. But it was finally withdrawn.
Since SRFI 97, SRFI's family has been largely extended, and this proposal continues to include SRFIs with criterion the same as SRFI 97.
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 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 |
22 | scripting |
Running Scheme scripts on Unix |
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 | basec-format-strings |
Basic Format Strings |
29 | localization |
Localization |
31 | rec |
A special form for recursive evaluation |
37 | args-fold |
Argument-fold: a program argument processor |
38 | with-shared-structure |
External Representation for Data with Shared Structure |
39 | parameters |
Parameters objects |
41 | streams |
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 |
Arrays |
48 | intermediate-format-strings |
Intermediate Format Strings |
51 | rest-values |
Handling rest list |
54 | cat |
Formatting |
57 | records |
Records |
59 | vicinities |
Vicinity |
60 | integers-bits |
Integers as Bits |
61 | cond |
A more general conditional form |
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 |
Extended 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 | sort-and-merging |
Sorting and Merging |
98 | os-environment-variables |
An interface to access environment variables |
99 | records |
ERR5RS Records |
100 | define-lambda-object |
define-lambda-object |
101 | random-access-lists |
Purely Functional Random-Access Pairs and Lists |
115 | regexp |
Scheme Regular Expressions |
117 | list-queues |
Queues based on lists |
125 | hashtables |
Intermediate hash tables |
126 | r6rs-hashtables |
R6RS-based hashtables |
127 | lazy-sequences |
Lazy Sequences |
128 | comparators |
Comparators (reduced) |
129 | titlecase |
Titlecase procedures |
130 | string-cursors |
Cursor-based string library |
131 | records |
ERR5RS Record Syntax (reduced) |
132 | sorting |
Sort Libraries |
133 | vectors |
Vector Library (R7RS-compatible) |
134 | deques |
Immutable Deques |
141 | integer-division |
Integer division |
143 | fixnums |
Fixnums |
145 | assume |
Assumptions |
151 | bitwise-operations |
Bitwise Operations |
152 | strings |
String Library (reduced) |
156 | predicate-combiners |
Syntactic combiners for binary predicates |
175 | ascii |
ASCII character library |
176 | version |
Version flag |
215 | logging |
Central Log Exchange |
219 | define |
Define higher-order lambda |
223 | bisect |
Generalized binary search procedures |
236 | independently |
Evaluating expressions in an unspecified order |
238 | codesets |
Codesets |
239 | list-case |
Desctucturing Lists |
241 | match |
Match - Simple pattern-matching Syntax to Express Catamorphisms on Scheme Data |
242 | cfg |
The CFG Language |
244 | define-values |
Multiple-value Definitions |
259 | tagged-procedures |
Tagged procedures with type safety |
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.
Discussion: The following table should be checked by our community together, because since SRFI 111, I have been writing reasons purely based on speculation. They actually are beyond my my technical skills and language proficiency.
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 for data |
Modifies lexical syntax. |
30 | Nested Multi-line Comments | Modifies lexical syntax (subsumed by R6RS) |
34 | Exception Handling for Programs | Subsumed by R6RS |
35 | Conditions | Subsumed by R6RS |
36 | I/O Conditions | Subsumed by R6RS |
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) |
96 | SLIB Prerequisites | A set of uniform interfaces to host the SLIB Scheme library system. |
97 | SRFI Libraries | A set of convention for library references. |
105 | Curly-infix expressions | Modifies semantics lexical syntax. |
106 | Basic socket interface | Dependent on Specific Scheme implementations. |
107 | XML reader syntax | Modifies semantics lexical syntax. |
108 | Named quasi-literal constructors | Modifies semantics lexical syntax. |
109 | Extended string quasi-literal | Modifies semantics lexical syntax. Dependent on lexical syntax modification (SRFI 107 and SRFI 108). |
110 | Sweet-expressions (t-expressions) | Modifies semantics lexical syntax. |
111 | Boxes | Dependent on different Scheme implementations. |
112 | Environment Inquiry | Dependent on different Scheme implementations. |
113 | Sets and Bags | Dependent on different Scheme implementations. |
116 | Immutable List Library | Dependent on different Scheme implementations. |
118 | Simple adjustable-size string | Dependent on string mechanism implementation. |
119 | wisp: simpler indentation-sensitive scheme | Modifies semantics lexical syntax. |
120 | Timer APIs | Dependent on time mechanism implementation. |
123 | Generic accessor and modifier operators | Dependent on time mechanism implementation. |
124 | Ephemerons | Dependent on specific GC implementations. |
134 | Immutable Deques | Dependent on different Scheme implementations. |
135 | Immutable Texts | Dependent on string mechanism modification. |
136 | Extensible record types | Dependent on record type implementations. |
137 | Minimal Unique Types | Dependent on specific Scheme implementations. |
138 | Compiling Scheme programs to executable | Dependent on specific Scheme implementations. |
139 | Syntax parameters | Modifies semantics lexical syntax. |
140 | Immutable Strings | Dependent on specific Scheme implementations. |
144 | Flonums | Dependent on number system implementation. |
146 | Mappings | Dependent on specific Scheme implementations. |
147 | Custom macro transformers | Modifies syntax-rules implementation. |
148 | Eager syntax-rules | Modifies syntax-rules implementation. |
149 | Basic Syntax-rules Template Extensions | Modifies syntax-rules implementation. |
150 | Hygienic ERR5RS Record Syntax (reduced) | Modifies syntax-rules implementation. |
153 | Ordered Sets | Dependent on specific Scheme implementations. |
160 | Homogeneous numeric vector libraries | Modifies lexical syntax. |
161 | Unifiable Boxes | Dependent on different Scheme implementations. |
162 | Comparators sublibrary | Extends SRFI 128. |
164 | Enhanced multi-dimensional Arrays | Extends SRFI 25. |
165 | The Environment Monad | I don't know. |
166 | Monadic Formatting | I don't know. |
167 | Ordered Key Value Store | Dependent on SRFI 146. |
168 | Ordered Tuple Store Database | Dependent on SRFI 146, SRFI 167. |
169 | Underscores in numbers | Modifies lexical syntax. |
170 | POSIX API | Dependent on different Scheme implementations. |
171 | Transducers | I don't know. |
172 | Two Safer Subsets of R7RS | I don't know. |
173 | Hooks | Dependent on specific Scheme implementation. |
174 | POSIX Timespecs | Dependent on different Scheme implementations. |
178 | Bitvector library | Modifies Lexical syntax. |
179 | Nonempty Intervals and Generalized Arrays (Updated) | Modifies array mechanism. |
180 | JSON | I don't know. |
181 | Custom ports (including transcoded ports) | Dependent on different Scheme implementation. |
185 | Linear adjustable-length strings | Dependent on string mechanism implementation. |
188 | Splicing binding constructs for syntactic keywords | Modifies let-syntax and
letrec-syntax . |
189 | Maybe and Either: optional container types | I don't know. |
190 | Coroutine Generators | Dependent on SRFI 139. |
192 | Port Positioning | Dependent on SRFI 181. |
193 | Command line | Dependent on different Scheme implementation. |
194 | Random data generators | Dependent on different Scheme implementation. |
195 | Multiple-value boxes | Extends SRFI 111. |
196 | Range Object | I don't know. |
197 | Pipeline Operators | I don't know. |
201 | Syntactic Extensions to the Core Scheme Bindings | I don't know. |
202 | Pattern-matching Variant of the and-let* Form that Supports Multiple Values | I don't know. |
203 | A Simple Picture Language in the Style of SICP | I don't know. |
206 | Auxiliary Syntax Keywords | I don't know. |
207 | String-notated bytevectors | Modifies lexical syntax. |
208 | NaN procedures | I don't know. |
209 | Enums and Enum Sets | I don't know. |
210 | Procedures and Syntax for Multiple Values | I don't know. |
211 | Scheme Macro Libraries | Has several distinct identifiers. |
212 | Aliases | I don't know. |
213 | Identifier Properties | Dependent on different Scheme implementation. |
214 | Flexvectors | Dependent on different Scheme implementation. |
216 | SICP Prerequisites (Portable) | I don't know. |
217 | Integer Sets | Dependent on different Scheme implementation. |
221 | Define higher-order lambda | I don't know. |
222 | Compound Objects | I don't know. |
224 | Integer Mappings | I don't know. |
225 | Dictionaries | I don't know. |
226 | Control Features | I don't know. |
227 | Optional Arguments | I don't know. |
228 | Composing Comparators | I don't know. |
229 | Tagged Procedures | I don't know. |
230 | Atomic Operations | Dependent on different Scheme implementation. |
231 | Intervals and Generalized Arrays | Dependent on different Scheme implementation. |
232 | Intervals and Generalized Arrays | I don't know. |
233 | INI files | I don't know. |
234 | Topological Sorting | I don't know. |
237 | Combinators | Has several distinct identifiers. |
240 | Reconciled Records | Has several distinct identifiers. |
247 | Syntactic Monads | I don't know. |
248 | Minimal delimited continuations | Dependent on specific continuation mechanism. |
251 | Mixing groups of definitions with expressions within bodies | I don't know. |
252 | Property Testing | I don't know. |
253 | Data (Type-)Checking | I don't know. |
255 | Restarting conditions | I don't know. |
258 | Uninterned symbols | I don't know. |
260 | Generated Symbols | I don't know. |
There is no reference implementation as this SRFI only specifies a portable SRFI library reference.
I thank Marc Nieper-Wißkirchen for suggesting that I write this SRFI and providing a fairly complete context. I just wrote down his discussions.
Thanks to the participants in the SRFI 261 mailing list who helped me refine this SRFI, including Marc Nieper-Wißkirchen, Wolfgang Corcoran-Mathe, John Cowan, Arthur A. Gleckler and Daphne Preston-Kendal.
© 2025 WANG Zheng (ufo5260987423).
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 (including the next paragraph) 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. 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.