r7rs-small-texinfo

R7RS-small Scheme converted to Texinfo.
git clone https://kaka.farm/~git/r7rs-small-texinfo
Log | Files | Refs | README | LICENSE

language-changes.texinfo (14667B)


      1 @node Language changes
      2 @unnumbered Language changes
      3 
      4 @menu
      5 * Incompatibilities with R5RS::
      6 * Other language changes since R5RS::
      7 * Incompatibilities with R6RS::
      8 @end menu
      9 
     10 @node Incompatibilities with R5RS
     11 @section Incompatibilities with @rfivers{}
     12 
     13 This section enumerates the incompatibilities between this report and
     14 the ``Revised@sup{5} report'' [@ref{R5RS}].
     15 
     16 This list is not authoritative, but is believed to be correct and
     17 complete.
     18 
     19 @itemize @bullet
     20 
     21 @item
     22 Case sensitivity is now the default in symbols and character names.
     23 This means that code written under the assumption that symbols could be
     24 written @code{FOO} or @code{Foo} in some contexts and @code{foo} in
     25 other contexts can either be changed, be marked with the new
     26 @code{#!fold-case} directive, or be included in a library using the
     27 @code{include-ci} library declaration. All standard identifiers are
     28 entirely in lower case.
     29 
     30 @item
     31 The @code{syntax-rules} construct now recognizes @code{_} (underscore)
     32 as a wildcard, which means it cannot be used as a syntax variable. It
     33 can still be used as a literal.
     34 
     35 @item
     36 The @rfivers{} procedures @code{exact->inexact} and
     37 @code{inexact->exact} have been renamed to their @rsixrs{} names,
     38 @code{inexact} and @code{exact}, respectively, as these names are
     39 shorter and more correct. The former names are still available in the
     40 @rfivers{} library.
     41 
     42 @item
     43 The guarantee that string comparison (with @code{string<?} and the
     44 related predicates) is a lexicographical extension of character
     45 comparison (with @code{char<?} and the related predicates) has been
     46 removed.
     47 
     48 @item
     49 Support for the # character in numeric literals is no longer required.
     50 
     51 @item
     52 Support for the letters @code{s}, @code{f}, @code{d}, and @code{l}
     53 as exponent markers is no longer required.
     54 
     55 @item
     56 Implementations of @code{string->number} are no longer permitted to
     57 return @code{#f} when the argument contains an explicit radix prefix,
     58 and must be compatible with @code{read} and the syntax of numbers in
     59 programs.
     60 
     61 @item
     62 The procedures @code{transcript-on} and @code{transcript-off} have been
     63 removed.
     64 
     65 @end itemize
     66 
     67 @node Other language changes since R5RS
     68 @section Other language changes since @rfivers{}
     69 
     70 This section enumerates the additional differences between this report
     71 and the ``Revised@sup{5} report'' [@ref{R5RS}].
     72 
     73 This list is not authoritative, but is believed to be correct and
     74 complete.
     75 
     76 @itemize @bullet
     77 
     78 @item
     79 Various minor ambiguities and unclarities in @rfivers{} have been
     80 cleaned up.
     81 
     82 @item
     83 Libraries have been added as a new program structure to improve
     84 encapsulation and sharing of code. Some existing and new identifiers
     85 have been factored out into separate libraries. Libraries can be
     86 imported into other libraries or main programs, with controlled
     87 exposure and renaming of identifiers. The contents of a library can be
     88 made conditional on the features of the implementation on which it is
     89 to be used. There is an @rfivers{} compatibility library.
     90 
     91 @item
     92 The expressions types @code{include}, @code{include-ci}, and
     93 @code{cond-expand} have been added to the base library; they have the
     94 same semantics as the corresponding library declarations.
     95 
     96 @item
     97 Exceptions can now be signaled explicitly with @code{raise},
     98 @code{raise-continuable} or @code{error}, and can be handled with
     99 @code{with-exception-handler} and the @code{guard} syntax. Any object
    100 can specify an error condition; the implementation-defined conditions
    101 signaled by @code{error} have a predicate to detect them and accessor
    102 functions to retrieve the arguments passed to @code{error}. Conditions
    103 signaled by @code{read} and by file-related procedures also have
    104 predicates to detect them.
    105 
    106 @item
    107 New disjoint types supporting access to multiple fields can be
    108 generated with the @code{define-record-type} of SRFI 9 [@ref{srfi9}].
    109 
    110 @item
    111 Parameter objects can be created with @code{make-parameter}, and
    112 dynamically rebound with @code{parameterize}. The procedures
    113 @code{current-input-port} and @code{current-output-port} are now
    114 parameter objects, as is the newly introduced
    115 @code{current-error-port}.
    116 
    117 @item
    118 Support for promises has been enhanced based on SRFI 45 [@ref{srfi45}].
    119 
    120 @item
    121 Bytevectors, vectors of exact integers in the range from 0 to 255
    122 inclusive, have been added as a new disjoint type. A subset of the
    123 vector procedures is provided. Bytevectors can be converted to and from
    124 strings in accordance with the UTF-8 character encoding. Bytevectors
    125 have a datum representation and evaluate to themselves.
    126 
    127 @item
    128 Vector constants evaluate to themselves.
    129 
    130 @item
    131 The procedure @code{read-line} is provided to make line-oriented
    132 textual input simpler.
    133 
    134 @item
    135 The procedure @code{flush-output-port} is provided to allow minimal
    136 control of output port buffering.
    137 
    138 @item
    139 Ports can now be designated as textual or binary ports, with new
    140 procedures for reading and writing binary data. The new predicates
    141 @code{input-port-open?} and @code{output-port-open?} return whether a
    142 port is open or closed. The new procedure @code{close-port} now closes
    143 a port; if the port has both input and output sides, both are closed.
    144 
    145 @item
    146 String ports have been added as a way to read and write characters to
    147 and from strings, and bytevector ports to read and write bytes to and
    148 from bytevectors.
    149 
    150 @item
    151 There are now I/O procedures specific to strings and bytevectors.
    152 
    153 @item
    154 The @code{write} procedure now generates datum labels when applied to
    155 circular objects. The new procedure @code{write-simple} never generates
    156 labels; @code{write-shared} generates labels for all shared and
    157 circular structure. The @code{display} procedure must not loop on
    158 circular objects.
    159 
    160 @item
    161 The @rsixrs{} procedure @code{eof-object} has been added. Eof-objects
    162 are now required to be a disjoint type.
    163 
    164 @item
    165 Syntax definitions are now allowed wherever variable definitions are.
    166 
    167 @item
    168 The @code{syntax-rules} construct now allows the ellipsis symbol to be
    169 specified explicitly instead of the default @code{@dots{}}, allows
    170 template escapes with an ellipsis-prefixed list, and allows tail
    171 patterns to follow an ellipsis pattern.
    172 
    173 @item
    174 The @code{syntax-error} syntax has been added as a way to signal
    175 immediate and more informative errors when a macro is expanded.
    176 
    177 @item
    178 The @code{letrec*} binding construct has been added, and internal
    179 @code{define} is specified in terms of it.
    180 
    181 @item
    182 Support for capturing multiple values has been enhanced with
    183 @code{define-values}, @code{let-values}, and @code{let*-values}.
    184 Standard expression types which contain a sequence of expressions now
    185 permit passing zero or more than one value to the continuations of all
    186 non-final expressions of the sequence.
    187 
    188 @item
    189 The @code{case} conditional now supports @code{=>} syntax analogous to
    190 @code{cond} not only in regular clauses but in the @code{else} clause
    191 as well.
    192 
    193 @item
    194 To support dispatching on the number of arguments passed to a
    195 procedure, @code{case-lambda} has been added in its own library.
    196 
    197 @item
    198 The convenience conditionals @code{when} and @code{unless} have been
    199 added.
    200 
    201 @item
    202 The behavior of @code{eqv?} on inexact numbers now conforms to the
    203 @rsixrs{} definition.
    204 
    205 @item
    206 When applied to procedures, @code{eq?} and @code{eqv?} are permitted to
    207 return different answers.
    208 
    209 @item
    210 The @rsixrs{} procedures @code{boolean=?} and @code{symbol=?} have been
    211 added.
    212 
    213 @item
    214 Positive infinity, negative infinity, NaN, and negative inexact zero
    215 have been added to the numeric tower as inexact values with the written
    216 representations @code{+inf.0}, @code{-inf.0}, @code{+nan.0}, and
    217 @code{-0.0} respectively. Support for them is not required. The
    218 representation @code{-nan.0} is synonymous with @code{+nan.0}.
    219 
    220 @item
    221 The @code{log} procedure now accepts a second argument specifying
    222 the logarithm base.
    223 
    224 @item
    225 The procedures @code{map} and @code{for-each} are now required to
    226 terminate on the shortest argument list.
    227 
    228 @item
    229 The procedures @code{member} and @code{assoc} now take an optional
    230 third argument specifying the equality predicate to be used.
    231 
    232 @item
    233 The numeric procedures @code{finite?}, @code{infinite?}, @code{nan?},
    234 @code{exact-integer?}, @code{square}, and @code{exact-integer-sqrt}
    235 have been added.
    236 
    237 @item
    238 The @code{-} and @code{/} procedures and the character and string
    239 comparison predicates are now required to support more than two
    240 arguments.
    241 
    242 @item
    243 The forms @code{#true} and @code{#false} are now supported as well as
    244 @code{#t} and @code{#f}.
    245 
    246 @item
    247 
    248 The procedures @code{make-list}, @code{list-copy}, @code{list-set!},
    249 @code{string-map}, @code{string-for-each}, @code{string->vector},
    250 @code{vector-append}, @code{vector-copy}, @code{vector-map},
    251 @code{vector-for-each}, @code{vector->string}, @code{vector-copy!}, and
    252 @code{string-copy!} have been added to round out the sequence
    253 operations.
    254 
    255 @item
    256 Some string and vector procedures support processing of part of a
    257 string or vector using optional @var{start} and @var{end} arguments.
    258 
    259 @item
    260 Some list procedures are now defined on circular lists.
    261 
    262 @item
    263 Implementations may provide any subset of the full Unicode repertoire
    264 that includes ASCII, but implementations must support any such subset
    265 in a way consistent with Unicode. Various character and string
    266 procedures have been extended accordingly, and case conversion
    267 procedures added for strings. String comparison is no longer required
    268 to be consistent with character comparison, which is based solely on
    269 Unicode scalar values. The new @code{digit-value} procedure has been
    270 added to obtain the numerical value of a numeric character.
    271 
    272 @item
    273 There are now two additional comment syntaxes: @code{#;} to skip the
    274 next datum, and @code{#|} ... @code{|#} for nestable block comments.
    275 
    276 @item
    277 Data prefixed with datum labels @code{#<}@var{n}@code{>=} can be
    278 referenced with @code{#<}@var{n}@code{>#}, allowing for reading and
    279 writing of data with shared structure.
    280 
    281 @item
    282 Strings and symbols now allow mnemonic and numeric escape sequences,
    283 and the list of named characters has been extended.
    284 
    285 @item
    286 The procedures @code{file-exists?} and @code{delete-file} are available
    287 in the @code{(scheme file)} library.
    288 
    289 @item
    290 An interface to the system environment, command line, and process exit
    291 status is available in the @code{(scheme process-context)} library.
    292 
    293 @item
    294 Procedures for accessing time-related values are available in the
    295 @code{(scheme time)} library.
    296 
    297 @item
    298 A less irregular set of integer division operators is provided
    299 with new and clearer names.
    300 
    301 @item
    302 The @code{load} procedure now accepts a second argument specifying the
    303 environment to load into.
    304 
    305 @item
    306 The @code{call-with-current-continuation} procedure now has the synonym
    307 @code{call/cc}.
    308 
    309 @item
    310 The semantics of read-eval-print loops are now partly prescribed,
    311 requiring the redefinition of procedures, but not syntax keywords, to
    312 have retroactive effect.
    313 
    314 @item
    315 The formal semantics now handles @code{dynamic-wind}.
    316 
    317 @end itemize
    318 
    319 @node Incompatibilities with R6RS
    320 @section Incompatibilities with @rsixrs{}
    321 
    322 This section enumerates the incompatibilities between @rsevenrs{} and
    323 the ``Revised@sup{6} report'' [@ref{R6RS}] and its accompanying Standard Libraries document.
    324 
    325 This list is not authoritative, and is possibly incomplete.
    326 
    327 @itemize @bullet
    328 
    329 @item
    330 @rsevenrs{} libraries begin with the keyword @code{define-library}
    331 rather than @code{library} in order to make them syntactically
    332 distinguishable from @rsixrs{} libraries. In @rsevenrs{} terms, the
    333 body of an @rsixrs{} library consists of a single export declaration
    334 followed by a single import declaration, followed by commands and
    335 definitions. In @rsevenrs, commands and definitions are not permitted
    336 directly within the body: they have to be be wrapped in a @code{begin}
    337 library declaration.
    338 
    339 @item
    340 There is no direct @rsixrs{} equivalent of the @code{include},
    341 @code{include-ci}, @code{include-library-declarations}, or
    342 @code{cond-expand} library declarations. On the other hand, the
    343 @rsevenrs{} library syntax does not support phase or version
    344 specifications.
    345 
    346 @item
    347 The grouping of standardized identifiers into libraries is different
    348 from the @rsixrs{} approach. In particular, procedures which are
    349 optional in @rfivers{}, either expressly or by implication, have been
    350 removed from the base library. Only the base library itself is an
    351 absolute requirement.
    352 
    353 @item
    354 No form of identifier syntax is provided.
    355 
    356 @item
    357 Internal syntax definitions are allowed, but uses of a syntax form
    358 cannot appear before its definition; the @code{even}/@code{odd} example
    359 given in @rsixrs{} is not allowed.
    360 
    361 @item
    362 The @rsixrs{} exception system was incorporated as-is, but the
    363 condition types have been left unspecified. In particular, where
    364 @rsixrs{} requires a condition of a specified type to be signaled,
    365 @rsevenrs{} says only ``it is an error'', leaving the question of
    366 signaling open.
    367 
    368 @item
    369 Full Unicode support is not required. Normalization is not provided.
    370 Character comparisons are defined by Unicode, but string comparisons
    371 are implementation-dependent. Non-Unicode characters are permitted.
    372 
    373 @item
    374 The full numeric tower is optional as in @rfivers{}, but optional
    375 support for IEEE infinities, NaN, and @minus{}0.0 was adopted from
    376 @rsixrs. Most clarifications on numeric results were also adopted, but
    377 the @rsixrs{} procedures @code{real-valued?}, @code{rational-valued?},
    378 and @code{integer-valued}? were not. The @rsixrs{} division operators
    379 @code{div}, @code{mod}, @code{div-and-mod}, @code{div0}, @code{mod0}
    380 and @code{div0-and-mod0} are not provided.
    381 
    382 @item
    383 When a result is unspecified, it is still required to be a single
    384 value. However, non-final expressions in a body can return any number
    385 of values.
    386 
    387 @item
    388 The semantics of @code{map} and @code{for-each} have been changed to
    389 use the SRFI 1 [@ref{srfi1}] early termination behavior. Likewise, @code{assoc} and
    390 @code{member} take an optional @code{equal?} argument as in SRFI 1,
    391 instead of the separate @code{assp} and @code{memp} procedures of
    392 @rsixrs{}.
    393 
    394 @item
    395 The @rsixrs{} @code{quasiquote} clarifications have been adopted, with
    396 the exception of multiple-argument @code{unquote} and
    397 @code{unquote-splicing}.
    398 
    399 @item
    400 The @rsixrs{} method of specifying mantissa widths was not adopted.
    401 
    402 @item
    403 String ports are compatible with SRFI 6 [@ref{srfi6}] rather than @rsixrs{}.
    404 
    405 @item
    406 @rsixrs{}-style bytevectors are included, but only the unsigned byte
    407 (@code{u8}) procedures have been provided. The lexical syntax uses
    408 @code{#u8} for compatibility with SRFI 4 [@ref{srfi4}], rather than the @rsixrs{}
    409 @code{#vu8} style.
    410 
    411 @item
    412 The utility macros @code{when} and @code{unless} are provided, but
    413 their result is left unspecified.
    414 
    415 @item
    416 The remaining features of the Standard Libraries document were
    417 left to future standardization efforts.
    418 
    419 @end itemize