>From e60d3e78d2a162e8916c6059f6b0f7a5917dcb3c Mon Sep 17 00:00:00 2001 From: Evan Hanson Date: Mon, 18 Oct 2021 17:48:37 +1300 Subject: [PATCH 3/3] Update SRFI feature identifiers and documentation Move all feature identifiers that are registered in chicken-syntax.scm and expand.scm into the correct files and update the documentation that relates to built-in features. Add a section to "Included modules" that lists the SRFI modules that can be imported. Also note that some SRFI identifiers _cannot_ be imported because they are fully built-in and not defined by any module. --- chicken-syntax.scm | 5 +++-- expand.scm | 8 ++++---- library.scm | 4 ++-- manual/Extensions to the standard | 31 +++++++++++++++++++---------- manual/Included modules | 27 +++++++++++++++++++++++++ manual/Module (chicken base) | 4 ++-- manual/Module (chicken platform) | 8 +------- manual/Module (chicken read-syntax) | 2 ++ manual/Module srfi-4 | 2 ++ 9 files changed, 63 insertions(+), 28 deletions(-) diff --git a/chicken-syntax.scm b/chicken-syntax.scm index cde8e9e6..6ebb9d10 100644 --- a/chicken-syntax.scm +++ b/chicken-syntax.scm @@ -43,7 +43,8 @@ (chicken base) (chicken fixnum) (chicken syntax) - (chicken internal)) + (chicken internal) + (chicken platform)) (include "common-declarations.scm") (include "mini-srfi-1.scm") @@ -1307,4 +1308,4 @@ ;; register features -(chicken.platform#register-feature! 'srfi-8 'srfi-11 'srfi-15 'srfi-16 'srfi-26 'srfi-31) +(register-feature! 'srfi-2 'srfi-8 'srfi-9 'srfi-11 'srfi-15 'srfi-16 'srfi-26 'srfi-31 'srfi-55) diff --git a/expand.scm b/expand.scm index e815a2b9..17dc7549 100644 --- a/expand.scm +++ b/expand.scm @@ -63,10 +63,6 @@ (cons (car a) (if (symbol? (cdr a)) (cdr a) '))) ?se)))) -(set! ##sys#features - (append '(#:srfi-0 #:srfi-2 #:srfi-6 #:srfi-9 #:srfi-46 #:srfi-55 #:srfi-61) - ##sys#features)) - (define-alias dd d) (define-alias dm d) (define-alias dx d) @@ -1585,3 +1581,7 @@ (fixup-macro-environment (##sys#macro-environment))) (define ##sys#meta-macro-environment (make-parameter (##sys#macro-environment))) + +;; register features + +(register-feature! 'srfi-0 'srfi-46 'srfi-61 'srfi-87) diff --git a/library.scm b/library.scm index 95e5797b..6c6a6942 100644 --- a/library.scm +++ b/library.scm @@ -6539,8 +6539,8 @@ static C_word C_fcall C_setenv(C_word x, C_word y) { (define ##sys#features '(#:chicken - #:srfi-6 #:srfi-8 #:srfi-12 #:srfi-17 #:srfi-23 #:srfi-30 - #:srfi-39 #:srfi-62 #:srfi-87 #:srfi-88 #:full-numeric-tower)) + #:srfi-6 #:srfi-12 #:srfi-17 #:srfi-23 #:srfi-30 + #:srfi-39 #:srfi-62 #:srfi-88 #:full-numeric-tower)) ;; Add system features: diff --git a/manual/Extensions to the standard b/manual/Extensions to the standard index 66ef6c64..a1ccdf29 100644 --- a/manual/Extensions to the standard +++ b/manual/Extensions to the standard @@ -28,17 +28,26 @@ always present in a module, even without imports. Expands by selecting feature clauses. This form is allowed to appear in non-toplevel expressions. -Predefined feature-identifiers are "situation" specific: - -; compile : {{chicken}}, {{compiling}}, {{library}}, {{eval}}, {{extras}}, {{regex}}, {{srfi-0}}, {{srfi-2}}, {{srfi-4}}, {{srfi-6}}, {{srfi-8}}, {{srfi-9}}, {{srfi-10}}, {{srfi-11}}, {{srfi-12}}, {{srfi-15}}, {{srfi-16}}, {{srfi-17}}, {{srfi-23}}, {{srfi-26}}, {{srfi-28}}, {{srfi-30}}, {{srfi-31}}, {{srfi-39}}, {{srfi-55}}, {{srfi-61}}, {{srfi-62}} - -; load : {{chicken}}, {{extras}}, {{srfi-0}}, {{srfi-2}}, {{srfi-6}}, {{srfi-8}}, {{srfi-9}}, {{srfi-10}}, {{srfi-12}}, {{srfi-17}}, {{srfi-23}}, {{srfi-28}}, {{srfi-30}}, {{srfi-39}}, {{srfi-55}}, {{srfi-61}}, {{srfi-62}}. {{library}} is implicit. - -; eval : {{csi}}, {{chicken}}, {{extras}}, {{srfi-0}}, {{srfi-2}}, {{srfi-6}}, {{srfi-8}}, {{srfi-9}}, {{srfi-10}}, {{srfi-11}}, {{srfi-12}}, {{srfi-15}}, {{srfi-16}}, {{srfi-17}}, {{srfi-23}}, {{srfi-26}}, {{srfi-28}}, {{srfi-30}}, {{srfi-31}}, {{srfi-39}}, {{srfi-55}}, {{srfi-61}}, {{srfi-62}}. {{library}} is implicit. - -The following feature-identifier classes are available in all situations: {{(machine-byte-order)}}, {{(machine-type)}}, {{(software-type)}}, {{(software-version)}}, where the actual feature-identifier is platform dependent. - -In addition the following feature-identifiers may exist: {{cross-chicken}}, {{dload}}, {{manyargs}}, {{ptables}}. +The following features are built-in and always available by default: +{{chicken}}, {{srfi-0}}, {{srfi-2}}, {{srfi-6}}, {{srfi-8}}, {{srfi-9}}, +{{srfi-11}}, {{srfi-12}}, {{srfi-15}}, {{srfi-16}}, {{srfi-17}}, {{srfi-23}}, +{{srfi-26}}, {{srfi-28}}, {{srfi-30}}, {{srfi-31}}, {{srfi-39}}, {{srfi-46}}, +{{srfi-55}}, {{srfi-61}}, {{srfi-62}}, {{srfi-87}}, {{srfi-88}}. + +There are also situation-specific feature identifiers: {{compiling}} during +compilation, {{csi}} when running in the interpreter, and {{compiler-extension}} +when running within the compiler. + +The following feature-identifier classes are available in all situations: +{{(machine-byte-order)}}, {{(machine-type)}}, {{(software-type)}}, +{{(software-version)}}, where the actual feature-identifier is platform +dependent. + +Platform endianness is indicated by the {{little-endian}} and {{big-endian}} +features. + +In addition the following feature-identifiers may exist: {{cross-chicken}}, +{{dload}}, {{gchooks}}, {{ptables}}, {{case-insensitive}}. For further information, see the documentation for [[http://srfi.schemers.org/srfi-0/srfi-0.html|SRFI-0]]. diff --git a/manual/Included modules b/manual/Included modules index 2a4e9a28..256b3f09 100644 --- a/manual/Included modules +++ b/manual/Included modules @@ -55,6 +55,33 @@ additional modules through the [[Extensions|eggs]] system. * [[Module (chicken time posix)]] : Manipulating POSIX time * [[Module (chicken type)]] : Defining and using static typing information +In addition to the core modules listed above, the following SRFI modules can be +imported. These provide access to identifiers described by the SRFI, but which +may already be defined by other parts of CHICKEN's standard library. + +* Module srfi-0 : Feature-based conditional expansion construct +* Module srfi-2 : AND-LET*: an AND with local bindings, a guarded LET* special form +* Module srfi-6 : Basic String Ports +* Module srfi-8 : receive: Binding to multiple values +* Module srfi-9 : Defining Record Types +* Module srfi-10 : #, external form +* Module srfi-11 : Syntax for receiving multiple values +* Module srfi-12 : Exception Handling +* Module srfi-15 : Syntax for dynamic scoping +* Module srfi-16 : Syntax for procedures of variable arity +* Module srfi-17 : Generalized set! +* Module srfi-23 : Error reporting mechanism +* Module srfi-26 : Notation for Specializing Parameters without Currying +* Module srfi-28 : Basic Format Strings +* Module srfi-31 : A special form `rec' for recursive evaluation +* Module srfi-39 : Parameter objects +* Module srfi-55 : require-extension +* Module srfi-88 : Keyword objects +* Module srfi-98 : An interface to access environment variables + +Other SRFI features may be supported but do not correspond to any importable module. +Refer to {{cond-expand}} for a list of non-module SRFI feature identifiers. + --- Previous: [[Extensions to the standard]] diff --git a/manual/Module (chicken base) b/manual/Module (chicken base) index 8abc07e7..f8bb1eea 100644 --- a/manual/Module (chicken base) +++ b/manual/Module (chicken base) @@ -1267,7 +1267,7 @@ extensions. During interpretation/evaluation {{require-library}} performs one of the following: -* If {{ID}} names a built-in feature {{chicken srfi-0 srfi-2 srfi-6 srfi-8 srfi-9 srfi-10 srfi-17 srfi-23 srfi-30 srfi-39 srfi-55}}, then nothing is done. +* If {{ID}} names a built-in feature, then nothing is done. * If {{ID}} names one of the syntactic extensions {{chicken-syntax chicken-ffi-syntax}}, then this extension will be loaded. * If {{ID}} names one of the core library units shipped with CHICKEN, then a {{(load-library 'ID)}} will be performed. * If {{ID}} names an installed extension with the {{syntax}} or {{require-at-runtime}} attribute, then the extensions is loaded at compile-time, probably doing a run-time {{(require ...)}} for any run-time requirements. @@ -1275,7 +1275,7 @@ following: During compilation, one of the following happens instead: -* If {{ID}} names a built-in feature {{chicken srfi-0 srfi-2 srfi-6 srfi-8 srfi-9 srfi-10 srfi-17 srfi-23 srfi-30 srfi-39 srfi-55}}, then nothing is done. +* If {{ID}} names a built-in feature, then nothing is done. * If {{ID}} names one of the syntactic extensions {{chicken-syntax chicken-ffi-syntax}}, then this extension will be loaded at compile-time, making the syntactic extensions available in compiled code. * If {{ID}} names one of the core library units shipped with CHICKEN, or if the option {{-uses ID}} has been passed to the compiler, then a {{(declare (uses ID))}} is generated. * If {{ID}} names an installed extension with the {{syntax}} or {{require-at-runtime}} attribute, then the extension is loaded at compile-time, and code is emitted to {{(require ...)}} any needed run-time requirements. diff --git a/manual/Module (chicken platform) b/manual/Module (chicken platform) index 47566d6b..7be85317 100644 --- a/manual/Module (chicken platform) +++ b/manual/Module (chicken platform) @@ -157,17 +157,11 @@ process is currently running, which is one of the following: === Feature identifiers - CHICKEN maintains a global list of ''features'' naming functionality available in the current system. Additionally the {{cond-expand}} form accesses this feature list to infer what features are provided. Predefined features are {{chicken}}, and the SRFIs (Scheme Request For Implementation) provided by the -base system: {{srfi-23, srfi-30, srfi-39}}. If the {{eval}} unit -is used (the default), the features {{srfi-0, srfi-2, srfi-6, srfi-8, srfi-9}} -and {{srfi-10}} are defined. When compiling code (during compile-time) the -feature {{compiling}} is registered. When evaluating code in the interpreter -(csi), the feature {{csi}} is registered. - +base system. Refer to {{cond-expand}} for a full list of predefined identifiers. ==== features diff --git a/manual/Module (chicken read-syntax) b/manual/Module (chicken read-syntax) index 00429878..a5fc716a 100644 --- a/manual/Module (chicken read-syntax) +++ b/manual/Module (chicken read-syntax) @@ -6,6 +6,8 @@ This module provides procedures which can be used to extend the reader with custom read syntax. +When loaded, the feature identifier {{srfi-10}} is defined. + === define-reader-ctor (define-reader-ctor SYMBOL PROC) diff --git a/manual/Module srfi-4 b/manual/Module srfi-4 index ccfe512d..9eb00002 100644 --- a/manual/Module srfi-4 +++ b/manual/Module srfi-4 @@ -6,6 +6,8 @@ Homogeneous numeric vector datatypes. Also see the [[http://srfi.schemers.org/srfi-4/srfi-4.html|original SRFI-4 document]]. +When loaded, the feature identifier {{srfi-4}} is defined. + === CHICKEN implementation specifics and extensions * Procedures for [[Module (chicken blob)|blob]] conversion, subvectors and vector I/O are provided. -- 2.31.1