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 | basic-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 |
111 | boxes |
Boxies |
112 | environment-inquiry |
Environment Inquiry |
113 | sets-and-bags |
Sets and Bags |
115 | regexp |
Scheme Regular Expressions |
117 | list-queues |
Queues based on lists |
116 | immutable-lists |
Immutable List Library |
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 |
136 | records |
Extensible record types |
137 | types |
Minimal Unique Types |
138 | compiling |
Compiling Scheme programs to executable |
139 | syntax-parameters |
Syntax parameters |
140 | strings |
Immutable Strings |
141 | integer-division |
Integer division |
143 | fixnums |
Fixnums |
145 | assume |
Assumptions |
146 | mappings |
Mappings |
151 | bitwise-operations |
Bitwise Operations |
152 | strings |
String Library (reduced) |
153 | sets |
Ordered Sets |
156 | predicate-combiners |
Syntactic combiners for binary predicates |
158 | generators-and-accumulators |
Generators and Accumulators |
161 | boxes |
Unifiable Boxes |
162 | comparators |
Comparators sublibrary |
165 | environment-monad |
The Environment Monad |
166 | formatting |
Monadic Formatting |
167 | ordered-key-value-store |
Ordered Key Value Store |
168 | ordered-tuple-store |
Ordered Tuple Store Database |
170 | posix |
POSIX API |
171 | transducers |
Transducers |
172 | safer-subsets-of-r7rs |
Two Safer Subsets of R7RS |
173 | hooks |
Hooks |
174 | posix-timespecs |
POSIX Timespecs |
175 | ascii |
ASCII character library |
176 | version |
Version flag |
178 | bitvectors |
Bitvector library |
179 | intervals-and-arrays |
Nonempty Intervals and Generalized Arrays (Updated) |
180 | json |
JSON |
181 | custom-ports |
Custom ports (including transcoded ports) |
189 | maybe-and-either Maybe and Either: optional
container types |
|
190 | coroutine-generators |
Coroutine Generators |
192 | port-positioning |
Port Positioning |
193 | command-line |
Command line |
194 | random-data-generators |
Random data generators |
195 | multiple-value-boxes |
Multiple-value boxes |
196 | range-object |
Range Object |
197 | pipeline-operators |
Pipeline Operators |
201 | syntactic-extensions |
Syntactic Extensions to the Core Scheme Bindings |
202 | and-let* |
Pattern-matching Variant of the and-let* Form that Supports Multiple Values |
203 | pictures |
A Simple Picture Language in the Style of SICP |
206 | auxiliary-syntax-keywords |
Auxiliary Syntax Keywords |
208 | nan |
NaN procedures |
209 | enums |
Enums and Enum Sets |
210 | multiple-values |
Procedures and Syntax for Multiple Values |
211 | macros |
Scheme Macro Libraries |
212 | aliases |
Aliases |
213 | identifier-properties |
Identifier Properties |
214 | flexvectors |
Flexvectors |
216 | sicp |
SICP Prerequisites (Portable) |
215 | logging |
Central Log Exchange |
217 | integer-sets |
Integer Sets |
219 | define |
Define higher-order lambda |
221 | higher-order-lambda |
Define higher-order lambda |
222 | compound-objects |
Compound Objects |
223 | bisect |
Generalized binary search procedures |
224 | integer-mappings |
Integer Mappings |
225 | dictionaries |
Dictionaries |
226 | control-features |
Control Features |
227 | optional-arguments |
Optional Arguments |
228 | composing-comparators |
Composing Comparators |
229 | tagged-procedures |
Tagged Procedures |
230 | atomic-operations |
Atomic Operations |
231 | intervals-and-arrays |
Intervals and Generalized Arrays |
232 | currying |
Flexible curried procedures |
233 | ini |
INI files |
234 | topological-sorting |
Topological Sorting |
235 | combinators |
Combinators |
236 | independently |
Evaluating expressions in an unspecified order |
237 | combinators |
Combinators |
238 | codesets |
Codesets |
239 | list-case |
Destructuring Lists |
240 | records |
Reconciled Records |
241 | match |
Match - Simple pattern-matching Syntax to Express Catamorphisms on Scheme Data |
242 | cfg |
The CFG Language |
244 | define-values |
Multiple-value Definitions |
247 | syntactic-monands |
Syntactic Monads |
248 | delimited-continuations |
Minimal delimited continuations |
251 | mixing-definitions-and-expressions |
Mixing groups of definitions with expressions within bodies |
252 | property-testing |
Property Testing |
253 | type-checing |
Data (Type-)Checking |
255 | restarting-conditions |
Restarting conditions |
258 | uninterned-symbols |
Uninterned symbols |
259 | tagged-procedures |
Tagged procedures with type safety |
260 | generated-symbols |
Generated Symbols |
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 $R^6RS$) |
34 | Exception Handling for Programs | Subsumed by $R^6RS$ |
35 | Conditions | Subsumed by $R^6RS$ |
36 | I/O Conditions | Subsumed by $R^6RS$ |
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 $R^6RS$) |
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. |
118 | Simple adjustable-size string | Modifies Scheme's historical fixed-length string implementation. |
119 | wisp: simpler indentation-sensitive scheme | Modifies lexical syntax. |
120 | Timer APIs | Dependent on withdrawn SRFI 114. |
123 | Generic accessor and modifier operators | Dependent on lexical syntax modification (SRFI 105). |
124 | Ephemerons | Dependent on garbage collection modification. |
135 | Immutable Texts | Modifies $R^{5/6/7}RS$ string implementation. |
144 | Flonums | Modifies flonum 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. |
160 | Homogeneous numeric vector libraries | Dependent on lexical syntax modification (SRFI 4). |
161 | Enhanced array literals | Modifies lexical syntax. |
164 | Enhanced multi-dimensional Arrays | Modifies lexical syntax. |
169 | Underscores in numbers | Modifies lexical syntax. |
185 | Linear adjustable-length strings | Modifies Scheme's historical fixed-length string implementation. |
188 | Splicing binding constructs for syntactic keywords | Modifies let-syntax and
letrec-syntax . |
207 | String-notated bytevectors | Modifies lexical syntax. |
There is no sample 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.