doc: Update `release.org'.
[bpt/guile.git] / NEWS
CommitLineData
b2cbe8d8 1Guile NEWS --- history of user-visible changes.
de2811cc 2Copyright (C) 1996-2013 Free Software Foundation, Inc.
5c54da76
JB
3See the end for copying conditions.
4
1e457544 5Please send Guile bug reports to bug-guile@gnu.org.
5ebbe4ef 6
66ad445d 7
de2811cc
AW
8Changes in 2.0.8 (since 2.0.7):
9
f361bb93 10* Notable changes
de2811cc 11
eed0d26c
MW
12** New keyword arguments for procedures that open files
13
14f2e470
AW
14The following procedures that open files now support keyword arguments
15to request binary I/O or to specify the character encoding for text
16files: `open-input-file', `open-output-file', `call-with-input-file',
17`call-with-output-file', `with-input-from-file', `with-output-to-file',
18and `with-error-to-file'.
eed0d26c
MW
19
20It is also now possible to specify whether Guile should scan files for
21Emacs-style coding declarations. This scan was done by default in
22versions 2.0.0 through 2.0.7, but now must be explicitly requested.
23
24See "File Ports" in the manual for details.
25
14f2e470 26** Rewritten guile.m4
de2811cc 27
f361bb93
AW
28The `guile.m4' autoconf macros have been rewritten to use `guild' and
29`pkg-config' instead of the deprecated `guile-config' (which itself
30calls pkg-config).
de2811cc 31
f361bb93
AW
32There is also a new macro, `GUILE_PKG', which allows packages to select
33the version of Guile that they want to compile against. See "Autoconf
34Macros" in the manual, for more information.
de2811cc 35
eed0d26c 36** Better Windows support
de2811cc 37
f361bb93
AW
38Guile now correctly identifies absolute paths on Windows (MinGW), and
39creates files on that platform according to its path conventions. See
14f2e470 40"File System" in the manual, for all details.
de2811cc 41
f361bb93
AW
42In addition, the new Gnulib imports provide `select' and `poll' on
43Windows builds.
de2811cc 44
f361bb93
AW
45As an incompatible change, systems that are missing <sys/select.h> were
46previously provided a public `scm_std_select' C function that defined a
47version of `select', but unhappily it also provided its own incompatible
14f2e470 48definitions for FD_SET, FD_ZERO, and other system interfaces. Guile
f361bb93
AW
49should not be setting these macros in public API, so this interface was
50removed on those plaforms (basically only MinGW).
de2811cc 51
eed0d26c 52** Numerics improvements
de2811cc 53
eed0d26c
MW
54`number->string' now reliably outputs enough digits to produce the same
55number when read back in. Previously, it mishandled subnormal numbers
56(printing them as "#.#"), and failed to distinguish between some
57distinct inexact numbers, e.g. 1.0 and (+ 1.0 (expt 2.0 -52)). These
58problems had far-reaching implications, since the compiler uses
59`number->string' to serialize numeric constants into .go files.
60
61`sqrt' now produces exact rational results when possible, and handles
62very large or very small numbers more robustly.
de2811cc 63
22c76fd8
MW
64A number (ahem) of operations involving exact rationals have been
65optimized, most notably `integer-expt' and `expt'.
eed0d26c 66
22c76fd8 67`exact->inexact' now performs correct IEEE rounding.
eed0d26c
MW
68
69** New optimizations
de2811cc 70
f361bb93 71There were a number of improvements to the partial evaluator, allowing
01b83dbd 72complete reduction of forms such as:
de2811cc 73
f361bb93 74 ((let ((_ 10)) (lambda () _)))
de2811cc 75
f361bb93 76 ((lambda _ _))
de2811cc 77
c608e1aa 78 (apply (lambda _ _) 1 2 3 '(4))
de2811cc 79
f361bb93 80 (call-with-values (lambda () (values 1 2)) (lambda _ _))
de2811cc 81
eed0d26c
MW
82`string-join' now handles huge lists efficiently.
83
14f2e470 84`get-bytevector-some' now uses buffered input, which is much faster.
de2811cc 85
a24cda1d
LC
86Finally, `array-ref', `array-set!' on arrays of rank 1 or 2 is now
87faster, because it avoids building a rest list. Similarly, the
88one-argument case of `array-for-each' and `array-map!' has been
89optimized, and `array-copy!' and `array-fill!' are faster.
de2811cc 90
7ca88a40
MW
91** `peek-char' no longer consumes EOF
92
93As required by the R5RS, if `peek-char' returns EOF, then the next read
94will also return EOF. Previously `peek-char' would consume the EOF.
95This makes a difference for terminal devices where it is possible to
96read past an EOF.
97
eed0d26c
MW
98** Gnulib update
99
100Guile's copy of Gnulib was updated to v0.0-7865-ga828bb2. The following
101modules were imported from Gnulib: select, times, pipe-posix, fstat,
102getlogin, poll, and c-strcase.
103
104** `include' resolves relative file names relative to including file
de2811cc 105
f361bb93
AW
106Given a relative file name, `include' will look for it relative to the
107directory of the including file. This harmonizes the behavior of
108`include' with that of `load'.
de2811cc 109
eed0d26c 110** SLIB compatibility restored
de2811cc 111
f361bb93
AW
112Guile 2.0.8 is now compatible with SLIB. You will have to use a
113development version of SLIB, however, until a new version of SLIB is
114released.
de2811cc 115
eed0d26c 116** Better ,trace REPL command
f361bb93
AW
117
118Sometimes the ,trace output for nested function calls could overflow the
119terminal width, which wasn't useful. Now there is a limit to the amount
120of space the prefix will take. See the documentation for ",trace" for
121more information.
de2811cc 122
eed0d26c
MW
123** Better docstring syntax supported for `case-lambda'
124
125Docstrings can now be placed immediately after the `case-lambda' or
126`case-lambda*' keyword. See "Case-lambda" in the manual.
127
eed0d26c
MW
128** Improved handling of Unicode byte order marks
129
130See "BOM Handling" in the manual for details.
131
132** Update predefined character sets to Unicode 6.2
de2811cc 133
465ff502
LC
134** GMP 4.2 or later required
135
136Guile used to require GMP at least version 4.1 (released in May 2002),
137and now requires at least version 4.2 (released in March 2006).
138
de2811cc
AW
139* Manual updates
140
eed0d26c 141** Better SXML documentation
de2811cc 142
f361bb93
AW
143The documentation for SXML modules was much improved, though there is
144still far to go. See "SXML" in manual.
de2811cc 145
eed0d26c 146** Style updates
de2811cc 147
f361bb93
AW
148Use of "iff" was replaced with standard English. Keyword arguments are
149now documented consistently, along with their default values.
de2811cc 150
eed0d26c 151** An end to the generated-documentation experiment
de2811cc 152
f361bb93
AW
153When Guile 2.0 imported some modules from Guile-Lib, they came with a
154system that generated documentation from docstrings and module
155commentaries. This produced terrible documentation. We finally bit the
156bullet and incorporated these modules into the main text, and will be
157improving them manually over time, as is the case with SXML. Help is
158appreciated.
de2811cc 159
eed0d26c 160** New documentation
de2811cc 161
f361bb93
AW
162There is now documentation for `scm_array_type', and `scm_array_ref', as
163well as for the new `array-length' / 'scm_c_array_length' /
164`scm_array_length' functions. `array-in-bounds?' has better
165documentation as well. The `program-arguments-alist' and
eed0d26c
MW
166`program-lambda-list' functions are now documented, as well as `and=>',
167`exit', and `quit'. The (system repl server) module is now documented
168(see REPL Servers). Finally, the GOOPS class hierarchy diagram has been
169regenerated for the web and print output formats.
de2811cc 170
f361bb93 171* New deprecations
de2811cc 172
eed0d26c 173** Deprecate generalized vector interface
de2811cc 174
f361bb93
AW
175The generalized vector interface, introduced in 1.8.0, is simply a
176redundant, verbose interface to arrays of rank 1. `array-ref' and
177similar functions are entirely sufficient. Thus,
178`scm_generalized_vector_p', `scm_generalized_vector_length',
179`scm_generalized_vector_ref', `scm_generalized_vector_set_x', and
180`scm_generalized_vector_to_list' are now deprecated.
de2811cc 181
eed0d26c 182** Deprecate SCM_CHAR_CODE_LIMIT and char-code-limit
de2811cc 183
f361bb93
AW
184These constants were defined to 256, which is not the highest codepoint
185supported by Guile. Given that they were useless and incorrect, they
186have been deprecated.
de2811cc 187
eed0d26c 188** Deprecate `http-get*'
de2811cc 189
f361bb93 190The new `#:streaming?' argument to `http-get' subsumes the functionality
ed4aa264
LC
191of `http-get*' (introduced in 2.0.7). Also, the `#:extra-headers'
192argument is deprecated in favor of `#:headers'.
de2811cc 193
eed0d26c 194** Deprecate (ice-9 mapping)
de2811cc 195
f361bb93
AW
196This module, present in Guile since 1996 but never used or documented,
197has never worked in Guile 2.0. It has now been deprecated and will be
198removed in Guile 2.2.
de2811cc 199
eed0d26c 200** Deprecate undocumented array-related C functions
a24cda1d
LC
201
202These are `scm_array_fill_int', `scm_ra_eqp', `scm_ra_lessp',
203`scm_ra_leqp', `scm_ra_grp', `scm_ra_greqp', `scm_ra_sum',
204`scm_ra_product', `scm_ra_difference', `scm_ra_divide', and
205`scm_array_identity'.
206
de2811cc
AW
207* New interfaces
208
eed0d26c 209** SRFI-41 Streams
de2811cc 210
eed0d26c 211See "SRFI-41" in the manual.
de2811cc 212
14f2e470
AW
213** SRFI-45 exports `promise?'
214
215SRFI-45 now exports a `promise?' procedure that works with its promises.
216Also, its promises now print more nicely.
217
eed0d26c 218** New HTTP client procedures
de2811cc 219
eed0d26c
MW
220See "Web Client" for documentation on the new `http-head', `http-post',
221`http-put', `http-delete', `http-trace', and `http-options' procedures,
222and also for more options to `http-get'.
de2811cc 223
eed0d26c 224** Much more capable `xml->sxml'
ed4aa264 225
eed0d26c
MW
226See "Reading and Writing XML" for information on how the `xml->sxml'
227parser deals with namespaces, processed entities, doctypes, and literal
228strings. Incidentally, `current-ssax-error-port' is now a parameter
229object.
ed4aa264 230
eed0d26c 231** New procedures for converting strings to and from bytevectors
de2811cc 232
eed0d26c
MW
233See "Representing Strings as Bytes" for documention on the new `(ice-9
234iconv)' module and its `bytevector->string' and `string->bytevector'
235procedures.
de2811cc 236
a24cda1d
LC
237** Escape continuations with `call/ec' and `let/ec'
238
239See "Prompt Primitives".
240
eed0d26c
MW
241** New procedures to read all characters from a port
242
243See "Line/Delimited" in the manual for documentation on `read-string'
244 and `read-string!'.
245
246** New procedure `sendfile'
247
248See "File System".
249
250** New procedure `unget-bytevector'
251
252See "R6RS Binary Input".
253
254** New C helper: `scm_c_bind_keyword_arguments'
255
256See "Keyword Procedures".
257
258** New command-line arguments: `--language' and `-C'
259
260See "Command-line Options" in the manual.
261
262** New environment variables: `GUILE_STACK_SIZE', `GUILE_INSTALL_LOCALE'
263
264See "Environment Variables".
265
266** New procedures for dealing with file names
267
268See "File System" for documentation on `system-file-name-convention',
269`file-name-separator?', `absolute-file-name?', and
270`file-name-separator-string'.
271
272** `array-length', an array's first dimension
de2811cc 273
01b83dbd 274See "Array Procedures".
de2811cc 275
eed0d26c 276** `hash-count', for hash tables
de2811cc 277
01b83dbd 278See "Hash Tables".
de2811cc 279
eed0d26c
MW
280** `round-ash', a bit-shifting operator that rounds on right-shift
281
282See "Bitwise Operations".
283
284** New foreign types: `ssize_t', `ptrdiff_t'
de2811cc 285
01b83dbd 286See "Foreign Types".
de2811cc 287
eed0d26c 288** New C helpers: `scm_from_ptrdiff_t', `scm_to_ptrdiff_t'
de2811cc 289
01b83dbd 290See "Integers".
de2811cc 291
eed0d26c 292** Socket option `SO_REUSEPORT' now available from Scheme
de2811cc 293
eed0d26c
MW
294If supported on the platform, `SO_REUSEPORT' is now available from
295Scheme as well. See "Network Sockets and Communication".
de2811cc 296
eed0d26c 297** `current-language' in default environment
de2811cc 298
01b83dbd
AW
299Previously defined only in `(system base language)', `current-language'
300is now defined in the default environment, and is used to determine the
301language for the REPL, and for `compile-and-load'.
de2811cc 302
01b83dbd 303** New procedure: `fluid->parameter'
de2811cc 304
01b83dbd
AW
305See "Parameters", for information on how to convert a fluid to a
306parameter.
de2811cc 307
eed0d26c 308** New `print' REPL option
de2811cc 309
01b83dbd
AW
310See "REPL Commands" in the manual for information on the new
311user-customizable REPL printer.
de2811cc 312
eed0d26c 313** New variable: %site-ccache-dir
de2811cc 314
01b83dbd
AW
315The "Installing Site Packages" and "Build Config" manual sections now
316refer to this variable to describe where users should install their
317`.go' files.
de2811cc
AW
318
319* Build fixes
320
f361bb93 321** Fix compilation against libgc 7.3.
de2811cc 322** Fix cross-compilation of `c-tokenize.o'.
f361bb93
AW
323** Fix warning when compiling against glibc 2.17.
324** Fix documentation build against Texinfo 5.0.
01b83dbd
AW
325** Fix building Guile from a directory with non-ASCII characters.
326** Fix native MinGW build.
327** Fix --disable-posix build.
328** Fix MinGW builds with networking, POSIX, and thread support.
de2811cc
AW
329
330* Bug fixes
331
eed0d26c
MW
332** Fix inexact number printer.
333 (http://bugs.gnu.org/13757)
334** Fix infinite loop when parsing optional-argument short options (SRFI-37).
ed4aa264 335 (http://bugs.gnu.org/13176)
eed0d26c 336** web: Support non-GMT date headers in the HTTP client.
ed4aa264 337 (http://bugs.gnu.org/13544)
eed0d26c
MW
338** web: support IP-literal (IPv6 address) in Host header.
339** Avoid stack overflows with `par-map' and nested futures in general.
ed4aa264 340 (http://bugs.gnu.org/13188)
eed0d26c
MW
341** Peek-char no longer consumes EOF.
342 (http://bugs.gnu.org/12216)
343** Avoid swallowing multiple EOFs in R6RS binary-input procedures.
01b83dbd
AW
344** A fork when multiple threads are running will now print a warning.
345** Allow for spurious wakeups from pthread_cond_wait.
de2811cc 346 (http://bugs.gnu.org/10641)
01b83dbd 347** Warn and ignore module autoload failures.
de2811cc 348 (http://bugs.gnu.org/12202)
01b83dbd
AW
349** Use chmod portably in (system base compile).
350 (http://bugs.gnu.org/10474)
c608e1aa 351** Fix response-body-port for HTTP responses without content-length.
01b83dbd
AW
352 (http://bugs.gnu.org/13857)
353** Allow case-lambda expressions with no clauses.
354 (http://bugs.gnu.org/9776)
de2811cc
AW
355** Improve standards conformance of string->number.
356 (http://bugs.gnu.org/11887)
01b83dbd
AW
357** Support calls and tail-calls with more than 255 formals.
358** ,option evaluates its right-hand-side.
de2811cc 359 (http://bugs.gnu.org/13076)
01b83dbd 360** Structs with tail arrays are not simple.
de2811cc
AW
361 (http://bugs.gnu.org/12808)
362** Make `SCM_LONG_BIT' usable in preprocessor conditionals.
363 (http://bugs.gnu.org/13848)
364** Fix thread-unsafe lazy initializations.
01b83dbd 365** Allow SMOB mark procedures to be called from parallel markers.
de2811cc
AW
366 (http://bugs.gnu.org/13611)
367** Fix later-bindings-win logic in with-fluids.
368 (http://bugs.gnu.org/13843)
369** Fix duplicate removal of with-fluids.
370 (http://bugs.gnu.org/13838)
371** Support calling foreign functions of 10 arguments or more.
01b83dbd
AW
372 (http://bugs.gnu.org/13809)
373** Let reverse! accept arbitrary types as second argument.
374 (http://bugs.gnu.org/13835)
de2811cc
AW
375** Recognize the `x86_64.*-gnux32' triplet.
376** Check whether a triplet's OS part specifies an ABI.
377** Recognize mips64* as having 32-bit pointers by default.
eed0d26c
MW
378** Use portable sed constructs.
379 (http://bugs.gnu.org/14042)
01b83dbd
AW
380** Remove language/glil/decompile-assembly.scm.
381 (http://bugs.gnu.org/10622)
382** Use O_BINARY in `copy-file', `load-objcode', `mkstemp'.
eed0d26c
MW
383** Use byte-oriented functions in `get-bytevector*'.
384** Fix abort when iconv swallows BOM from UTF-16 or UTF-32 stream.
01b83dbd 385** Fix compilation of functions with more than 255 local variables.
de2811cc 386** Fix `getgroups' for when zero supplementary group IDs exist.
01b83dbd
AW
387** Allow (define-macro name (lambda ...)).
388** Various fixes to the (texinfo) modules.
de2811cc 389** guild: Gracefully handle failures to install the locale.
01b83dbd
AW
390** Fix format string warnings for ~!, ~|, ~/, ~q, ~Q, and ~^.
391 (http://bugs.gnu.org/13485)
de2811cc 392** Fix source annotation bug in psyntax 'expand-body'.
01b83dbd 393** Ecmascript: Fix conversion to boolean for non-numbers.
eed0d26c
MW
394** Use case-insensitive comparisons for encoding names.
395** Add missing cond-expand feature identifiers.
01b83dbd
AW
396** A failure to find a module's file does not prevent future loading.
397** Many (oop goops save) fixes.
398** `http-get': don't shutdown write end of socket.
399 (http://bugs.gnu.org/13095)
400** Avoid signed integer overflow in scm_product.
c608e1aa 401** http: read-response-body always returns bytevector or #f, never EOF.
de2811cc 402** web: Correctly detect "No route to host" conditions.
eed0d26c 403** `system*': failure to execvp no longer leaks dangling processes.
de2811cc 404 (http://bugs.gnu.org/13166)
eed0d26c 405** More sensible case-lambda* dispatch.
01b83dbd 406 (http://bugs.gnu.org/12929)
de2811cc
AW
407** Do not defer expansion of internal define-syntax forms.
408 (http://bugs.gnu.org/13509)
409
410
411\f
13fac282
LC
412Changes in 2.0.7 (since 2.0.6):
413
414* Notable changes
415
416** SRFI-105 curly infix expressions are supported
417
418Curly infix expressions as described at
419http://srfi.schemers.org/srfi-105/srfi-105.html are now supported by
420Guile's reader. This allows users to write things like {a * {b + c}}
421instead of (* a (+ b c)). SRFI-105 support is enabled by using the
422`#!curly-infix' directive in source code, or the `curly-infix' reader
423option. See the manual for details.
424
425** Reader options may now be per-port
426
427Historically, `read-options' and related procedures would manipulate
428global options, affecting the `read' procedure for all threads, and all
429current uses of `read'.
430
431Guile can now associate `read' options with specific ports, allowing
432different ports to use different options. For instance, the
433`#!fold-case' and `#!no-fold-case' reader directives have been
434implemented, and their effect is to modify the current read options of
435the current port only; similarly for `#!curly-infix'. Thus, it is
436possible, for instance, to have one port reading case-sensitive code,
437while another port reads case-insensitive code.
438
439** Futures may now be nested
440
441Futures may now be nested: a future can itself spawn and then `touch'
442other futures. In addition, any thread that touches a future that has
443not completed now processes other futures while waiting for the touched
444future to completed. This allows all threads to be kept busy, and was
445made possible by the use of delimited continuations (see the manual for
446details.)
447
2813d725
MW
448Consequently, `par-map' and `par-for-each' have been rewritten and can
449now use all cores.
13fac282 450
3919585f
MW
451** `GUILE_LOAD_PATH' et al can now add directories to the end of the path
452
453`GUILE_LOAD_PATH' and `GUILE_LOAD_COMPILED_PATH' can now be used to add
454directories to both ends of the load path. If the special path
455component `...' (ellipsis) is present in these environment variables,
456then the default path is put in place of the ellipsis, otherwise the
457default path is placed at the end. See "Environment Variables" in the
458manual for details.
459
13fac282
LC
460** `load-in-vicinity' search for `.go' files in `%load-compiled-path'
461
462Previously, `load-in-vicinity' would look for compiled files in the
463auto-compilation cache, but not in `%load-compiled-path'. This is now
464fixed. This affects `load', and the `-l' command-line flag. See
465<http://bugs.gnu.org/12519> for details.
466
467** Extension search order fixed, and LD_LIBRARY_PATH preserved
468
469Up to 2.0.6, Guile would modify the `LD_LIBRARY_PATH' environment
470variable (or whichever is relevant for the host OS) to insert its own
471default extension directories in the search path (using GNU libltdl
472facilities was not possible here.) This approach was problematic in two
473ways.
474
475First, the `LD_LIBRARY_PATH' modification would be visible to
476sub-processes, and would also affect future calls to `dlopen', which
477could lead to subtle bugs in the application or sub-processes. Second,
a94e7d85
MW
478when the installation prefix is /usr, the `LD_LIBRARY_PATH' modification
479would typically end up inserting /usr/lib before /usr/local/lib in the
480search path, which is often the opposite of system-wide settings such as
481`ld.so.conf'.
13fac282
LC
482
483Both issues have now been fixed.
484
485** `make-vtable-vtable' is now deprecated
486
487Programs should instead use `make-vtable' and `<standard-vtable>'.
488
489** The `-Wduplicate-case-datum' and `-Wbad-case-datum' are enabled
490
491These recently introduced warnings have been documented and are now
492enabled by default when auto-compiling.
493
a94e7d85 494** Optimize calls to `equal?' or `eqv?' with a constant argument
13fac282 495
a94e7d85
MW
496The compiler simplifies calls to `equal?' or `eqv?' with a constant
497argument to use `eq?' instead, when applicable.
13fac282
LC
498
499* Manual updates
500
501** SRFI-9 records now documented under "Compound Data Types"
502
503The documentation of SRFI-9 record types has been moved in the "Compound
504Data Types", next to Guile's other record APIs. A new section
505introduces the various record APIs, and describes the trade-offs they
506make. These changes were made in an attempt to better guide users
507through the maze of records API, and to recommend SRFI-9 as the main
508API.
509
510The documentation of Guile's raw `struct' API has also been improved.
511
512** (ice-9 and-let-star) and (ice-9 curried-definitions) now documented
513
514These modules were missing from the manual.
515
516* New interfaces
517
518** New "functional record setters" as a GNU extension of SRFI-9
519
520The (srfi srfi-9 gnu) module now provides three new macros to deal with
521"updates" of immutable records: `define-immutable-record-type',
522`set-field', and `set-fields'.
523
524The first one allows record type "functional setters" to be defined;
525such setters keep the record unchanged, and instead return a new record
526with only one different field. The remaining macros provide the same
527functionality, and also optimize updates of multiple or nested fields.
528See the manual for details.
529
530** web: New `http-get*', `response-body-port', and `text-content-type?'
531 procedures
532
533These procedures return a port from which to read the response's body.
534Unlike `http-get' and `read-response-body', they allow the body to be
535processed incrementally instead of being stored entirely in memory.
536
537The `text-content-type?' predicate allows users to determine whether the
538content type of a response is textual.
539
540See the manual for details.
541
542** `string-split' accepts character sets and predicates
543
544The `string-split' procedure can now be given a SRFI-14 character set or
545a predicate, instead of just a character.
546
3b539098 547** R6RS SRFI support
13fac282 548
3b539098
LC
549Previously, in R6RS modules, Guile incorrectly ignored components of
550SRFI module names after the SRFI number, making it impossible to specify
551sub-libraries. This release corrects this, bringing us into accordance
552with SRFI 97.
13fac282
LC
553
554** `define-public' is no a longer curried definition by default
555
556The (ice-9 curried-definitions) should be used for such uses. See the
557manual for details.
558
559* Build fixes
560
561** Remove reference to `scm_init_popen' when `fork' is unavailable
562
563This fixes a MinGW build issue (http://bugs.gnu.org/12477).
564
565** Fix race between installing `guild' and the `guile-tools' symlink
566
567* Bug fixes
568
569** Procedures returned by `eval' now have docstrings
570 (http://bugs.gnu.org/12173)
571** web client: correctly handle uri-query, etc. in relative URI headers
572 (http://bugs.gnu.org/12827)
573** Fix docs for R6RS `hashtable-copy'
574** R6RS `string-for-each' now accepts multiple string arguments
575** Fix out-of-range error in the compiler's CSE pass
576 (http://bugs.gnu.org/12883)
577** Add missing R6RS `open-file-input/output-port' procedure
578** Futures: Avoid creating the worker pool more than once
579** Fix invalid assertion about mutex ownership in threads.c
580 (http://bugs.gnu.org/12719)
581** Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'
582** The `scandir' procedure now uses `lstat' instead of `stat'
583** Fix `generalized-vector->list' indexing bug with shared arrays
584 (http://bugs.gnu.org/12465)
585** web: Change `http-get' to try all the addresses for the given URI
586** Implement `hash' for structs
587 (http://lists.gnu.org/archive/html/guile-devel/2012-10/msg00031.html)
588** `read' now adds source properties for data types beyond pairs
589** Improve error reporting in `append!'
590** In fold-matches, set regexp/notbol unless matching string start
591** Don't stat(2) and access(2) the .go location before using it
592** SRFI-19: use zero padding for hours in ISO 8601 format, not blanks
593** web: Fix uri-encoding for strings with no unreserved chars, and octets 0-15
594** More robust texinfo alias handling
595** Optimize `format' and `simple-format'
596 (http://bugs.gnu.org/12033)
597** Angle of -0.0 is pi, not zero
598
599\f
d2e35793
AW
600Changes in 2.0.6 (since 2.0.5):
601
602* Notable changes
603
604** New optimization pass: common subexpression elimination (CSE)
605
606Guile's optimizer will now run a CSE pass after partial evaluation.
607This pass propagates static information about branches taken, bound
608lexicals, and effects from an expression's dominators. It can replace
609common subexpressions with their boolean values (potentially enabling
610dead code elimination), equivalent bound lexicals, or it can elide them
611entirely, depending on the context in which they are executed. This
612pass is especially useful in removing duplicate type checks, such as
d7a33b64 613those produced by SRFI-9 record accessors.
d2e35793
AW
614
615** Improvements to the partial evaluator
616
617Peval can now hoist tests that are common to both branches of a
618conditional into the test. This can help with long chains of
619conditionals, such as those generated by the `match' macro. Peval can
620now do simple beta-reductions of procedures with rest arguments. It
621also avoids residualizing degenerate lexical aliases, even when full
622inlining is not possible. Finally, peval now uses the effects analysis
623introduced for the CSE pass. More precise effects analysis allows peval
624to move more code.
625
626** Run finalizers asynchronously in asyncs
627
628Finalizers are now run asynchronously, via an async. See Asyncs in the
629manual. This allows Guile and user code to safely allocate memory while
630holding a mutex.
631
632** Update SRFI-14 character sets to Unicode 6.1
633
634Note that this update causes the Latin-1 characters `§' and `¶' to be
635reclassified as punctuation. They were previously considered to be part
636of `char-set:symbol'.
637
638** Better source information for datums
639
640When the `positions' reader option is on, as it is by default, Guile's
641reader will record source information for more kinds of datums.
642
643** Improved error and warning messages
644
d7a33b64
LC
645`syntax-violation' errors now prefer `subform' for source info, with
646`form' as fallback. Syntactic errors in `cond' and `case' now produce
d2e35793
AW
647better errors. `case' can now warn on duplicate datums, or datums that
648cannot be usefully compared with `eqv?'. `-Warity-mismatch' now handles
649applicable structs. `-Wformat' is more robust in the presence of
650`gettext'. Finally, various exceptions thrown by the Web modules now
651define appropriate exception printers.
652
653** A few important bug fixes in the HTTP modules.
654
655Guile's web server framework now checks if an application returns a body
d7a33b64 656where it is not permitted, for example in response to a HEAD request,
d2e35793
AW
657and warn or truncate the response as appropriate. Bad requests now
658cause a 400 Bad Request response to be printed before closing the port.
659Finally, some date-printing and URL-parsing bugs were fixed.
660
661** Pretty-print improvements
662
663When Guile needs to pretty-print Tree-IL, it will try to reconstruct
664`cond', `or`, and other derived syntax forms from the primitive tree-IL
665forms. It also uses the original names instead of the fresh unique
666names, when it is unambiguous to do so. This can be seen in the output
667of REPL commands like `,optimize'.
668
669Also, the `pretty-print' procedure has a new keyword argument,
670`#:max-expr-width'.
671
672** Fix memory leak involving applicable SMOBs
673
674At some point in the 1.9.x series, Guile began leaking any applicable
675SMOB that was actually applied. (There was a weak-key map from SMOB to
676trampoline functions, where the value had a strong reference on the
677key.) This has been fixed. There was much rejoicing!
678
32299e49
AW
679** Support for HTTP/1.1 chunked transfer coding
680
681See "Transfer Codings" in the manual, for more.
682
d2e35793
AW
683** Micro-optimizations
684
685A pile of micro-optimizations: the `string-trim' function when called
686with `char-set:whitespace'; the `(web http)' parsers; SMOB application;
687conversion of raw UTF-8 and UTF-32 data to and from SCM strings; vlists
688and vhashes; `read' when processing string literals.
689
690** Incompatible change to `scandir'
691
692As was the original intention, `scandir' now runs the `select?'
693procedure on all items, including subdirectories and the `.' and `..'
694entries. It receives the basename of the file in question instead of
695the full name. We apologize for this incompatible change to this
696function introduced in the 2.0.4 release.
697
698* Manual updates
699
700The manual has been made much more consistent in its naming conventions
701with regards to formal parameters of functions. Thanks to Bake Timmons.
702
703* New interfaces
704
705** New C function: `scm_to_pointer'
32299e49 706** New C inline functions: `scm_new_smob', `scm_new_double_smob'
d2e35793
AW
707** (ice-9 format): Add ~h specifier for localized number output.
708** (web response): New procedure: `response-must-not-include-body?'
709** New predicate: 'supports-source-properties?'
8898f43c 710** New C helpers: `scm_c_values', `scm_c_nvalues'
d2e35793
AW
711** Newly public inline C function: `scm_unget_byte'
712** (language tree-il): New functions: `tree-il=?', `tree-il-hash'
713** New fluid: `%default-port-conversion-strategy'
714** New syntax: `=>' within `case'
32299e49
AW
715** (web http): `make-chunked-input-port', `make-chunked-output-port'
716** (web http): `declare-opaque-header!'
d2e35793
AW
717
718Search the manual for these identifiers, for more information.
719
720* New deprecations
721
722** `close-io-port' deprecated
723
724Use `close-port'.
725
726** `scm_sym2var' deprecated
727
728In most cases, replace with `scm_lookup' or `scm_module_variable'. Use
729`scm_define' or `scm_module_ensure_local_variable' if the second
730argument is nonzero. See "Accessing Modules from C" in the manual, for
731full details.
732
733** Lookup closures deprecated
734
735These were never documented. See "Module System Reflection" in the
736manual for replacements.
737
738* Build fixes
739
740** Fix compilation against uninstalled Guile on non-GNU platforms.
741** Fix `SCM_I_ERROR' definition for MinGW without networking.
742** Fix compilation with the Sun C compiler.
743** Fix check for `clock_gettime' on OpenBSD and some other systems.
744** Fix build with --enable-debug-malloc.
745** Honor $(program_transform_name) for the `guile-tools' symlink.
746** Fix cross-compilation of GOOPS-using code.
747
748* Bug fixes
749
750** Fix use of unitialized stat buffer in search-path of absolute paths.
751** Avoid calling `freelocale' with a NULL argument.
752** Work around erroneous tr_TR locale in Darwin 8 in tests.
753** Fix `getaddrinfo' test for Darwin 8.
754** Use Gnulib's `regex' module for better regex portability.
755** `source-properties' and friends work on any object
756** Rewrite open-process in C, for robustness related to threads and fork
757** Fix <TAG>vector-length when applied to other uniform vector types
758** Fix escape-only prompt optimization (was disabled previously)
759** Fix a segfault when /dev/urandom is not accessible
760** Fix flush on soft ports, so that it actually runs.
761** Better compatibility of SRFI-9 records with core records
762** Fix and clarify documentation of `sorted?'.
763** Fix IEEE-754 endianness conversion in bytevectors.
764** Correct thunk check in the `wind' instruction.
765** Add @acronym support to texinfo modules
766** Fix docbook->texi for <ulink> without URL
767** Fix `setvbuf' to leave the line/column number unchanged.
768** Add missing public declaration for `scm_take_from_input_buffers'.
769** Fix relative file name canonicalization with empty %LOAD-PATH entries.
770** Import newer (ice-9 match) from Chibi-Scheme.
771** Fix unbound variables and unbound values in ECMAScript runtime.
772** Make SRFI-6 string ports Unicode-capable.
773
774\f
f7cf5898
LC
775Changes in 2.0.5 (since 2.0.4):
776
777This release fixes the binary interface information (SONAME) of
778libguile, which was incorrect in 2.0.4. It does not contain other
779changes.
780
781\f
f43622a2
AW
782Changes in 2.0.4 (since 2.0.3):
783
f41ef416 784* Notable changes
f43622a2 785
f41ef416 786** Better debuggability for interpreted procedures.
f43622a2
AW
787
788Guile 2.0 came with a great debugging experience for compiled
789procedures, but the story for interpreted procedures was terrible. Now,
486bd70d
AW
790at least, interpreted procedures have names, and the `arity' procedure
791property is always correct (or, as correct as it can be, in the presence
792of `case-lambda').
f43622a2
AW
793
794** Support for cross-compilation.
795
796One can now use a native Guile to cross-compile `.go' files for a
797different architecture. See the documentation for `--target' in the
486bd70d
AW
798"Compilation" section of the manual, for information on how to use the
799cross-compiler. See the "Cross building Guile" section of the README,
800for more on how to cross-compile Guile itself.
f43622a2 801
d4b5c773
AW
802** The return of `local-eval'.
803
804Back by popular demand, `the-environment' and `local-eval' allow the
805user to capture a lexical environment, and then evaluate arbitrary
806expressions in that context. There is also a new `local-compile'
807command. See "Local Evaluation" in the manual, for more. Special
808thanks to Mark Weaver for an initial implementation of this feature.
809
f43622a2
AW
810** Fluids can now have default values.
811
812Fluids are used for dynamic and thread-local binding. They have always
813inherited their values from the context or thread that created them.
814However, there was a case in which a new thread would enter Guile, and
815the default values of all the fluids would be `#f' for that thread.
816
817This has now been fixed so that `make-fluid' has an optional default
486bd70d 818value for fluids in unrelated dynamic roots, which defaults to `#f'.
f43622a2
AW
819
820** Garbage collector tuning.
821
822The garbage collector has now been tuned to run more often under some
823circumstances.
824
825*** Unmanaged allocation
826
827The new `scm_gc_register_allocation' function will notify the collector
828of unmanaged allocation. This will cause the collector to run sooner.
829Guile's `scm_malloc', `scm_calloc', and `scm_realloc' unmanaged
830allocators eventually call this function. This leads to better
831performance under steady-state unmanaged allocation.
832
833*** Transient allocation
834
835When the collector runs, it will try to record the total memory
836footprint of a process, if the platform supports this information. If
837the memory footprint is growing, the collector will run more frequently.
838This reduces the increase of the resident size of a process in response
839to a transient increase in allocation.
840
841*** Management of threads, bignums
842
843Creating a thread will allocate a fair amount of memory. Guile now does
844some GC work (using `GC_collect_a_little') when allocating a thread.
845This leads to a better memory footprint when creating many short-lived
846threads.
847
848Similarly, bignums can occupy a lot of memory. Guile now offers hooks
849to enable custom GMP allocators that end up calling
486bd70d 850`scm_gc_register_allocation'. These allocators are enabled by default
f43622a2
AW
851when running Guile from the command-line. To enable them in libraries,
852set the `scm_install_gmp_memory_functions' variable to a nonzero value
853before loading Guile.
854
f43622a2
AW
855** SRFI-39 parameters are available by default.
856
f41ef416
AW
857Guile now includes support for parameters, as defined by SRFI-39, in the
858default environment. See "Parameters" in the manual, for more
859information. `current-input-port', `current-output-port', and
860`current-error-port' are now parameters.
f43622a2 861
d4b5c773 862** Add `current-warning-port'.
f43622a2 863
f41ef416
AW
864Guile now outputs warnings on a separate port, `current-warning-port',
865initialized to the value that `current-error-port' has on startup.
f43622a2 866
f41ef416 867** Syntax parameters.
f43622a2 868
f41ef416
AW
869Following Racket's lead, Guile now supports syntax parameters. See
870"Syntax parameters" in the manual, for more.
f43622a2 871
f41ef416
AW
872Also see Barzilay, Culpepper, and Flatt's 2011 SFP workshop paper,
873"Keeping it Clean with syntax-parameterize".
f43622a2 874
f41ef416 875** Parse command-line arguments from the locale encoding.
f43622a2 876
f41ef416
AW
877Guile now attempts to parse command-line arguments using the user's
878locale. However for backwards compatibility with other 2.0.x releases,
879it does so without actually calling `setlocale'. Please report any bugs
880in this facility to bug-guile@gnu.org.
f43622a2 881
d4b5c773
AW
882** One-armed conditionals: `when' and `unless'
883
884Guile finally has `when' and `unless' in the default environment. Use
885them whenever you would use an `if' with only one branch. See
886"Conditionals" in the manual, for more.
887
888** `current-filename', `add-to-load-path'
889
890There is a new form, `(current-filename)', which expands out to the
891source file in which it occurs. Combined with the new
892`add-to-load-path', this allows simple scripts to easily add nearby
893directories to the load path. See "Load Paths" in the manual, for more.
894
895** `random-state-from-platform'
896
897This procedure initializes a random seed using good random sources
898available on your platform, such as /dev/urandom. See "Random Number
899Generation" in the manual, for more.
900
7cb11224
LC
901** Warn about unsupported `simple-format' options.
902
903The `-Wformat' compilation option now reports unsupported format options
904passed to `simple-format'.
905
241247e8
AW
906** Manual updates
907
908Besides the sections already mentioned, the following manual sections
909are new in this release: "Modules and the File System", "Module System
910Reflection", "Syntax Transformer Helpers", and "Local Inclusion".
911
f41ef416
AW
912* New interfaces
913
914** (ice-9 session): `apropos-hook'
915** New print option: `escape-newlines', defaults to #t.
916** (ice-9 ftw): `file-system-fold', `file-system-tree', `scandir'
d4b5c773 917** `scm_c_value_ref': access to multiple returned values from C
07c2ca0f 918** scm_call (a varargs version), scm_call_7, scm_call_8, scm_call_9
d4b5c773
AW
919** Some new syntax helpers in (system syntax)
920
921Search the manual for these identifiers and modules, for more.
922
923* Build fixes
924
925** FreeBSD build fixes.
926** OpenBSD compilation fixes.
927** Solaris 2.10 test suite fixes.
928** IA64 compilation fix.
929** MinGW build fixes.
930** Work around instruction reordering on SPARC and HPPA in the VM.
931** Gnulib updates: added `dirfd', `setenv' modules.
f43622a2 932
f43622a2
AW
933* Bug fixes
934
d4b5c773
AW
935** Add a deprecated alias for $expt.
936** Add an exception printer for `getaddrinfo-error'.
937** Add deprecated shim for `scm_display_error' with stack as first argument.
938** Add warnings for unsupported `simple-format' options.
939** Allow overlapping regions to be passed to `bytevector-copy!'.
d4b5c773
AW
940** Better function prologue disassembly
941** Compiler: fix miscompilation of (values foo ...) in some contexts.
942** Compiler: fix serialization of #nil-terminated lists.
943** Compiler: allow values bound in non-tail let expressions to be collected.
944** Deprecate SCM_ASRTGO.
945** Document invalidity of (begin) as expression; add back-compat shim.
946** Don't leak file descriptors when mmaping objcode.
947** Empty substrings no longer reference the original stringbuf.
948** FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged.
f43622a2 949** FFI: Hold a weak reference to the CIF made by `procedure->pointer'.
f41ef416
AW
950** FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
951** FFI: Properly unpack small integer return values in closure call.
d4b5c773 952** Fix R6RS `fold-left' so the accumulator is the first argument.
d4b5c773
AW
953** Fix bit-set*! bug from 2005.
954** Fix bug in `make-repl' when `lang' is actually a <language>.
955** Fix bugs related to mutation, the null string, and shared substrings.
956** Fix <dynwind> serialization.
957** Fix erroneous check in `set-procedure-properties!'.
958** Fix generalized-vector-{ref,set!} for slices.
40e92f09 959** Fix error messages involving definition forms.
adb8054c 960** Fix primitive-eval to return #<unspecified> for definitions.
f41ef416 961** HTTP: Extend handling of "Cache-Control" header.
f43622a2 962** HTTP: Fix qstring writing of cache-extension values
d4b5c773 963** HTTP: Fix validators for various list-style headers.
f41ef416 964** HTTP: Permit non-date values for Expires header.
d4b5c773
AW
965** HTTP: `write-request-line' writes absolute paths, not absolute URIs.
966** Hack the port-column of current-output-port after printing a prompt.
d4b5c773
AW
967** Make sure `regexp-quote' tests use Unicode-capable string ports.
968** Peval: Fix bugs in the new optimizer.
d4b5c773
AW
969** Statistically unique marks and labels, for robust hygiene across sessions.
970** Web: Allow URIs with empty authorities, like "file:///etc/hosts".
971** `,language' at REPL sets the current-language fluid.
972** `primitive-load' returns the value(s) of the last expression.
f41ef416 973** `scm_from_stringn' always returns unique strings.
f41ef416 974** `scm_i_substring_copy' tries to narrow the substring.
d4b5c773 975** i18n: Fix gc_malloc/free mismatch on non-GNU systems.
f43622a2 976
7cb11224 977\f
02f91898
AW
978Changes in 2.0.3 (since 2.0.2):
979
980* Speed improvements
981
982** Guile has a new optimizer, `peval'.
983
984`Peval' is a partial evaluator that performs constant folding, dead code
985elimination, copy propagation, and inlining. By default it runs on
986every piece of code that Guile compiles, to fold computations that can
987happen at compile-time, so they don't have to happen at runtime.
988
989If we did our job right, the only impact you would see would be your
990programs getting faster. But if you notice slowdowns or bloated code,
991please send a mail to bug-guile@gnu.org with details.
992
993Thanks to William R. Cook, Oscar Waddell, and Kent Dybvig for inspiring
994peval and its implementation.
995
996You can see what peval does on a given piece of code by running the new
997`,optimize' REPL meta-command, and comparing it to the output of
998`,expand'. See "Compile Commands" in the manual, for more.
999
1000** Fewer calls to `stat'.
1001
1002Guile now stats only the .go file and the .scm file when loading a fresh
1003compiled file.
1004
1005* Notable changes
1006
1007** New module: `(web client)', a simple synchronous web client.
1008
1009See "Web Client" in the manual, for more.
1010
1011** Users can now install compiled `.go' files.
1012
1013See "Installing Site Packages" in the manual.
1014
1015** Remove Front-Cover and Back-Cover text from the manual.
1016
1017The manual is still under the GNU Free Documentation License, but no
1018longer has any invariant sections.
1019
1020** More helpful `guild help'.
1021
1022`guild' is Guile's multi-tool, for use in shell scripting. Now it has a
1023nicer interface for querying the set of existing commands, and getting
1024help on those commands. Try it out and see!
1025
1026** New macro: `define-syntax-rule'
1027
1028`define-syntax-rule' is a shorthand to make a `syntax-rules' macro with
1029one clause. See "Syntax Rules" in the manual, for more.
1030
1031** The `,time' REPL meta-command now has more precision.
1032
1033The output of this command now has microsecond precision, instead of
103410-millisecond precision.
1035
1036** `(ice-9 match)' can now match records.
1037
1038See "Pattern Matching" in the manual, for more on matching records.
1039
1040** New module: `(language tree-il debug)'.
1041
1042This module provides a tree-il verifier. This is useful for people that
1043generate tree-il, usually as part of a language compiler.
1044
1045** New functions: `scm_is_exact', `scm_is_inexact'.
1046
1047These provide a nice C interface for Scheme's `exact?' and `inexact?',
1048respectively.
1049
1050* Bugs fixed
1051
1052See the git log (or the ChangeLog) for more details on these bugs.
1053
1054** Fix order of importing modules and resolving duplicates handlers.
1055** Fix a number of bugs involving extended (merged) generics.
1056** Fix invocation of merge-generics duplicate handler.
1057** Fix write beyond array end in arrays.c.
1058** Fix read beyond end of hashtable size array in hashtab.c.
1059** (web http): Locale-independent parsing and serialization of dates.
1060** Ensure presence of Host header in HTTP/1.1 requests.
1061** Fix take-right and drop-right for improper lists.
1062** Fix leak in get_current_locale().
1063** Fix recursive define-inlinable expansions.
1064** Check that srfi-1 procedure arguments are procedures.
1065** Fix r6rs `map' for multiple returns.
1066** Fix scm_tmpfile leak on POSIX platforms.
1067** Fix a couple of leaks (objcode->bytecode, make-boot-program).
1068** Fix guile-lib back-compatibility for module-stexi-documentation.
1069** Fix --listen option to allow other ports.
1070** Fix scm_to_latin1_stringn for substrings.
1071** Fix compilation of untyped arrays of rank not 1.
1072** Fix unparse-tree-il of <dynset>.
1073** Fix reading of #||||#.
2be3feb1
LC
1074** Fix segfault in GOOPS when class fields are redefined.
1075** Prefer poll(2) over select(2) to allow file descriptors above FD_SETSIZE.
02f91898
AW
1076
1077\f
e4a2807e
AW
1078Changes in 2.0.2 (since 2.0.1):
1079
1080* Notable changes
1081
2dd49486
AW
1082** `guile-tools' renamed to `guild'
1083
1084The new name is shorter. Its intended future use is for a CPAN-like
1085system for Guile wizards and journeyfolk to band together to share code;
1086hence the name. `guile-tools' is provided as a backward-compatible
1087symbolic link. See "Using Guile Tools" in the manual, for more.
1088
e4a2807e
AW
1089** New control operators: `shift' and `reset'
1090
1091See "Shift and Reset" in the manual, for more information.
1092
1093** `while' as an expression
1094
1095Previously the return value of `while' was unspecified. Now its
1096values are specified both in the case of normal termination, and via
1097termination by invoking `break', possibly with arguments. See "while
1098do" in the manual for more.
1099
1100** Disallow access to handles of weak hash tables
1101
1102`hash-get-handle' and `hash-create-handle!' are no longer permitted to
1103be called on weak hash tables, because the fields in a weak handle could
1104be nulled out by the garbage collector at any time, but yet they are
1105otherwise indistinguishable from pairs. Use `hash-ref' and `hash-set!'
1106instead.
1107
1108** More precision for `get-internal-run-time', `get-internal-real-time'
1109
1110On 64-bit systems which support POSIX clocks, Guile's internal timing
1111procedures offer nanosecond resolution instead of the 10-millisecond
1112resolution previously available. 32-bit systems now use 1-millisecond
1113timers.
1114
1115** Guile now measures time spent in GC
1116
1117`gc-stats' now returns a meaningful value for `gc-time-taken'.
1118
1119** Add `gcprof'
1120
1121The statprof profiler now exports a `gcprof' procedure, driven by the
1122`after-gc-hook', to see which parts of your program are causing GC. Let
1123us know if you find it useful.
1124
1125** `map', `for-each' and some others now implemented in Scheme
1126
1127We would not mention this in NEWS, as it is not a user-visible change,
1128if it were not for one thing: `map' and `for-each' are no longer
1129primitive generics. Instead they are normal bindings, which can be
1130wrapped by normal generics. This fixes some modularity issues between
1131core `map', SRFI-1 `map', and GOOPS.
1132
1133Also it's pretty cool that we can do this without a performance impact.
1134
1135** Add `scm_peek_byte_or_eof'.
1136
1137This helper is like `scm_peek_char_or_eof', but for bytes instead of
1138full characters.
1139
1140** Implement #:stop-at-first-non-option option for getopt-long
1141
1142See "getopt-long Reference" in the manual, for more information.
1143
1144** Improve R6RS conformance for conditions in the I/O libraries
1145
1146The `(rnrs io simple)' module now raises the correct R6RS conditions in
1147error cases. `(rnrs io ports)' is also more correct now, though it is
1148still a work in progress.
1149
1150** All deprecated routines emit warnings
1151
1152A few deprecated routines were lacking deprecation warnings. This has
1153been fixed now.
1154
1155* Speed improvements
1156
1157** Constants in compiled code now share state better
1158
1159Constants with shared state, like `("foo")' and `"foo"', now share state
1160as much as possible, in the entire compilation unit. This cuts compiled
1161`.go' file sizes in half, generally, and speeds startup.
1162
1163** VLists: optimize `vlist-fold-right', and add `vhash-fold-right'
1164
1165These procedures are now twice as fast as they were.
1166
1167** UTF-8 ports to bypass `iconv' entirely
1168
1169This reduces memory usage in a very common case.
1170
1171** Compiler speedups
1172
1173The compiler is now about 40% faster. (Note that this is only the case
1174once the compiler is itself compiled, so the build still takes as long
1175as it did before.)
1176
1177** VM speed tuning
1178
1179Some assertions that were mostly useful for sanity-checks on the
1180bytecode compiler are now off for both "regular" and "debug" engines.
1181This together with a fix to cache a TLS access and some other tweaks
1182improve the VM's performance by about 20%.
1183
1184** SRFI-1 list-set optimizations
1185
1186lset-adjoin and lset-union now have fast paths for eq? sets.
1187
1188** `memq', `memv' optimizations
1189
1190These procedures are now at least twice as fast than in 2.0.1.
1191
1192* Deprecations
1193
1194** Deprecate scm_whash API
1195
1196`scm_whash_get_handle', `SCM_WHASHFOUNDP', `SCM_WHASHREF',
1197`SCM_WHASHSET', `scm_whash_create_handle', `scm_whash_lookup', and
1198`scm_whash_insert' are now deprecated. Use the normal hash table API
1199instead.
1200
1201** Deprecate scm_struct_table
1202
1203`SCM_STRUCT_TABLE_NAME', `SCM_SET_STRUCT_TABLE_NAME',
1204`SCM_STRUCT_TABLE_CLASS', `SCM_SET_STRUCT_TABLE_CLASS',
1205`scm_struct_table', and `scm_struct_create_handle' are now deprecated.
1206These routines formed part of the internals of the map between structs
1207and classes.
1208
1209** Deprecate scm_internal_dynamic_wind
1210
1211The `scm_t_inner' type and `scm_internal_dynamic_wind' are deprecated,
1212as the `scm_dynwind' API is better, and this API encourages users to
1213stuff SCM values into pointers.
1214
1215** Deprecate scm_immutable_cell, scm_immutable_double_cell
1216
1217These routines are deprecated, as the GC_STUBBORN API doesn't do
1218anything any more.
1219
1220* Manual updates
1221
1222Andreas Rottman kindly transcribed the missing parts of the `(rnrs io
1223ports)' documentation from the R6RS documentation. Thanks Andreas!
1224
1225* Bugs fixed
1226
1227** Fix double-loading of script in -ds case
1228** -x error message fix
1229** iconveh-related cross-compilation fixes
1230** Fix small integer return value packing on big endian machines.
1231** Fix hash-set! in weak-value table from non-immediate to immediate
1232** Fix call-with-input-file & relatives for multiple values
1233** Fix `hash' for inf and nan
1234** Fix libguile internal type errors caught by typing-strictness==2
f39779b1
LC
1235** Fix compile error in MinGW fstat socket detection
1236** Fix generation of auto-compiled file names on MinGW
e4a2807e
AW
1237** Fix multithreaded access to internal hash tables
1238** Emit a 1-based line number in error messages
1239** Fix define-module ordering
7505c6e0 1240** Fix several POSIX functions to use the locale encoding
f39779b1
LC
1241** Add type and range checks to the complex generalized vector accessors
1242** Fix unaligned accesses for bytevectors of complex numbers
1243** Fix '(a #{.} b)
1244** Fix erroneous VM stack overflow for canceled threads
e4a2807e
AW
1245
1246\f
882c8963
MW
1247Changes in 2.0.1 (since 2.0.0):
1248
7c81eba2 1249* Notable changes
9d6a151f 1250
7c81eba2 1251** guile.m4 supports linking with rpath
9d6a151f 1252
7c81eba2
AW
1253The GUILE_FLAGS macro now sets GUILE_LIBS and GUILE_LTLIBS, which
1254include appropriate directives to the linker to include libguile-2.0.so
1255in the runtime library lookup path.
9d6a151f 1256
7c81eba2 1257** `begin' expands macros in its body before other expressions
9d6a151f 1258
7c81eba2 1259This enables support for programs like the following:
9d6a151f 1260
7c81eba2
AW
1261 (begin
1262 (define even?
1263 (lambda (x)
1264 (or (= x 0) (odd? (- x 1)))))
1265 (define-syntax odd?
1266 (syntax-rules ()
1267 ((odd? x) (not (even? x)))))
1268 (even? 10))
9d6a151f 1269
7c81eba2 1270** REPL reader usability enhancements
9d6a151f 1271
7c81eba2
AW
1272The REPL now flushes input after a read error, which should prevent one
1273error from causing other errors. The REPL also now interprets comments
1274as whitespace.
9d6a151f 1275
7c81eba2 1276** REPL output has configurable width
9d6a151f 1277
7c81eba2
AW
1278The REPL now defaults to output with the current terminal's width, in
1279columns. See "Debug Commands" in the manual for more information on
1280the ,width command.
9d6a151f 1281
7c81eba2 1282** Better C access to the module system
9d6a151f 1283
7c81eba2
AW
1284Guile now has convenient C accessors to look up variables or values in
1285modules and their public interfaces. See `scm_c_public_ref' and friends
1286in "Accessing Modules from C" in the manual.
9d6a151f 1287
7c81eba2 1288** Added `scm_call_5', `scm_call_6'
9d6a151f 1289
7c81eba2 1290See "Fly Evaluation" in the manual.
9d6a151f 1291
7c81eba2 1292** Added `scm_from_latin1_keyword', `scm_from_utf8_keyword'
9d6a151f 1293
7c81eba2
AW
1294See "Keyword Procedures" in the manual, for more. Note that
1295`scm_from_locale_keyword' should not be used when the name is a C string
1296constant.
9d6a151f 1297
7c81eba2 1298** R6RS unicode and string I/O work
9d6a151f 1299
7c81eba2
AW
1300Added efficient implementations of `get-string-n' and `get-string-n!'
1301for binary ports. Exported `current-input-port', `current-output-port'
1302and `current-error-port' from `(rnrs io ports)', and enhanced support
1303for transcoders.
9d6a151f 1304
7c81eba2 1305** Added `pointer->scm', `scm->pointer' to `(system foreign)'
9d6a151f 1306
7c81eba2
AW
1307These procedure are useful if one needs to pass and receive SCM values
1308to and from foreign functions. See "Foreign Variables" in the manual,
1309for more.
9d6a151f 1310
7c81eba2 1311** Added `heap-allocated-since-gc' to `(gc-stats)'
9d6a151f 1312
7c81eba2 1313Also fixed the long-standing bug in the REPL `,stat' command.
9d6a151f 1314
7c81eba2 1315** Add `on-error' REPL option
9d6a151f 1316
7c81eba2
AW
1317This option controls what happens when an error occurs at the REPL, and
1318defaults to `debug', indicating that Guile should enter the debugger.
1319Other values include `report', which will simply print a backtrace
1320without entering the debugger. See "System Commands" in the manual.
9d6a151f 1321
7c81eba2 1322** Enforce immutability of string literals
9d6a151f 1323
7c81eba2 1324Attempting to mutate a string literal now causes a runtime error.
9d6a151f 1325
7c81eba2 1326** Fix pthread redirection
9d6a151f 1327
7c81eba2
AW
1328Guile 2.0.0 shipped with headers that, if configured with pthread
1329support, would re-define `pthread_create', `pthread_join', and other API
1330to redirect to the BDW-GC wrappers, `GC_pthread_create', etc. This was
1331unintended, and not necessary: because threads must enter Guile with
2e6829d2 1332`scm_with_guile', Guile can handle thread registration itself, without
7c81eba2
AW
1333needing to make the GC aware of all threads. This oversight has been
1334fixed.
9d6a151f 1335
7c81eba2 1336** `with-continuation-barrier' now unwinds on `quit'
9d6a151f 1337
7c81eba2
AW
1338A throw to `quit' in a continuation barrier will cause Guile to exit.
1339Before, it would do so before unwinding to the barrier, which would
1340prevent cleanup handlers from running. This has been fixed so that it
1341exits only after unwinding.
9d6a151f 1342
7c81eba2 1343** `string->pointer' and `pointer->string' have optional encoding arg
9d6a151f 1344
7c81eba2
AW
1345This allows users of the FFI to more easily deal in strings with
1346particular (non-locale) encodings, like "utf-8". See "Void Pointers and
1347Byte Access" in the manual, for more.
9d6a151f 1348
7c81eba2 1349** R6RS fixnum arithmetic optimizations
9d6a151f 1350
7c81eba2
AW
1351R6RS fixnum operations are are still slower than generic arithmetic,
1352however.
9d6a151f 1353
7c81eba2 1354** New procedure: `define-inlinable'
9d6a151f 1355
7c81eba2 1356See "Inlinable Procedures" in the manual, for more.
9d6a151f 1357
7c81eba2 1358** New procedure: `exact-integer-sqrt'
9d6a151f 1359
7c81eba2 1360See "Integer Operations" in the manual, for more.
9d6a151f 1361
7c81eba2 1362** "Extended read syntax" for symbols parses better
9d6a151f 1363
7c81eba2
AW
1364In #{foo}# symbols, backslashes are now treated as escapes, as the
1365symbol-printing code intended. Additionally, "\x" within #{foo}# is now
1366interpreted as starting an R6RS hex escape. This is backward compatible
1367because the symbol printer would never produce a "\x" before. The
1368printer also works better too.
9d6a151f 1369
6b480ced 1370** Added `--fresh-auto-compile' option
1e56cff2
AW
1371
1372This allows a user to invalidate the auto-compilation cache. It's
1373usually not needed. See "Compilation" in the manual, for a discussion.
1374
7c81eba2 1375* Manual updates
9d6a151f 1376
7c81eba2 1377** GOOPS documentation updates
9d6a151f 1378
7c81eba2 1379** New man page
9d6a151f 1380
7c81eba2 1381Thanks to Mark Harig for improvements to guile.1.
9d6a151f 1382
7c81eba2 1383** SRFI-23 documented
9d6a151f 1384
7c81eba2 1385The humble `error' SRFI now has an entry in the manual.
9d6a151f 1386
7c81eba2 1387* New modules
9d6a151f 1388
de424d95 1389** `(ice-9 binary-ports)': "R6RS I/O Ports", in the manual
7c81eba2 1390** `(ice-9 eval-string)': "Fly Evaluation", in the manual
2e6829d2 1391** `(ice-9 command-line)', not documented yet
9d6a151f 1392
882c8963
MW
1393* Bugs fixed
1394
2e6829d2 1395** Fixed `iconv_t' memory leak on close-port
7c81eba2
AW
1396** Fixed some leaks with weak hash tables
1397** Export `vhash-delq' and `vhash-delv' from `(ice-9 vlist)'
1398** `after-gc-hook' works again
1399** `define-record-type' now allowed in nested contexts
1400** `exact-integer-sqrt' now handles large integers correctly
1401** Fixed C extension examples in manual
1402** `vhash-delete' honors HASH argument
1403** Make `locale-digit-grouping' more robust
1404** Default exception printer robustness fixes
1405** Fix presence of non-I CPPFLAGS in `guile-2.0.pc'
1406** `read' updates line/column numbers when reading SCSH block comments
1407** Fix imports of multiple custom interfaces of same module
1408** Fix encoding scanning for non-seekable ports
1409** Fix `setter' when called with a non-setter generic
1410** Fix f32 and f64 bytevectors to not accept rationals
1411** Fix description of the R6RS `finite?' in manual
1412** Quotient, remainder and modulo accept inexact integers again
1413** Fix `continue' within `while' to take zero arguments
1414** Fix alignment for structures in FFI
1415** Fix port-filename of stdin, stdout, stderr to match the docs
1416** Fix weak hash table-related bug in `define-wrapped-pointer-type'
1417** Fix partial continuation application with pending procedure calls
1418** scm_{to,from}_locale_string use current locale, not current ports
1419** Fix thread cleanup, by using a pthread_key destructor
1420** Fix `quit' at the REPL
1421** Fix a failure to sync regs in vm bytevector ops
1422** Fix (texinfo reflection) to handle nested structures like syntax patterns
1423** Fix stexi->html double translation
1424** Fix tree-il->scheme fix for <prompt>
1425** Fix compilation of <prompt> in <fix> in single-value context
1426** Fix race condition in ensure-writable-dir
1427** Fix error message on ,disassemble "non-procedure"
1428** Fix prompt and abort with the boot evaluator
1429** Fix `procedure->pointer' for functions returning `void'
1430** Fix error reporting in dynamic-pointer
1431** Fix problems detecting coding: in block comments
1432** Fix duplicate load-path and load-compiled-path in compilation environment
1433** Add fallback read(2) suppport for .go files if mmap(2) unavailable
1434** Fix c32vector-set!, c64vector-set!
1435** Fix mistakenly deprecated read syntax for uniform complex vectors
1436** Fix parsing of exact numbers with negative exponents
1437** Ignore SIGPIPE in (system repl server)
1438** Fix optional second arg to R6RS log function
1439** Fix R6RS `assert' to return true value.
1440** Fix fencepost error when seeking in bytevector input ports
2e6829d2
LC
1441** Gracefully handle `setlocale' errors when starting the REPL
1442** Improve support of the `--disable-posix' configure option
1443** Make sure R6RS binary ports pass `binary-port?' regardless of the locale
1444** Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'
882c8963 1445
882c8963
MW
1446
1447\f
d9f46472 1448Changes in 2.0.0 (changes since the 1.8.x series):
96b73e84
AW
1449
1450* New modules (see the manual for details)
1451
1452** `(srfi srfi-18)', more sophisticated multithreading support
ef6b0e8d 1453** `(srfi srfi-27)', sources of random bits
7cd99cba 1454** `(srfi srfi-38)', External Representation for Data With Shared Structure
ef6b0e8d
AW
1455** `(srfi srfi-42)', eager comprehensions
1456** `(srfi srfi-45)', primitives for expressing iterative lazy algorithms
1457** `(srfi srfi-67)', compare procedures
96b73e84 1458** `(ice-9 i18n)', internationalization support
7cd99cba 1459** `(ice-9 futures)', fine-grain parallelism
0f13fcde 1460** `(rnrs bytevectors)', the R6RS bytevector API
93617170 1461** `(rnrs io ports)', a subset of the R6RS I/O port API
96b73e84 1462** `(system xref)', a cross-referencing facility (FIXME undocumented)
dbd9532e 1463** `(ice-9 vlist)', lists with constant-time random access; hash lists
fb53c347 1464** `(system foreign)', foreign function interface
18e90860
AW
1465** `(sxml match)', a pattern matcher for SXML
1466** `(srfi srfi-9 gnu)', extensions to the SRFI-9 record library
1467** `(system vm coverage)', a line-by-line code coverage library
7cd99cba
AW
1468** `(web uri)', URI data type, parser, and unparser
1469** `(web http)', HTTP header parsers and unparsers
1470** `(web request)', HTTP request data type, reader, and writer
1471** `(web response)', HTTP response data type, reader, and writer
1472** `(web server)', Generic HTTP server
1473** `(ice-9 poll)', a poll wrapper
1474** `(web server http)', HTTP-over-TCP web server implementation
66ad445d 1475
51cb0cca
AW
1476** Replaced `(ice-9 match)' with Alex Shinn's compatible, hygienic matcher.
1477
1478Guile's copy of Andrew K. Wright's `match' library has been replaced by
1479a compatible hygienic implementation by Alex Shinn. It is now
1480documented, see "Pattern Matching" in the manual.
1481
1482Compared to Andrew K. Wright's `match', the new `match' lacks
1483`match-define', `match:error-control', `match:set-error-control',
1484`match:error', `match:set-error', and all structure-related procedures.
1485
cf8ec359
AW
1486** Imported statprof, SSAX, and texinfo modules from Guile-Lib
1487
1488The statprof statistical profiler, the SSAX XML toolkit, and the texinfo
1489toolkit from Guile-Lib have been imported into Guile proper. See
1490"Standard Library" in the manual for more details.
1491
139fa149
AW
1492** Integration of lalr-scm, a parser generator
1493
1494Guile has included Dominique Boucher's fine `lalr-scm' parser generator
1495as `(system base lalr)'. See "LALR(1) Parsing" in the manual, for more
1496information.
1497
96b73e84
AW
1498* Changes to the stand-alone interpreter
1499
1500** Guile now can compile Scheme to bytecode for a custom virtual machine.
1501
1502Compiled code loads much faster than Scheme source code, and runs around
15033 or 4 times as fast, generating much less garbage in the process.
fa1804e9 1504
29b98fb2 1505** Evaluating Scheme code does not use the C stack.
fa1804e9 1506
29b98fb2
AW
1507Besides when compiling Guile itself, Guile no longer uses a recursive C
1508function as an evaluator. This obviates the need to check the C stack
1509pointer for overflow. Continuations still capture the C stack, however.
fa1804e9 1510
96b73e84
AW
1511** New environment variables: GUILE_LOAD_COMPILED_PATH,
1512 GUILE_SYSTEM_LOAD_COMPILED_PATH
fa1804e9 1513
96b73e84
AW
1514GUILE_LOAD_COMPILED_PATH is for compiled files what GUILE_LOAD_PATH is
1515for source files. It is a different path, however, because compiled
1516files are architecture-specific. GUILE_SYSTEM_LOAD_COMPILED_PATH is like
1517GUILE_SYSTEM_PATH.
1518
1519** New read-eval-print loop (REPL) implementation
1520
51cb0cca
AW
1521Running Guile with no arguments drops the user into the new REPL. See
1522"Using Guile Interactively" in the manual, for more information.
96b73e84 1523
51cb0cca
AW
1524** Remove old Emacs interface
1525
1526Guile had an unused `--emacs' command line argument that was supposed to
1527help when running Guile inside Emacs. This option has been removed, and
1528the helper functions `named-module-use!' and `load-emacs-interface' have
1529been deprecated.
1530
ef6b0e8d
AW
1531** Add `(system repl server)' module and `--listen' command-line argument
1532
1533The `(system repl server)' module exposes procedures to listen on
1534sockets for connections, and serve REPLs to those clients. The --listen
1535command-line argument allows any Guile program to thus be remotely
1536debuggable.
1537
1538See "Invoking Guile" for more information on `--listen'.
1539
7cd99cba
AW
1540** Command line additions
1541
1542The guile binary now supports a new switch "-x", which can be used to
1543extend the list of filename extensions tried when loading files
1544(%load-extensions).
1545
487bacf4
AW
1546** New reader options: `square-brackets', `r6rs-hex-escapes',
1547 `hungry-eol-escapes'
6bf927ab
LC
1548
1549The reader supports a new option (changeable via `read-options'),
1550`square-brackets', which instructs it to interpret square brackets as
29b98fb2 1551parentheses. This option is on by default.
6bf927ab
LC
1552
1553When the new `r6rs-hex-escapes' reader option is enabled, the reader
51cb0cca
AW
1554will recognize string escape sequences as defined in R6RS. R6RS string
1555escape sequences are incompatible with Guile's existing escapes, though,
1556so this option is off by default.
6bf927ab 1557
487bacf4
AW
1558Additionally, Guile follows the R6RS newline escaping rules when the
1559`hungry-eol-escapes' option is enabled.
1560
1561See "String Syntax" in the manual, for more information.
1562
cf8ec359
AW
1563** Function profiling and tracing at the REPL
1564
1565The `,profile FORM' REPL meta-command can now be used to statistically
1566profile execution of a form, to see which functions are taking the most
1567time. See `,help profile' for more information.
1568
1569Similarly, `,trace FORM' traces all function applications that occur
1570during the execution of `FORM'. See `,help trace' for more information.
1571
51cb0cca
AW
1572** Recursive debugging REPL on error
1573
1574When Guile sees an error at the REPL, instead of saving the stack, Guile
1575will directly enter a recursive REPL in the dynamic context of the
1576error. See "Error Handling" in the manual, for more information.
1577
1578A recursive REPL is the same as any other REPL, except that it
1579has been augmented with debugging information, so that one can inspect
1580the context of the error. The debugger has been integrated with the REPL
1581via a set of debugging meta-commands.
cf8ec359 1582
51cb0cca
AW
1583For example, one may access a backtrace with `,backtrace' (or
1584`,bt'). See "Interactive Debugging" in the manual, for more
1585information.
cf8ec359 1586
96b73e84
AW
1587** New `guile-tools' commands: `compile', `disassemble'
1588
93617170 1589Pass the `--help' command-line option to these commands for more
96b73e84
AW
1590information.
1591
b0217d17
AW
1592** Guile now adds its install prefix to the LTDL_LIBRARY_PATH
1593
1594Users may now install Guile to nonstandard prefixes and just run
1595`/path/to/bin/guile', instead of also having to set LTDL_LIBRARY_PATH to
1596include `/path/to/lib'.
1597
1598** Guile's Emacs integration is now more keyboard-friendly
1599
1600Backtraces may now be disclosed with the keyboard in addition to the
1601mouse.
1602
cf8ec359
AW
1603** Load path change: search in version-specific paths before site paths
1604
1605When looking for a module, Guile now searches first in Guile's
1606version-specific path (the library path), *then* in the site dir. This
1607allows Guile's copy of SSAX to override any Guile-Lib copy the user has
1608installed. Also it should cut the number of `stat' system calls by half,
1609in the common case.
1610
51cb0cca
AW
1611** Value history in the REPL on by default
1612
1613By default, the REPL will save computed values in variables like `$1',
1614`$2', and the like. There are programmatic and interactive interfaces to
1615control this. See "Value History" in the manual, for more information.
1616
1617** Readline tab completion for arguments
1618
1619When readline is enabled, tab completion works for arguments too, not
1620just for the operator position.
1621
7cd99cba
AW
1622** Expression-oriented readline history
1623
1624Guile's readline history now tries to operate on expressions instead of
1625input lines. Let us know what you think!
1626
139fa149
AW
1627** Interactive Guile follows GNU conventions
1628
1629As recommended by the GPL, Guile now shows a brief copyright and
1630warranty disclaimer on startup, along with pointers to more information.
cf8ec359 1631
96b73e84
AW
1632* Changes to Scheme functions and syntax
1633
18e90860
AW
1634** Support for R6RS libraries
1635
1636The `library' and `import' forms from the latest Scheme report have been
1637added to Guile, in such a way that R6RS libraries share a namespace with
1638Guile modules. R6RS modules may import Guile modules, and are available
1639for Guile modules to import via use-modules and all the rest. See "R6RS
1640Libraries" in the manual for more information.
1641
1642** Implementations of R6RS libraries
1643
1644Guile now has implementations for all of the libraries defined in the
1645R6RS. Thanks to Julian Graham for this excellent hack. See "R6RS
1646Standard Libraries" in the manual for a full list of libraries.
1647
1648** Partial R6RS compatibility
1649
1650Guile now has enough support for R6RS to run a reasonably large subset
1651of R6RS programs.
1652
1653Guile is not fully R6RS compatible. Many incompatibilities are simply
1654bugs, though some parts of Guile will remain R6RS-incompatible for the
1655foreseeable future. See "R6RS Incompatibilities" in the manual, for more
1656information.
1657
1658Please contact bug-guile@gnu.org if you have found an issue not
1659mentioned in that compatibility list.
1660
4a457691
AW
1661** New implementation of `primitive-eval'
1662
1663Guile's `primitive-eval' is now implemented in Scheme. Actually there is
1664still a C evaluator, used when building a fresh Guile to interpret the
1665compiler, so we can compile eval.scm. Thereafter all calls to
1666primitive-eval are implemented by VM-compiled code.
1667
1668This allows all of Guile's procedures, be they interpreted or compiled,
1669to execute on the same stack, unifying multiple-value return semantics,
1670providing for proper tail recursion between interpreted and compiled
1671code, and simplifying debugging.
1672
1673As part of this change, the evaluator no longer mutates the internal
1674representation of the code being evaluated in a thread-unsafe manner.
1675
1676There are two negative aspects of this change, however. First, Guile
1677takes a lot longer to compile now. Also, there is less debugging
1678information available for debugging interpreted code. We hope to improve
1679both of these situations.
1680
1681There are many changes to the internal C evalator interface, but all
1682public interfaces should be the same. See the ChangeLog for details. If
1683we have inadvertantly changed an interface that you were using, please
1684contact bug-guile@gnu.org.
1685
96b73e84
AW
1686** Procedure removed: `the-environment'
1687
1688This procedure was part of the interpreter's execution model, and does
1689not apply to the compiler.
fa1804e9 1690
4a457691
AW
1691** No more `local-eval'
1692
1693`local-eval' used to exist so that one could evaluate code in the
1694lexical context of a function. Since there is no way to get the lexical
1695environment any more, as that concept has no meaning for the compiler,
1696and a different meaning for the interpreter, we have removed the
1697function.
1698
1699If you think you need `local-eval', you should probably implement your
1700own metacircular evaluator. It will probably be as fast as Guile's
1701anyway.
1702
139fa149 1703** Scheme source files will now be compiled automatically.
fa1804e9
AW
1704
1705If a compiled .go file corresponding to a .scm file is not found or is
1706not fresh, the .scm file will be compiled on the fly, and the resulting
1707.go file stored away. An advisory note will be printed on the console.
1708
51cb0cca
AW
1709Note that this mechanism depends on the timestamp of the .go file being
1710newer than that of the .scm file; if the .scm or .go files are moved
1711after installation, care should be taken to preserve their original
fa1804e9
AW
1712timestamps.
1713
6f06e8d3 1714Auto-compiled files will be stored in the $XDG_CACHE_HOME/guile/ccache
19fef497
AW
1715directory, where $XDG_CACHE_HOME defaults to ~/.cache. This directory
1716will be created if needed.
fa1804e9 1717
6f06e8d3
AW
1718To inhibit automatic compilation, set the GUILE_AUTO_COMPILE environment
1719variable to 0, or pass --no-auto-compile on the Guile command line.
fa1804e9 1720
96b73e84 1721** New POSIX procedures: `getrlimit' and `setrlimit'
fa1804e9 1722
96b73e84
AW
1723Note however that the interface of these functions is likely to change
1724in the next prerelease.
fa1804e9 1725
4a457691
AW
1726** New POSIX procedure: `getsid'
1727
1728Scheme binding for the `getsid' C library call.
1729
dbd9532e
LC
1730** New POSIX procedure: `getaddrinfo'
1731
1732Scheme binding for the `getaddrinfo' C library function.
1733
7cd99cba
AW
1734** Multicast socket options
1735
1736Support was added for the IP_MULTICAST_TTL and IP_MULTICAST_IF socket
1737options. See "Network Sockets and Communication" in the manual, for
1738more information.
1739
487bacf4
AW
1740** `recv!', `recvfrom!', `send', `sendto' now deal in bytevectors
1741
1742These socket procedures now take bytevectors as arguments, instead of
1743strings. There is some deprecated string support, however.
1744
7cd99cba
AW
1745** New GNU procedures: `setaffinity' and `getaffinity'.
1746
1747See "Processes" in the manual, for more information.
1748
1749** New procedures: `compose', `negate', and `const'
1750
1751See "Higher-Order Functions" in the manual, for more information.
1752
96b73e84 1753** New procedure in `(oops goops)': `method-formals'
fa1804e9 1754
96b73e84
AW
1755** New procedures in (ice-9 session): `add-value-help-handler!',
1756 `remove-value-help-handler!', `add-name-help-handler!'
29b98fb2 1757 `remove-name-help-handler!', `procedure-arguments'
fa1804e9 1758
96b73e84
AW
1759The value and name help handlers provide some minimal extensibility to
1760the help interface. Guile-lib's `(texinfo reflection)' uses them, for
1761example, to make stexinfo help documentation available. See those
1762procedures' docstrings for more information.
1763
1764`procedure-arguments' describes the arguments that a procedure can take,
1765combining arity and formals. For example:
1766
1767 (procedure-arguments resolve-interface)
1768 => ((required . (name)) (rest . args))
fa1804e9 1769
96b73e84
AW
1770Additionally, `module-commentary' is now publically exported from
1771`(ice-9 session).
1772
cf8ec359 1773** Removed: `procedure->memoizing-macro', `procedure->syntax'
96b73e84 1774
cf8ec359
AW
1775These procedures created primitive fexprs for the old evaluator, and are
1776no longer supported. If you feel that you need these functions, you
1777probably need to write your own metacircular evaluator (which will
1778probably be as fast as Guile's, anyway).
96b73e84
AW
1779
1780** New language: ECMAScript
1781
1782Guile now ships with one other high-level language supported,
1783ECMAScript. The goal is to support all of version 3.1 of the standard,
1784but not all of the libraries are there yet. This support is not yet
1785documented; ask on the mailing list if you are interested.
1786
19fef497
AW
1787** New language: Brainfuck
1788
1789Brainfuck is a toy language that closely models Turing machines. Guile's
1790brainfuck compiler is meant to be an example of implementing other
1791languages. See the manual for details, or
1792http://en.wikipedia.org/wiki/Brainfuck for more information about the
1793Brainfuck language itself.
1794
4a457691
AW
1795** New language: Elisp
1796
1797Guile now has an experimental Emacs Lisp compiler and runtime. You can
1798now switch to Elisp at the repl: `,language elisp'. All kudos to Daniel
7cd99cba 1799Kraft and Brian Templeton, and all bugs to bug-guile@gnu.org.
4a457691 1800
139fa149
AW
1801** Better documentation infrastructure for macros
1802
1803It is now possible to introspect on the type of a macro, e.g.
1804syntax-rules, identifier-syntax, etc, and extract information about that
1805macro, such as the syntax-rules patterns or the defmacro arguments.
1806`(texinfo reflection)' takes advantage of this to give better macro
1807documentation.
1808
139fa149
AW
1809** Support for arbitrary procedure metadata
1810
1811Building on its support for docstrings, Guile now supports multiple
1812docstrings, adding them to the tail of a compiled procedure's
1813properties. For example:
1814
1815 (define (foo)
1816 "one"
1817 "two"
1818 3)
29b98fb2 1819 (procedure-properties foo)
139fa149
AW
1820 => ((name . foo) (documentation . "one") (documentation . "two"))
1821
1822Also, vectors of pairs are now treated as additional metadata entries:
1823
1824 (define (bar)
1825 #((quz . #f) (docstring . "xyzzy"))
1826 3)
29b98fb2 1827 (procedure-properties bar)
139fa149
AW
1828 => ((name . bar) (quz . #f) (docstring . "xyzzy"))
1829
1830This allows arbitrary literals to be embedded as metadata in a compiled
1831procedure.
1832
96b73e84
AW
1833** The psyntax expander now knows how to interpret the @ and @@ special
1834 forms.
1835
1836** The psyntax expander is now hygienic with respect to modules.
1837
1838Free variables in a macro are scoped in the module that the macro was
1839defined in, not in the module the macro is used in. For example, code
1840like this works now:
1841
1842 (define-module (foo) #:export (bar))
1843 (define (helper x) ...)
1844 (define-syntax bar
1845 (syntax-rules () ((_ x) (helper x))))
1846
1847 (define-module (baz) #:use-module (foo))
1848 (bar qux)
1849
1850It used to be you had to export `helper' from `(foo)' as well.
1851Thankfully, this has been fixed.
1852
51cb0cca 1853** Support for version information in Guile's `module' form
cf8ec359 1854
51cb0cca
AW
1855Guile modules now have a `#:version' field. See "R6RS Version
1856References", "General Information about Modules", "Using Guile Modules",
1857and "Creating Guile Modules" in the manual for more information.
96b73e84 1858
cf8ec359
AW
1859** Support for renaming bindings on module export
1860
1861Wherever Guile accepts a symbol as an argument to specify a binding to
1862export, it now also accepts a pair of symbols, indicating that a binding
1863should be renamed on export. See "Creating Guile Modules" in the manual
1864for more information.
96b73e84 1865
18e90860
AW
1866** New procedure: `module-export-all!'
1867
1868This procedure exports all current and future bindings from a module.
1869Use as `(module-export-all! (current-module))'.
1870
7cd99cba
AW
1871** New procedure `reload-module', and `,reload' REPL command
1872
1873See "Module System Reflection" and "Module Commands" in the manual, for
1874more information.
1875
96b73e84
AW
1876** `eval-case' has been deprecated, and replaced by `eval-when'.
1877
29b98fb2
AW
1878The semantics of `eval-when' are easier to understand. See "Eval When"
1879in the manual, for more information.
96b73e84
AW
1880
1881** Guile is now more strict about prohibiting definitions in expression
1882 contexts.
1883
1884Although previous versions of Guile accepted it, the following
1885expression is not valid, in R5RS or R6RS:
1886
1887 (if test (define foo 'bar) (define foo 'baz))
1888
1889In this specific case, it would be better to do:
1890
1891 (define foo (if test 'bar 'baz))
1892
79b3863d
AW
1893It is possible to circumvent this restriction with e.g.
1894`(module-define! (current-module) 'foo 'baz)'. Contact the list if you
1895have any questions.
96b73e84 1896
51cb0cca
AW
1897** Support for `letrec*'
1898
1899Guile now supports `letrec*', a recursive lexical binding operator in
1900which the identifiers are bound in order. See "Local Bindings" in the
1901manual, for more details.
1902
1903** Internal definitions now expand to `letrec*'
1904
1905Following the R6RS, internal definitions now expand to letrec* instead
1906of letrec. The following program is invalid for R5RS, but valid for
1907R6RS:
1908
1909 (define (foo)
1910 (define bar 10)
1911 (define baz (+ bar 20))
1912 baz)
1913
1914 ;; R5RS and Guile <= 1.8:
1915 (foo) => Unbound variable: bar
1916 ;; R6RS and Guile >= 2.0:
1917 (foo) => 30
1918
1919This change should not affect correct R5RS programs, or programs written
1920in earlier Guile dialects.
1921
18e90860
AW
1922** Macro expansion produces structures instead of s-expressions
1923
1924In the olden days, macroexpanding an s-expression would yield another
1925s-expression. Though the lexical variables were renamed, expansions of
1926core forms like `if' and `begin' were still non-hygienic, as they relied
1927on the toplevel definitions of `if' et al being the conventional ones.
1928
1929The solution is to expand to structures instead of s-expressions. There
1930is an `if' structure, a `begin' structure, a `toplevel-ref' structure,
1931etc. The expander already did this for compilation, producing Tree-IL
1932directly; it has been changed now to do so when expanding for the
1933evaluator as well.
1934
96b73e84
AW
1935** Defmacros must now produce valid Scheme expressions.
1936
1937It used to be that defmacros could unquote in Scheme values, as a way of
1938supporting partial evaluation, and avoiding some hygiene issues. For
1939example:
1940
1941 (define (helper x) ...)
1942 (define-macro (foo bar)
1943 `(,helper ,bar))
1944
1945Assuming this macro is in the `(baz)' module, the direct translation of
1946this code would be:
1947
1948 (define (helper x) ...)
1949 (define-macro (foo bar)
1950 `((@@ (baz) helper) ,bar))
1951
1952Of course, one could just use a hygienic macro instead:
1953
1954 (define-syntax foo
1955 (syntax-rules ()
1956 ((_ bar) (helper bar))))
1957
1958** Guile's psyntax now supports docstrings and internal definitions.
1959
1960The following Scheme is not strictly legal:
1961
1962 (define (foo)
1963 "bar"
1964 (define (baz) ...)
1965 (baz))
1966
1967However its intent is fairly clear. Guile interprets "bar" to be the
1968docstring of `foo', and the definition of `baz' is still in definition
1969context.
1970
51cb0cca
AW
1971** Support for settable identifier syntax
1972
1973Following the R6RS, "variable transformers" are settable
1974identifier-syntax. See "Identifier macros" in the manual, for more
1975information.
1976
1977** syntax-case treats `_' as a placeholder
1978
1979Following R6RS, a `_' in a syntax-rules or syntax-case pattern matches
1980anything, and binds no pattern variables. Unlike the R6RS, Guile also
1981permits `_' to be in the literals list for a pattern.
1982
96b73e84
AW
1983** Macros need to be defined before their first use.
1984
1985It used to be that with lazy memoization, this might work:
1986
1987 (define (foo x)
1988 (ref x))
1989 (define-macro (ref x) x)
1990 (foo 1) => 1
1991
1992But now, the body of `foo' is interpreted to mean a call to the toplevel
1993`ref' function, instead of a macro expansion. The solution is to define
1994macros before code that uses them.
1995
1996** Functions needed by macros at expand-time need to be present at
1997 expand-time.
1998
1999For example, this code will work at the REPL:
2000
2001 (define (double-helper x) (* x x))
2002 (define-macro (double-literal x) (double-helper x))
2003 (double-literal 2) => 4
2004
2005But it will not work when a file is compiled, because the definition of
2006`double-helper' is not present at expand-time. The solution is to wrap
2007the definition of `double-helper' in `eval-when':
2008
2009 (eval-when (load compile eval)
2010 (define (double-helper x) (* x x)))
2011 (define-macro (double-literal x) (double-helper x))
2012 (double-literal 2) => 4
2013
29b98fb2 2014See the documentation for eval-when for more information.
96b73e84 2015
29b98fb2 2016** `macroexpand' produces structures, not S-expressions.
96b73e84 2017
29b98fb2
AW
2018Given the need to maintain referential transparency, both lexically and
2019modular, the result of expanding Scheme expressions is no longer itself
2020an s-expression. If you want a human-readable approximation of the
2021result of `macroexpand', call `tree-il->scheme' from `(language
2022tree-il)'.
96b73e84 2023
29b98fb2 2024** Removed function: `macroexpand-1'
96b73e84 2025
29b98fb2
AW
2026It is unclear how to implement `macroexpand-1' with syntax-case, though
2027PLT Scheme does prove that it is possible.
fa1804e9
AW
2028
2029** New reader macros: #' #` #, #,@
2030
2031These macros translate, respectively, to `syntax', `quasisyntax',
2032`unsyntax', and `unsyntax-splicing'. See the R6RS for more information.
2033These reader macros may be overridden by `read-hash-extend'.
2034
2035** Incompatible change to #'
2036
2037Guile did have a #' hash-extension, by default, which just returned the
2038subsequent datum: #'foo => foo. In the unlikely event that anyone
2039actually used this, this behavior may be reinstated via the
2040`read-hash-extend' mechanism.
2041
b47fea09
AW
2042** `unquote' and `unquote-splicing' accept multiple expressions
2043
2044As per the R6RS, these syntax operators can now accept any number of
2045expressions to unquote.
2046
fa1804e9
AW
2047** Scheme expresssions may be commented out with #;
2048
93617170
LC
2049#; comments out an entire expression. See SRFI-62 or the R6RS for more
2050information.
fa1804e9 2051
b0abbaa7
AW
2052** Prompts: Delimited, composable continuations
2053
2054Guile now has prompts as part of its primitive language. See "Prompts"
2055in the manual, for more information.
2056
2057Expressions entered in at the REPL, or from the command line, are
2058surrounded by a prompt with the default prompt tag.
2059
93617170 2060** `make-stack' with a tail-called procedural narrowing argument no longer
fa1804e9
AW
2061 works (with compiled procedures)
2062
2063It used to be the case that a captured stack could be narrowed to select
2064calls only up to or from a certain procedure, even if that procedure
2065already tail-called another procedure. This was because the debug
2066information from the original procedure was kept on the stack.
2067
2068Now with the new compiler, the stack only contains active frames from
2069the current continuation. A narrow to a procedure that is not in the
2070stack will result in an empty stack. To fix this, narrow to a procedure
2071that is active in the current continuation, or narrow to a specific
2072number of stack frames.
2073
29b98fb2 2074** Backtraces through compiled procedures only show procedures that are
fa1804e9
AW
2075 active in the current continuation
2076
2077Similarly to the previous issue, backtraces in compiled code may be
2078different from backtraces in interpreted code. There are no semantic
2079differences, however. Please mail bug-guile@gnu.org if you see any
2080deficiencies with Guile's backtraces.
2081
b47fea09
AW
2082** `positions' reader option enabled by default
2083
2084This change allows primitive-load without --auto-compile to also
2085propagate source information through the expander, for better errors and
2086to let macros know their source locations. The compiler was already
2087turning it on anyway.
2088
51cb0cca
AW
2089** New macro: `current-source-location'
2090
2091The macro returns the current source location (to be documented).
2092
fa1804e9
AW
2093** syntax-rules and syntax-case macros now propagate source information
2094 through to the expanded code
2095
2096This should result in better backtraces.
2097
2098** The currying behavior of `define' has been removed.
2099
2100Before, `(define ((f a) b) (* a b))' would translate to
2101
2102 (define f (lambda (a) (lambda (b) (* a b))))
2103
93617170 2104Now a syntax error is signaled, as this syntax is not supported by
29b98fb2
AW
2105default. Use the `(ice-9 curried-definitions)' module to get back the
2106old behavior.
fa1804e9 2107
4a457691
AW
2108** New procedure, `define!'
2109
2110`define!' is a procedure that takes two arguments, a symbol and a value,
2111and binds the value to the symbol in the current module. It's useful to
2112programmatically make definitions in the current module, and is slightly
2113less verbose than `module-define!'.
2114
fa1804e9
AW
2115** All modules have names now
2116
2117Before, you could have anonymous modules: modules without names. Now,
2118because of hygiene and macros, all modules have names. If a module was
2119created without a name, the first time `module-name' is called on it, a
2120fresh name will be lazily generated for it.
2121
18e90860
AW
2122** The module namespace is now separate from the value namespace
2123
2124It was a little-known implementation detail of Guile's module system
2125that it was built on a single hierarchical namespace of values -- that
2126if there was a module named `(foo bar)', then in the module named
2127`(foo)' there was a binding from `bar' to the `(foo bar)' module.
2128
2129This was a neat trick, but presented a number of problems. One problem
2130was that the bindings in a module were not apparent from the module
2131itself; perhaps the `(foo)' module had a private binding for `bar', and
2132then an external contributor defined `(foo bar)'. In the end there can
2133be only one binding, so one of the two will see the wrong thing, and
2134produce an obtuse error of unclear provenance.
2135
2136Also, the public interface of a module was also bound in the value
2137namespace, as `%module-public-interface'. This was a hack from the early
2138days of Guile's modules.
2139
2140Both of these warts have been fixed by the addition of fields in the
2141`module' data type. Access to modules and their interfaces from the
2142value namespace has been deprecated, and all accessors use the new
2143record accessors appropriately.
2144
2145When Guile is built with support for deprecated code, as is the default,
2146the value namespace is still searched for modules and public interfaces,
2147and a deprecation warning is raised as appropriate.
2148
2149Finally, to support lazy loading of modules as one used to be able to do
2150with module binder procedures, Guile now has submodule binders, called
2151if a given submodule is not found. See boot-9.scm for more information.
2152
2153** New procedures: module-ref-submodule, module-define-submodule,
2154 nested-ref-module, nested-define-module!, local-ref-module,
2155 local-define-module
2156
2157These new accessors are like their bare variants, but operate on
2158namespaces instead of values.
2159
2160** The (app modules) module tree is officially deprecated
2161
2162It used to be that one could access a module named `(foo bar)' via
2163`(nested-ref the-root-module '(app modules foo bar))'. The `(app
2164modules)' bit was a never-used and never-documented abstraction, and has
2165been deprecated. See the following mail for a full discussion:
2166
2167 http://lists.gnu.org/archive/html/guile-devel/2010-04/msg00168.html
2168
2169The `%app' binding is also deprecated.
2170
51cb0cca
AW
2171** `module-filename' field and accessor
2172
2173Modules now record the file in which they are defined. This field may be
2174accessed with the new `module-filename' procedure.
2175
2176** Modules load within a known environment
2177
2178It takes a few procedure calls to define a module, and those procedure
2179calls need to be in scope. Now we ensure that the current module when
2180loading a module is one that has the needed bindings, instead of relying
2181on chance.
2182
b47fea09
AW
2183** `load' is a macro (!) that resolves paths relative to source file dir
2184
2185The familiar Schem `load' procedure is now a macro that captures the
2186name of the source file being expanded, and dispatches to the new
2187`load-in-vicinity'. Referencing `load' by bare name returns a closure
2188that embeds the current source file name.
2189
2190This fix allows `load' of relative paths to be resolved with respect to
2191the location of the file that calls `load'.
2192
fa1804e9
AW
2193** Many syntax errors have different texts now
2194
2195Syntax errors still throw to the `syntax-error' key, but the arguments
2196are often different now. Perhaps in the future, Guile will switch to
93617170 2197using standard SRFI-35 conditions.
fa1804e9
AW
2198
2199** Returning multiple values to compiled code will silently truncate the
2200 values to the expected number
2201
2202For example, the interpreter would raise an error evaluating the form,
2203`(+ (values 1 2) (values 3 4))', because it would see the operands as
2204being two compound "values" objects, to which `+' does not apply.
2205
2206The compiler, on the other hand, receives multiple values on the stack,
2207not as a compound object. Given that it must check the number of values
2208anyway, if too many values are provided for a continuation, it chooses
2209to truncate those values, effectively evaluating `(+ 1 3)' instead.
2210
2211The idea is that the semantics that the compiler implements is more
2212intuitive, and the use of the interpreter will fade out with time.
2213This behavior is allowed both by the R5RS and the R6RS.
2214
2215** Multiple values in compiled code are not represented by compound
2216 objects
2217
2218This change may manifest itself in the following situation:
2219
2220 (let ((val (foo))) (do-something) val)
2221
2222In the interpreter, if `foo' returns multiple values, multiple values
2223are produced from the `let' expression. In the compiler, those values
2224are truncated to the first value, and that first value is returned. In
2225the compiler, if `foo' returns no values, an error will be raised, while
2226the interpreter would proceed.
2227
2228Both of these behaviors are allowed by R5RS and R6RS. The compiler's
2229behavior is more correct, however. If you wish to preserve a potentially
2230multiply-valued return, you will need to set up a multiple-value
2231continuation, using `call-with-values'.
2232
2233** Defmacros are now implemented in terms of syntax-case.
2234
2235The practical ramification of this is that the `defmacro?' predicate has
2236been removed, along with `defmacro-transformer', `macro-table',
2237`xformer-table', `assert-defmacro?!', `set-defmacro-transformer!' and
2238`defmacro:transformer'. This is because defmacros are simply macros. If
2239any of these procedures provided useful facilities to you, we encourage
2240you to contact the Guile developers.
2241
139fa149
AW
2242** Hygienic macros documented as the primary syntactic extension mechanism.
2243
2244The macro documentation was finally fleshed out with some documentation
29b98fb2
AW
2245on `syntax-rules' and `syntax-case' macros, and other parts of the macro
2246expansion process. See "Macros" in the manual, for details.
139fa149 2247
fa1804e9
AW
2248** psyntax is now the default expander
2249
2250Scheme code is now expanded by default by the psyntax hygienic macro
2251expander. Expansion is performed completely before compilation or
2252interpretation.
2253
2254Notably, syntax errors will be signalled before interpretation begins.
2255In the past, many syntax errors were only detected at runtime if the
2256code in question was memoized.
2257
2258As part of its expansion, psyntax renames all lexically-bound
2259identifiers. Original identifier names are preserved and given to the
2260compiler, but the interpreter will see the renamed variables, e.g.,
2261`x432' instead of `x'.
2262
2263Note that the psyntax that Guile uses is a fork, as Guile already had
2264modules before incompatible modules were added to psyntax -- about 10
2265years ago! Thus there are surely a number of bugs that have been fixed
2266in psyntax since then. If you find one, please notify bug-guile@gnu.org.
2267
2268** syntax-rules and syntax-case are available by default.
2269
2270There is no longer any need to import the `(ice-9 syncase)' module
2271(which is now deprecated). The expander may be invoked directly via
29b98fb2 2272`macroexpand', though it is normally searched for via the current module
fa1804e9
AW
2273transformer.
2274
2275Also, the helper routines for syntax-case are available in the default
2276environment as well: `syntax->datum', `datum->syntax',
2277`bound-identifier=?', `free-identifier=?', `generate-temporaries',
2278`identifier?', and `syntax-violation'. See the R6RS for documentation.
2279
4a457691
AW
2280** Tail patterns in syntax-case
2281
2282Guile has pulled in some more recent changes from the psyntax portable
2283syntax expander, to implement support for "tail patterns". Such patterns
2284are supported by syntax-rules and syntax-case. This allows a syntax-case
2285match clause to have ellipses, then a pattern at the end. For example:
2286
2287 (define-syntax case
2288 (syntax-rules (else)
2289 ((_ val match-clause ... (else e e* ...))
2290 [...])))
2291
2292Note how there is MATCH-CLAUSE, which is ellipsized, then there is a
2293tail pattern for the else clause. Thanks to Andreas Rottmann for the
2294patch, and Kent Dybvig for the code.
2295
fa1804e9
AW
2296** Lexical bindings introduced by hygienic macros may not be referenced
2297 by nonhygienic macros.
2298
2299If a lexical binding is introduced by a hygienic macro, it may not be
2300referenced by a nonhygienic macro. For example, this works:
2301
2302 (let ()
2303 (define-macro (bind-x val body)
2304 `(let ((x ,val)) ,body))
2305 (define-macro (ref x)
2306 x)
2307 (bind-x 10 (ref x)))
2308
2309But this does not:
2310
2311 (let ()
2312 (define-syntax bind-x
2313 (syntax-rules ()
2314 ((_ val body) (let ((x val)) body))))
2315 (define-macro (ref x)
2316 x)
2317 (bind-x 10 (ref x)))
2318
2319It is not normal to run into this situation with existing code. However,
51cb0cca 2320if you have defmacros that expand to hygienic macros, it is possible to
66ad445d
AW
2321run into situations like this. For example, if you have a defmacro that
2322generates a `while' expression, the `break' bound by the `while' may not
2323be visible within other parts of your defmacro. The solution is to port
2324from defmacros to syntax-rules or syntax-case.
fa1804e9
AW
2325
2326** Macros may no longer be referenced as first-class values.
2327
2328In the past, you could evaluate e.g. `if', and get its macro value. Now,
2329expanding this form raises a syntax error.
2330
2331Macros still /exist/ as first-class values, but they must be
2332/referenced/ via the module system, e.g. `(module-ref (current-module)
2333'if)'.
2334
29b98fb2
AW
2335** Macros may now have docstrings.
2336
2337`object-documentation' from `(ice-9 documentation)' may be used to
2338retrieve the docstring, once you have a macro value -- but see the above
2339note about first-class macros. Docstrings are associated with the syntax
2340transformer procedures.
fa1804e9 2341
e614d375
AW
2342** `case-lambda' is now available in the default environment.
2343
2344The binding in the default environment is equivalent to the one from the
2345`(srfi srfi-16)' module. Use the srfi-16 module explicitly if you wish
2346to maintain compatibility with Guile 1.8 and earlier.
2347
29b98fb2 2348** Procedures may now have more than one arity.
5bb408cc
AW
2349
2350This can be the case, for example, in case-lambda procedures. The
2351arities of compiled procedures may be accessed via procedures from the
2352`(system vm program)' module; see "Compiled Procedures", "Optional
2353Arguments", and "Case-lambda" in the manual.
2354
18e90860
AW
2355** Deprecate arity access via (procedure-properties proc 'arity)
2356
2357Instead of accessing a procedure's arity as a property, use the new
2358`procedure-minimum-arity' function, which gives the most permissive
b3da54d1 2359arity that the function has, in the same format as the old arity
18e90860
AW
2360accessor.
2361
e614d375
AW
2362** `lambda*' and `define*' are now available in the default environment
2363
2364As with `case-lambda', `(ice-9 optargs)' continues to be supported, for
2365compatibility purposes. No semantic change has been made (we hope).
2366Optional and keyword arguments now dispatch via special VM operations,
2367without the need to cons rest arguments, making them very fast.
2368
487bacf4
AW
2369** New syntax: define-once
2370
2371`define-once' is like Lisp's `defvar': it creates a toplevel binding,
2372but only if one does not exist already.
2373
cf8ec359
AW
2374** New function, `truncated-print', with `format' support
2375
2376`(ice-9 pretty-print)' now exports `truncated-print', a printer that
2377will ensure that the output stays within a certain width, truncating the
2378output in what is hopefully an intelligent manner. See the manual for
2379more details.
2380
2381There is a new `format' specifier, `~@y', for doing a truncated
2382print (as opposed to `~y', which does a pretty-print). See the `format'
2383documentation for more details.
2384
7cd99cba
AW
2385** Better pretty-printing
2386
2387Indentation recognizes more special forms, like `syntax-case', and read
2388macros like `quote' are printed better.
2389
51cb0cca
AW
2390** Passing a number as the destination of `format' is deprecated
2391
2392The `format' procedure in `(ice-9 format)' now emits a deprecation
2393warning if a number is passed as its first argument.
2394
487bacf4
AW
2395Also, it used to be that you could omit passing a port to `format', in
2396some cases. This still works, but has been formally deprecated.
2397
cf8ec359
AW
2398** SRFI-4 vectors reimplemented in terms of R6RS bytevectors
2399
2400Guile now implements SRFI-4 vectors using bytevectors. Often when you
2401have a numeric vector, you end up wanting to write its bytes somewhere,
2402or have access to the underlying bytes, or read in bytes from somewhere
2403else. Bytevectors are very good at this sort of thing. But the SRFI-4
2404APIs are nicer to use when doing number-crunching, because they are
2405addressed by element and not by byte.
2406
2407So as a compromise, Guile allows all bytevector functions to operate on
2408numeric vectors. They address the underlying bytes in the native
2409endianness, as one would expect.
2410
2411Following the same reasoning, that it's just bytes underneath, Guile
2412also allows uniform vectors of a given type to be accessed as if they
2413were of any type. One can fill a u32vector, and access its elements with
2414u8vector-ref. One can use f64vector-ref on bytevectors. It's all the
2415same to Guile.
2416
2417In this way, uniform numeric vectors may be written to and read from
2418input/output ports using the procedures that operate on bytevectors.
2419
2420Calls to SRFI-4 accessors (ref and set functions) from Scheme are now
2421inlined to the VM instructions for bytevector access.
2422
2423See "SRFI-4" in the manual, for more information.
2424
2425** Nonstandard SRFI-4 procedures now available from `(srfi srfi-4 gnu)'
2426
2427Guile's `(srfi srfi-4)' now only exports those srfi-4 procedures that
2428are part of the standard. Complex uniform vectors and the
2429`any->FOOvector' family are now available only from `(srfi srfi-4 gnu)'.
2430
2431Guile's default environment imports `(srfi srfi-4)', and probably should
2432import `(srfi srfi-4 gnu)' as well.
2433
2434See "SRFI-4 Extensions" in the manual, for more information.
2435
e614d375
AW
2436** New syntax: include-from-path.
2437
2438`include-from-path' is like `include', except it looks for its file in
2439the load path. It can be used to compile other files into a file.
2440
2441** New syntax: quasisyntax.
2442
2443`quasisyntax' is to `syntax' as `quasiquote' is to `quote'. See the R6RS
2444documentation for more information. Thanks to Andre van Tonder for the
2445implementation.
2446
51cb0cca
AW
2447** `*unspecified*' is identifier syntax
2448
2449`*unspecified*' is no longer a variable, so it is optimized properly by
2450the compiler, and is not `set!'-able.
2451
487bacf4
AW
2452** Changes and bugfixes in numerics code
2453
2454*** Added six new sets of fast quotient and remainder operators
2455
2456Added six new sets of fast quotient and remainder operator pairs with
2457different semantics than the R5RS operators. They support not only
2458integers, but all reals, including exact rationals and inexact
2459floating point numbers.
2460
2461These procedures accept two real numbers N and D, where the divisor D
2462must be non-zero. Each set of operators computes an integer quotient
2463Q and a real remainder R such that N = Q*D + R and |R| < |D|. They
2464differ only in how N/D is rounded to produce Q.
2465
2466`euclidean-quotient' returns the integer Q and `euclidean-remainder'
2467returns the real R such that N = Q*D + R and 0 <= R < |D|. `euclidean/'
2468returns both Q and R, and is more efficient than computing each
2469separately. Note that when D > 0, `euclidean-quotient' returns
2470floor(N/D), and when D < 0 it returns ceiling(N/D).
2471
2472`centered-quotient', `centered-remainder', and `centered/' are similar
2473except that the range of remainders is -abs(D/2) <= R < abs(D/2), and
2474`centered-quotient' rounds N/D to the nearest integer. Note that these
2475operators are equivalent to the R6RS integer division operators `div',
2476`mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'.
2477
2478`floor-quotient' and `floor-remainder' compute Q and R, respectively,
2479where Q has been rounded toward negative infinity. `floor/' returns
2480both Q and R, and is more efficient than computing each separately.
2481Note that when applied to integers, `floor-remainder' is equivalent to
2482the R5RS integer-only `modulo' operator. `ceiling-quotient',
2483`ceiling-remainder', and `ceiling/' are similar except that Q is
2484rounded toward positive infinity.
2485
2486For `truncate-quotient', `truncate-remainder', and `truncate/', Q is
2487rounded toward zero. Note that when applied to integers,
2488`truncate-quotient' and `truncate-remainder' are equivalent to the
2489R5RS integer-only operators `quotient' and `remainder'.
2490
2491For `round-quotient', `round-remainder', and `round/', Q is rounded to
2492the nearest integer, with ties going to the nearest even integer.
2493
2494*** Complex number changes
2495
2496Guile is now able to represent non-real complex numbers whose
2497imaginary part is an _inexact_ zero (0.0 or -0.0), per R6RS.
2498Previously, such numbers were immediately changed into inexact reals.
2499
2500(real? 0.0+0.0i) now returns #f, per R6RS, although (zero? 0.0+0.0i)
2501still returns #t, per R6RS. (= 0 0.0+0.0i) and (= 0.0 0.0+0.0i) are
2502#t, but the same comparisons using `eqv?' or `equal?' are #f.
2503
2504Like other non-real numbers, these complex numbers with inexact zero
2505imaginary part will raise exceptions is passed to procedures requiring
2506reals, such as `<', `>', `<=', `>=', `min', `max', `positive?',
2507`negative?', `inf?', `nan?', `finite?', etc.
2508
2509**** `make-rectangular' changes
2510
2511scm_make_rectangular `make-rectangular' now returns a real number only
2512if the imaginary part is an _exact_ 0. Previously, it would return a
2513real number if the imaginary part was an inexact zero.
2514
2515scm_c_make_rectangular now always returns a non-real complex number,
2516even if the imaginary part is zero. Previously, it would return a
2517real number if the imaginary part was zero.
2518
2519**** `make-polar' changes
2520
2521scm_make_polar `make-polar' now returns a real number only if the
2522angle or magnitude is an _exact_ 0. If the magnitude is an exact 0,
2523it now returns an exact 0. Previously, it would return a real
2524number if the imaginary part was an inexact zero.
2525
2526scm_c_make_polar now always returns a non-real complex number, even if
2527the imaginary part is 0.0. Previously, it would return a real number
2528if the imaginary part was 0.0.
2529
2530**** `imag-part' changes
2531
2532scm_imag_part `imag-part' now returns an exact 0 if applied to an
2533inexact real number. Previously it returned an inexact zero in this
2534case.
2535
2536*** `eqv?' and `equal?' now compare numbers equivalently
2537
2538scm_equal_p `equal?' now behaves equivalently to scm_eqv_p `eqv?' for
2539numeric values, per R5RS. Previously, equal? worked differently,
2540e.g. `(equal? 0.0 -0.0)' returned #t but `(eqv? 0.0 -0.0)' returned #f,
2541and `(equal? +nan.0 +nan.0)' returned #f but `(eqv? +nan.0 +nan.0)'
2542returned #t.
2543
2544*** `(equal? +nan.0 +nan.0)' now returns #t
2545
2546Previously, `(equal? +nan.0 +nan.0)' returned #f, although
2547`(let ((x +nan.0)) (equal? x x))' and `(eqv? +nan.0 +nan.0)'
2548both returned #t. R5RS requires that `equal?' behave like
2549`eqv?' when comparing numbers.
2550
2551*** Change in handling products `*' involving exact 0
2552
2553scm_product `*' now handles exact 0 differently. A product containing
2554an exact 0 now returns an exact 0 if and only if the other arguments
2555are all exact. An inexact zero is returned if and only if the other
2556arguments are all finite but not all exact. If an infinite or NaN
2557value is present, a NaN value is returned. Previously, any product
2558containing an exact 0 yielded an exact 0, regardless of the other
2559arguments.
2560
2561*** `expt' and `integer-expt' changes when the base is 0
2562
2563While `(expt 0 0)' is still 1, and `(expt 0 N)' for N > 0 is still
2564zero, `(expt 0 N)' for N < 0 is now a NaN value, and likewise for
2565integer-expt. This is more correct, and conforming to R6RS, but seems
2566to be incompatible with R5RS, which would return 0 for all non-zero
2567values of N.
2568
2569*** `expt' and `integer-expt' are more generic, less strict
2570
2571When raising to an exact non-negative integer exponent, `expt' and
2572`integer-expt' are now able to exponentiate any object that can be
2573multiplied using `*'. They can also raise an object to an exact
2574negative integer power if its reciprocal can be taken using `/'.
2575In order to allow this, the type of the first argument is no longer
2576checked when raising to an exact integer power. If the exponent is 0
2577or 1, the first parameter is not manipulated at all, and need not
2578even support multiplication.
2579
2580*** Infinities are no longer integers, nor rationals
2581
2582scm_integer_p `integer?' and scm_rational_p `rational?' now return #f
2583for infinities, per R6RS. Previously they returned #t for real
2584infinities. The real infinities and NaNs are still considered real by
2585scm_real `real?' however, per R6RS.
2586
2587*** NaNs are no longer rationals
2588
2589scm_rational_p `rational?' now returns #f for NaN values, per R6RS.
2590Previously it returned #t for real NaN values. They are still
2591considered real by scm_real `real?' however, per R6RS.
2592
2593*** `inf?' and `nan?' now throw exceptions for non-reals
2594
2595The domain of `inf?' and `nan?' is the real numbers. Guile now signals
2596an error when a non-real number or non-number is passed to these
2597procedures. (Note that NaNs _are_ considered numbers by scheme, despite
2598their name).
2599
2600*** `rationalize' bugfixes and changes
2601
2602Fixed bugs in scm_rationalize `rationalize'. Previously, it returned
2603exact integers unmodified, although that was incorrect if the epsilon
2604was at least 1 or inexact, e.g. (rationalize 4 1) should return 3 per
2605R5RS and R6RS, but previously it returned 4. It also now handles
2606cases involving infinities and NaNs properly, per R6RS.
2607
2608*** Trigonometric functions now return exact numbers in some cases
2609
2610scm_sin `sin', scm_cos `cos', scm_tan `tan', scm_asin `asin', scm_acos
2611`acos', scm_atan `atan', scm_sinh `sinh', scm_cosh `cosh', scm_tanh
2612`tanh', scm_sys_asinh `asinh', scm_sys_acosh `acosh', and
2613scm_sys_atanh `atanh' now return exact results in some cases.
2614
2615*** New procedure: `finite?'
2616
2617Add scm_finite_p `finite?' from R6RS to guile core, which returns #t
2618if and only if its argument is neither infinite nor a NaN. Note that
2619this is not the same as (not (inf? x)) or (not (infinite? x)), since
2620NaNs are neither finite nor infinite.
2621
2622*** Improved exactness handling for complex number parsing
2623
2624When parsing non-real complex numbers, exactness specifiers are now
2625applied to each component, as is done in PLT Scheme. For complex
2626numbers written in rectangular form, exactness specifiers are applied
2627to the real and imaginary parts before calling scm_make_rectangular.
2628For complex numbers written in polar form, exactness specifiers are
2629applied to the magnitude and angle before calling scm_make_polar.
2630
2631Previously, exactness specifiers were applied to the number as a whole
2632_after_ calling scm_make_rectangular or scm_make_polar.
2633
2634For example, (string->number "#i5.0+0i") now does the equivalent of:
2635
2636 (make-rectangular (exact->inexact 5.0) (exact->inexact 0))
2637
2638which yields 5.0+0.0i. Previously it did the equivalent of:
2639
2640 (exact->inexact (make-rectangular 5.0 0))
2641
2642which yielded 5.0.
2643
108e18b1
AW
2644** Unicode characters
2645
2646Unicode characters may be entered in octal format via e.g. `#\454', or
2647created via (integer->char 300). A hex external representation will
2648probably be introduced at some point.
2649
2650** Unicode strings
2651
2652Internally, strings are now represented either in the `latin-1'
2653encoding, one byte per character, or in UTF-32, with four bytes per
2654character. Strings manage their own allocation, switching if needed.
2655
99e31c32
AW
2656Extended characters may be written in a literal string using the
2657hexadecimal escapes `\xXX', `\uXXXX', or `\UXXXXXX', for 8-bit, 16-bit,
2658or 24-bit codepoints, respectively, or entered directly in the native
2659encoding of the port on which the string is read.
2660
56664c08
AW
2661** Unicode symbols
2662
2663One may now use U+03BB (GREEK SMALL LETTER LAMBDA) as an identifier.
2664
99e31c32
AW
2665** Support for non-ASCII source code files
2666
2667The default reader now handles source code files for some of the
2668non-ASCII character encodings, such as UTF-8. A non-ASCII source file
2669should have an encoding declaration near the top of the file. Also,
2670there is a new function, `file-encoding', that scans a port for a coding
2671declaration. See the section of the manual entitled, "Character Encoding
2672of Source Files".
2673
2674The pre-1.9.3 reader handled 8-bit clean but otherwise unspecified source
51cb0cca
AW
2675code. This use is now discouraged. Binary input and output is
2676currently supported by opening ports in the ISO-8859-1 locale.
99e31c32 2677
487bacf4
AW
2678** Source files default to UTF-8.
2679
2680If source files do not specify their encoding via a `coding:' block,
2681the default encoding is UTF-8, instead of being taken from the current
2682locale.
2683
2684** Interactive Guile installs the current locale.
2685
2686Instead of leaving the user in the "C" locale, running the Guile REPL
2687installs the current locale. [FIXME xref?]
2688
99e31c32
AW
2689** Support for locale transcoding when reading from and writing to ports
2690
2691Ports now have an associated character encoding, and port read and write
2692operations do conversion to and from locales automatically. Ports also
2693have an associated strategy for how to deal with locale conversion
2694failures.
2695
2696See the documentation in the manual for the four new support functions,
2697`set-port-encoding!', `port-encoding', `set-port-conversion-strategy!',
2698and `port-conversion-strategy'.
2699
2700** String and SRFI-13 functions can operate on Unicode strings
2701
2702** Unicode support for SRFI-14 character sets
2703
2704The default character sets are no longer locale dependent and contain
2705characters from the whole Unicode range. There is a new predefined
2706character set, `char-set:designated', which contains all assigned
2707Unicode characters. There is a new debugging function, `%char-set-dump'.
2708
2709** Character functions operate on Unicode characters
2710
2711`char-upcase' and `char-downcase' use default Unicode casing rules.
2712Character comparisons such as `char<?' and `char-ci<?' now sort based on
2713Unicode code points.
108e18b1
AW
2714
2715** Global variables `scm_charnames' and `scm_charnums' are removed
2716
2717These variables contained the names of control characters and were
2718used when writing characters. While these were global, they were
2719never intended to be public API. They have been replaced with private
2720functions.
2721
2722** EBCDIC support is removed
2723
2724There was an EBCDIC compile flag that altered some of the character
2725processing. It appeared that full EBCDIC support was never completed
2726and was unmaintained.
2727
6bf927ab 2728** Compile-time warnings
b0217d17
AW
2729
2730Guile can warn about potentially unbound free variables. Pass the
2731-Wunbound-variable on the `guile-tools compile' command line, or add
2732`#:warnings '(unbound-variable)' to your `compile' or `compile-file'
51cb0cca
AW
2733invocation. Warnings are also enabled by default for expressions entered
2734at the REPL.
b0217d17 2735
6cf43047
AW
2736Guile can also warn when you pass the wrong number of arguments to a
2737procedure, with -Warity-mismatch, or `arity-mismatch' in the
2738`#:warnings' as above.
2739
6bf927ab 2740Other warnings include `-Wunused-variable' and `-Wunused-toplevel', to
ef6b0e8d
AW
2741warn about unused local or global (top-level) variables, and `-Wformat',
2742to check for various errors related to the `format' procedure.
6bf927ab 2743
93617170
LC
2744** A new `memoize-symbol' evaluator trap has been added.
2745
2746This trap can be used for efficiently implementing a Scheme code
2747coverage.
fa1804e9 2748
96b73e84 2749** Duplicate bindings among used modules are resolved lazily.
93617170 2750
96b73e84 2751This slightly improves program startup times.
fa1804e9 2752
96b73e84 2753** New thread cancellation and thread cleanup API
93617170 2754
96b73e84 2755See `cancel-thread', `set-thread-cleanup!', and `thread-cleanup'.
fa1804e9 2756
51cb0cca
AW
2757** New threads are in `(guile-user)' by default, not `(guile)'
2758
2759It used to be that a new thread entering Guile would do so in the
2760`(guile)' module, unless this was the first time Guile was initialized,
2761in which case it was `(guile-user)'. This has been fixed to have all
2762new threads unknown to Guile default to `(guile-user)'.
2763
b47fea09
AW
2764** New helpers: `print-exception', `set-exception-printer!'
2765
2766These functions implement an extensible exception printer. Guile
2767registers printers for all of the exceptions it throws. Users may add
2768their own printers. There is also `scm_print_exception', for use by C
2769programs. Pleasantly, this allows SRFI-35 and R6RS exceptions to be
2770printed appropriately.
2771
4a457691
AW
2772** GOOPS dispatch in scheme
2773
2774As an implementation detail, GOOPS dispatch is no longer implemented by
2775special evaluator bytecodes, but rather directly via a Scheme function
2776associated with an applicable struct. There is some VM support for the
2777underlying primitives, like `class-of'.
2778
2779This change will in the future allow users to customize generic function
2780dispatch without incurring a performance penalty, and allow us to
2781implement method combinations.
2782
4a457691
AW
2783** Applicable struct support
2784
2785One may now make structs from Scheme that may be applied as procedures.
2786To do so, make a struct whose vtable is `<applicable-struct-vtable>'.
2787That struct will be the vtable of your applicable structs; instances of
2788that new struct are assumed to have the procedure in their first slot.
2789`<applicable-struct-vtable>' is like Common Lisp's
2790`funcallable-standard-class'. Likewise there is
2791`<applicable-struct-with-setter-vtable>', which looks for the setter in
2792the second slot. This needs to be better documented.
2793
29b98fb2
AW
2794** GOOPS cleanups.
2795
2796GOOPS had a number of concepts that were relevant to the days of Tcl,
2797but not any more: operators and entities, mainly. These objects were
2798never documented, and it is unlikely that they were ever used. Operators
2799were a kind of generic specific to the Tcl support. Entities were
2800replaced by applicable structs, mentioned above.
2801
4a457691
AW
2802** New struct slot allocation: "hidden"
2803
2804A hidden slot is readable and writable, but will not be initialized by a
2805call to make-struct. For example in your layout you would say "ph"
2806instead of "pw". Hidden slots are useful for adding new slots to a
2807vtable without breaking existing invocations to make-struct.
2808
2809** eqv? not a generic
2810
2811One used to be able to extend `eqv?' as a primitive-generic, but no
2812more. Because `eqv?' is in the expansion of `case' (via `memv'), which
2813should be able to compile to static dispatch tables, it doesn't make
2814sense to allow extensions that would subvert this optimization.
2815
e614d375
AW
2816** `inet-ntop' and `inet-pton' are always available.
2817
2818Guile now use a portable implementation of `inet_pton'/`inet_ntop', so
2819there is no more need to use `inet-aton'/`inet-ntoa'. The latter
2820functions are deprecated.
2821
b47fea09
AW
2822** `getopt-long' parsing errors throw to `quit', not `misc-error'
2823
2824This change should inhibit backtraces on argument parsing errors.
2825`getopt-long' has been modified to print out the error that it throws
2826itself.
2827
51cb0cca
AW
2828** New primitive: `tmpfile'.
2829
2830See "File System" in the manual.
2831
2832** Random generator state may be serialized to a datum
2833
2834`random-state->datum' will serialize a random state to a datum, which
2835may be written out, read back in later, and revivified using
2836`datum->random-state'. See "Random" in the manual, for more details.
2837
2838** Fix random number generator on 64-bit platforms
2839
2840There was a nasty bug on 64-bit platforms in which asking for a random
2841integer with a range between 2**32 and 2**64 caused a segfault. After
2842many embarrassing iterations, this was fixed.
2843
5bb408cc
AW
2844** Fast bit operations.
2845
2846The bit-twiddling operations `ash', `logand', `logior', and `logxor' now
2847have dedicated bytecodes. Guile is not just for symbolic computation,
2848it's for number crunching too.
2849
4a457691
AW
2850** Faster SRFI-9 record access
2851
2852SRFI-9 records are now implemented directly on top of Guile's structs,
2853and their accessors are defined in such a way that normal call-sites
2854inline to special VM opcodes, while still allowing for the general case
2855(e.g. passing a record accessor to `apply').
2856
e614d375
AW
2857** R6RS block comment support
2858
2859Guile now supports R6RS nested block comments. The start of a comment is
2860marked with `#|', and the end with `|#'.
2861
2862** `guile-2' cond-expand feature
2863
2864To test if your code is running under Guile 2.0 (or its alpha releases),
2865test for the `guile-2' cond-expand feature. Like this:
2866
2867 (cond-expand (guile-2 (eval-when (compile)
2868 ;; This must be evaluated at compile time.
2869 (fluid-set! current-reader my-reader)))
2870 (guile
2871 ;; Earlier versions of Guile do not have a
2872 ;; separate compilation phase.
2873 (fluid-set! current-reader my-reader)))
2874
96b73e84 2875** New global variables: %load-compiled-path, %load-compiled-extensions
fa1804e9 2876
96b73e84 2877These are analogous to %load-path and %load-extensions.
fa1804e9 2878
18e90860
AW
2879** New fluid: `%file-port-name-canonicalization'
2880
2881This fluid parameterizes the file names that are associated with file
2882ports. If %file-port-name-canonicalization is 'absolute, then file names
2883are canonicalized to be absolute paths. If it is 'relative, then the
2884name is canonicalized, but any prefix corresponding to a member of
2885`%load-path' is stripped off. Otherwise the names are passed through
2886unchanged.
2887
2888In addition, the `compile-file' and `compile-and-load' procedures bind
2889%file-port-name-canonicalization to their `#:canonicalization' keyword
2890argument, which defaults to 'relative. In this way, one might compile
2891"../module/ice-9/boot-9.scm", but the path that gets residualized into
2892the .go is "ice-9/boot-9.scm".
2893
96b73e84 2894** New procedure, `make-promise'
fa1804e9 2895
96b73e84 2896`(make-promise (lambda () foo))' is equivalent to `(delay foo)'.
fa1804e9 2897
108e18b1
AW
2898** `defined?' may accept a module as its second argument
2899
2900Previously it only accepted internal structures from the evaluator.
2901
96b73e84 2902** New entry into %guile-build-info: `ccachedir'
fa1804e9 2903
96b73e84 2904** Fix bug in `module-bound?'.
fa1804e9 2905
96b73e84
AW
2906`module-bound?' was returning true if a module did have a local
2907variable, but one that was unbound, but another imported module bound
2908the variable. This was an error, and was fixed.
fa1804e9 2909
96b73e84 2910** `(ice-9 syncase)' has been deprecated.
fa1804e9 2911
96b73e84
AW
2912As syntax-case is available by default, importing `(ice-9 syncase)' has
2913no effect, and will trigger a deprecation warning.
fa1804e9 2914
b0217d17
AW
2915** New readline history functions
2916
2917The (ice-9 readline) module now provides add-history, read-history,
2918write-history and clear-history, which wrap the corresponding GNU
2919History library functions.
2920
86d88a22
AW
2921** Removed deprecated uniform array procedures:
2922 dimensions->uniform-array, list->uniform-array, array-prototype
2923
2924Instead, use make-typed-array, list->typed-array, or array-type,
2925respectively.
2926
51cb0cca
AW
2927** Deprecate the old `scm-style-repl'
2928
2929The following bindings from boot-9 are now found in `(ice-9
2930scm-style-repl)': `scm-style-repl', `error-catching-loop',
2931`error-catching-repl', `bad-throw', `scm-repl-silent'
2932`assert-repl-silence', `repl-print-unspecified',
2933`assert-repl-print-unspecified', `scm-repl-verbose',
2934`assert-repl-verbosity', `scm-repl-prompt', `set-repl-prompt!', `repl',
2935`default-pre-unwind-handler', `handle-system-error',
2936
2937The following bindings have been deprecated, with no replacement:
2938`pre-unwind-handler-dispatch'.
2939
2940The following bindings have been totally removed:
2941`before-signal-stack'.
2942
2943Deprecated forwarding shims have been installed so that users that
2944expect these bindings in the main namespace will still work, but receive
2945a deprecation warning.
2946
2947** `set-batch-mode?!' replaced by `ensure-batch-mode!'
2948
2949"Batch mode" is a flag used to tell a program that it is not running
2950interactively. One usually turns it on after a fork. It may not be
2951turned off. `ensure-batch-mode!' deprecates the old `set-batch-mode?!',
2952because it is a better interface, as it can only turn on batch mode, not
2953turn it off.
2954
2955** Deprecate `save-stack', `the-last-stack'
2956
2957It used to be that the way to debug programs in Guile was to capture the
2958stack at the time of error, drop back to the REPL, then debug that
2959stack. But this approach didn't compose, was tricky to get right in the
2960presence of threads, and was not very powerful.
2961
2962So `save-stack', `stack-saved?', and `the-last-stack' have been moved to
2963`(ice-9 save-stack)', with deprecated bindings left in the root module.
2964
2965** `top-repl' has its own module
2966
2967The `top-repl' binding, called with Guile is run interactively, is now
2968is its own module, `(ice-9 top-repl)'. A deprecated forwarding shim was
2969left in the default environment.
2970
2971** `display-error' takes a frame
2972
2973The `display-error' / `scm_display_error' helper now takes a frame as an
2974argument instead of a stack. Stacks are still supported in deprecated
2975builds. Additionally, `display-error' will again source location
2976information for the error.
2977
2978** No more `(ice-9 debug)'
2979
2980This module had some debugging helpers that are no longer applicable to
2981the current debugging model. Importing this module will produce a
2982deprecation warning. Users should contact bug-guile for support.
2983
ef6b0e8d
AW
2984** Remove obsolete debug-options
2985
2986Removed `breakpoints', `trace', `procnames', `indent', `frames',
2987`maxdepth', and `debug' debug-options.
2988
2989** `backtrace' debug option on by default
2990
2991Given that Guile 2.0 can always give you a backtrace, backtraces are now
2992on by default.
2993
2994** `turn-on-debugging' deprecated
2995
2996** Remove obsolete print-options
2997
2998The `source' and `closure-hook' print options are obsolete, and have
2999been removed.
3000
3001** Remove obsolete read-options
3002
3003The "elisp-strings" and "elisp-vectors" read options were unused and
3004obsolete, so they have been removed.
3005
3006** Remove eval-options and trap-options
3007
3008Eval-options and trap-options are obsolete with the new VM and
3009evaluator.
3010
3011** Remove (ice-9 debugger) and (ice-9 debugging)
3012
3013See "Traps" and "Interactive Debugging" in the manual, for information
3014on their replacements.
3015
3016** Remove the GDS Emacs integration
3017
3018See "Using Guile in Emacs" in the manual, for info on how we think you
3019should use Guile with Emacs.
3020
b0abbaa7
AW
3021** Deprecated: `lazy-catch'
3022
3023`lazy-catch' was a form that captured the stack at the point of a
3024`throw', but the dynamic state at the point of the `catch'. It was a bit
3025crazy. Please change to use `catch', possibly with a throw-handler, or
3026`with-throw-handler'.
3027
487bacf4
AW
3028** Deprecated: primitive properties
3029
3030The `primitive-make-property', `primitive-property-set!',
3031`primitive-property-ref', and `primitive-property-del!' procedures were
3032crufty and only used to implement object properties, which has a new,
3033threadsafe implementation. Use object properties or weak hash tables
3034instead.
3035
18e90860
AW
3036** Deprecated `@bind' syntax
3037
3038`@bind' was part of an older implementation of the Emacs Lisp language,
3039and is no longer used.
3040
51cb0cca
AW
3041** Miscellaneous other deprecations
3042
7cd99cba
AW
3043`cuserid' has been deprecated, as it only returns 8 bytes of a user's
3044login. Use `(passwd:name (getpwuid (geteuid)))' instead.
3045
487bacf4
AW
3046Additionally, the procedures `apply-to-args', `has-suffix?', `scheme-file-suffix'
3047`get-option', `for-next-option', `display-usage-report',
3048`transform-usage-lambda', `collect', and `set-batch-mode?!' have all
3049been deprecated.
3050
7cd99cba
AW
3051** Add support for unbound fluids
3052
3053See `make-unbound-fluid', `fluid-unset!', and `fluid-bound?' in the
3054manual.
3055
3056** Add `variable-unset!'
3057
3058See "Variables" in the manual, for more details.
51cb0cca 3059
87e00370
LC
3060** Last but not least, the `λ' macro can be used in lieu of `lambda'
3061
96b73e84 3062* Changes to the C interface
fa1804e9 3063
7b96f3dd
LC
3064** Guile now uses libgc, the Boehm-Demers-Weiser garbage collector
3065
3066The semantics of `scm_gc_malloc ()' have been changed, in a
3067backward-compatible way. A new allocation routine,
3068`scm_gc_malloc_pointerless ()', was added.
3069
3070Libgc is a conservative GC, which we hope will make interaction with C
3071code easier and less error-prone.
3072
487bacf4
AW
3073** New procedures: `scm_to_stringn', `scm_from_stringn'
3074** New procedures: scm_{to,from}_{utf8,latin1}_symbol{n,}
3075** New procedures: scm_{to,from}_{utf8,utf32,latin1}_string{n,}
3076
3077These new procedures convert to and from string representations in
3078particular encodings.
ef6b0e8d 3079
487bacf4
AW
3080Users should continue to use locale encoding for user input, user
3081output, or interacting with the C library.
ef6b0e8d 3082
487bacf4 3083Use the Latin-1 functions for ASCII, and for literals in source code.
ef6b0e8d 3084
487bacf4
AW
3085Use UTF-8 functions for interaction with modern libraries which deal in
3086UTF-8, and UTF-32 for interaction with utf32-using libraries.
3087
3088Otherwise, use scm_to_stringn or scm_from_stringn with a specific
3089encoding.
ef6b0e8d 3090
4a457691
AW
3091** New type definitions for `scm_t_intptr' and friends.
3092
3093`SCM_T_UINTPTR_MAX', `SCM_T_INTPTR_MIN', `SCM_T_INTPTR_MAX',
3094`SIZEOF_SCM_T_BITS', `scm_t_intptr' and `scm_t_uintptr' are now
3095available to C. Have fun!
3096
96b73e84 3097** The GH interface (deprecated in version 1.6, 2001) was removed.
fa1804e9 3098
96b73e84 3099** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF
fa1804e9 3100
96b73e84
AW
3101This makes these internal functions technically not callable from
3102application code.
fa1804e9 3103
96b73e84
AW
3104** Functions for handling `scm_option' now no longer require an argument
3105indicating length of the `scm_t_option' array.
fa1804e9 3106
4a457691
AW
3107** Procedures-with-setters are now implemented using applicable structs
3108
3109From a user's perspective this doesn't mean very much. But if, for some
3110odd reason, you used the SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE, or
3111SCM_SETTER macros, know that they're deprecated now. Also, scm_tc7_pws
3112is gone.
3113
3114** Remove old evaluator closures
3115
3116There used to be ranges of typecodes allocated to interpreted data
3117structures, but that it no longer the case, given that interpreted
3118procedure are now just regular VM closures. As a result, there is a
3119newly free tc3, and a number of removed macros. See the ChangeLog for
3120details.
3121
cf8ec359 3122** Primitive procedures are now VM trampoline procedures
4a457691
AW
3123
3124It used to be that there were something like 12 different typecodes
3125allocated to primitive procedures, each with its own calling convention.
3126Now there is only one, the gsubr. This may affect user code if you were
3127defining a procedure using scm_c_make_subr rather scm_c_make_gsubr. The
3128solution is to switch to use scm_c_make_gsubr. This solution works well
b3da54d1 3129both with the old 1.8 and with the current 1.9 branch.
4a457691 3130
cf8ec359
AW
3131Guile's old evaluator used to have special cases for applying "gsubrs",
3132primitive procedures with specified numbers of required, optional, and
3133rest arguments. Now, however, Guile represents gsubrs as normal VM
3134procedures, with appropriate bytecode to parse out the correct number of
3135arguments, including optional and rest arguments, and then with a
3136special bytecode to apply the gsubr.
3137
3138This allows primitive procedures to appear on the VM stack, allowing
3139them to be accurately counted in profiles. Also they now have more
3140debugging information attached to them -- their number of arguments, for
3141example. In addition, the VM can completely inline the application
3142mechanics, allowing for faster primitive calls.
3143
3144However there are some changes on the C level. There is no more
3145`scm_tc7_gsubr' or `scm_tcs_subrs' typecode for primitive procedures, as
3146they are just VM procedures. Likewise the macros `SCM_GSUBR_TYPE',
3147`SCM_GSUBR_MAKTYPE', `SCM_GSUBR_REQ', `SCM_GSUBR_OPT', and
3148`SCM_GSUBR_REST' are gone, as are `SCM_SUBR_META_INFO', `SCM_SUBR_PROPS'
3149`SCM_SET_SUBR_GENERIC_LOC', and `SCM_SUBR_ARITY_TO_TYPE'.
3150
3151Perhaps more significantly, `scm_c_make_subr',
3152`scm_c_make_subr_with_generic', `scm_c_define_subr', and
3153`scm_c_define_subr_with_generic'. They all operated on subr typecodes,
3154and there are no more subr typecodes. Use the scm_c_make_gsubr family
3155instead.
3156
3157Normal users of gsubrs should not be affected, though, as the
3158scm_c_make_gsubr family still is the correct way to create primitive
3159procedures.
3160
3161** Remove deprecated array C interfaces
3162
3163Removed the deprecated array functions `scm_i_arrayp',
3164`scm_i_array_ndim', `scm_i_array_mem', `scm_i_array_v',
3165`scm_i_array_base', `scm_i_array_dims', and the deprecated macros
3166`SCM_ARRAYP', `SCM_ARRAY_NDIM', `SCM_ARRAY_CONTP', `SCM_ARRAY_MEM',
3167`SCM_ARRAY_V', `SCM_ARRAY_BASE', and `SCM_ARRAY_DIMS'.
3168
3169** Remove unused snarf macros
3170
3171`SCM_DEFINE1', `SCM_PRIMITIVE_GENERIC_1', `SCM_PROC1, and `SCM_GPROC1'
3172are no more. Use SCM_DEFINE or SCM_PRIMITIVE_GENERIC instead.
3173
cf8ec359
AW
3174** New functions: `scm_call_n', `scm_c_run_hookn'
3175
3176`scm_call_n' applies to apply a function to an array of arguments.
3177`scm_c_run_hookn' runs a hook with an array of arguments.
3178
4a457691
AW
3179** Some SMOB types changed to have static typecodes
3180
3181Fluids, dynamic states, and hash tables used to be SMOB objects, but now
3182they have statically allocated tc7 typecodes.
3183
3184** Preparations for changing SMOB representation
3185
3186If things go right, we'll be changing the SMOB representation soon. To
3187that end, we did a lot of cleanups to calls to e.g. SCM_CELL_WORD_2(x) when
3188the code meant SCM_SMOB_DATA_2(x); user code will need similar changes
3189in the future. Code accessing SMOBs using SCM_CELL macros was never
3190correct, but until now things still worked. Users should be aware of
3191such changes.
fa1804e9 3192
cf8ec359
AW
3193** Changed invocation mechanics of applicable SMOBs
3194
3195Guile's old evaluator used to have special cases for applying SMOB
3196objects. Now, with the VM, when Guile sees a SMOB, it looks up a VM
3197trampoline procedure for it, and use the normal mechanics to apply the
3198trampoline. This simplifies procedure application in the normal,
3199non-SMOB case.
3200
3201The upshot is that the mechanics used to apply a SMOB are different from
32021.8. Descriptors no longer have `apply_0', `apply_1', `apply_2', and
3203`apply_3' functions, and the macros SCM_SMOB_APPLY_0 and friends are now
3204deprecated. Just use the scm_call_0 family of procedures.
3205
ef6b0e8d
AW
3206** Removed support shlibs for SRFIs 1, 4, 13, 14, and 60
3207
3208Though these SRFI support libraries did expose API, they encoded a
3209strange version string into their library names. That version was never
3210programmatically exported, so there was no way people could use the
3211libs.
3212
3213This was a fortunate oversight, as it allows us to remove the need for
3214extra, needless shared libraries --- the C support code for SRFIs 4, 13,
3215and 14 was already in core --- and allow us to incrementally return the
3216SRFI implementation to Scheme.
3217
96b73e84 3218** New C function: scm_module_public_interface
a4f1c77d 3219
96b73e84 3220This procedure corresponds to Scheme's `module-public-interface'.
24d6fae8 3221
4a457691
AW
3222** Undeprecate `scm_the_root_module ()'
3223
3224It's useful to be able to get the root module from C without doing a
3225full module lookup.
3226
e614d375
AW
3227** Inline vector allocation
3228
3229Instead of having vectors point out into the heap for their data, their
3230data is now allocated inline to the vector object itself. The same is
3231true for bytevectors, by default, though there is an indirection
3232available which should allow for making a bytevector from an existing
3233memory region.
3234
4a457691
AW
3235** New struct constructors that don't involve making lists
3236
3237`scm_c_make_struct' and `scm_c_make_structv' are new varargs and array
3238constructors, respectively, for structs. You might find them useful.
3239
3240** Stack refactor
3241
3242In Guile 1.8, there were debugging frames on the C stack. Now there is
3243no more need to explicitly mark the stack in this way, because Guile has
3244a VM stack that it knows how to walk, which simplifies the C API
3245considerably. See the ChangeLog for details; the relevant interface is
3246in libguile/stacks.h. The Scheme API has not been changed significantly.
3247
e614d375
AW
3248** Removal of Guile's primitive object system.
3249
3250There were a number of pieces in `objects.[ch]' that tried to be a
3251minimal object system, but were never documented, and were quickly
3252obseleted by GOOPS' merge into Guile proper. So `scm_make_class_object',
3253`scm_make_subclass_object', `scm_metaclass_standard', and like symbols
3254from objects.h are no more. In the very unlikely case in which these
3255were useful to you, we urge you to contact guile-devel.
3256
3257** No future.
3258
3259Actually the future is still in the state that it was, is, and ever
3260shall be, Amen, except that `futures.c' and `futures.h' are no longer a
3261part of it. These files were experimental, never compiled, and would be
3262better implemented in Scheme anyway. In the future, that is.
3263
4a457691
AW
3264** Deprecate trampolines
3265
3266There used to be C functions `scm_trampoline_0', `scm_trampoline_1', and
3267so on. The point was to do some precomputation on the type of the
3268procedure, then return a specialized "call" procedure. However this
3269optimization wasn't actually an optimization, so it is now deprecated.
3270Just use `scm_call_0', etc instead.
3271
18e90860
AW
3272** Deprecated `scm_badargsp'
3273
3274This function is unused in Guile, but was part of its API.
3275
5bb408cc
AW
3276** Better support for Lisp `nil'.
3277
3278The bit representation of `nil' has been tweaked so that it is now very
3279efficient to check e.g. if a value is equal to Scheme's end-of-list or
3280Lisp's nil. Additionally there are a heap of new, specific predicates
b390b008 3281like scm_is_null_or_nil.
5bb408cc 3282
139fa149
AW
3283** Better integration of Lisp `nil'.
3284
3285`scm_is_boolean', `scm_is_false', and `scm_is_null' all return true now
3286for Lisp's `nil'. This shouldn't affect any Scheme code at this point,
3287but when we start to integrate more with Emacs, it is possible that we
3288break code that assumes that, for example, `(not x)' implies that `x' is
3289`eq?' to `#f'. This is not a common assumption. Refactoring affected
3290code to rely on properties instead of identities will improve code
3291correctness. See "Nil" in the manual, for more details.
3292
e614d375
AW
3293** Support for static allocation of strings, symbols, and subrs.
3294
3295Calls to snarfing CPP macros like SCM_DEFINE macro will now allocate
3296much of their associated data as static variables, reducing Guile's
3297memory footprint.
3298
93617170
LC
3299** `scm_stat' has an additional argument, `exception_on_error'
3300** `scm_primitive_load_path' has an additional argument `exception_on_not_found'
24d6fae8 3301
f1ce9199
LC
3302** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type
3303
3304Previously they would use the `off_t' type, which is fragile since its
3305definition depends on the application's value for `_FILE_OFFSET_BITS'.
3306
ba4c43dc
LC
3307** The `long_long' C type, deprecated in 1.8, has been removed
3308
86d88a22
AW
3309** Removed deprecated uniform array procedures: scm_make_uve,
3310 scm_array_prototype, scm_list_to_uniform_array,
3311 scm_dimensions_to_uniform_array, scm_make_ra, scm_shap2ra, scm_cvref,
3312 scm_ra_set_contp, scm_aind, scm_raprin1
3313
3314These functions have been deprecated since early 2005.
3315
a4f1c77d 3316* Changes to the distribution
6caac03c 3317
53befeb7
NJ
3318** Guile's license is now LGPLv3+
3319
3320In other words the GNU Lesser General Public License, version 3 or
3321later (at the discretion of each person that chooses to redistribute
3322part of Guile).
3323
51cb0cca
AW
3324** AM_SILENT_RULES
3325
3326Guile's build is visually quieter, due to the use of Automake 1.11's
3327AM_SILENT_RULES. Build as `make V=1' to see all of the output.
3328
56664c08
AW
3329** GOOPS documentation folded into Guile reference manual
3330
3331GOOPS, Guile's object system, used to be documented in separate manuals.
3332This content is now included in Guile's manual directly.
3333
96b73e84 3334** `guile-config' will be deprecated in favor of `pkg-config'
8a9faebc 3335
96b73e84 3336`guile-config' has been rewritten to get its information from
93617170 3337`pkg-config', so this should be a transparent change. Note however that
96b73e84
AW
3338guile.m4 has yet to be modified to call pkg-config instead of
3339guile-config.
2e77f720 3340
54dd0ca5
LC
3341** Guile now provides `guile-2.0.pc' instead of `guile-1.8.pc'
3342
3343Programs that use `pkg-config' to find Guile or one of its Autoconf
3344macros should now require `guile-2.0' instead of `guile-1.8'.
3345
96b73e84 3346** New installation directory: $(pkglibdir)/1.9/ccache
62560650 3347
96b73e84
AW
3348If $(libdir) is /usr/lib, for example, Guile will install its .go files
3349to /usr/lib/guile/1.9/ccache. These files are architecture-specific.
89bc270d 3350
b0abbaa7
AW
3351** Parallel installability fixes
3352
3353Guile now installs its header files to a effective-version-specific
3354directory, and includes the effective version (e.g. 2.0) in the library
3355name (e.g. libguile-2.0.so).
3356
3357This change should be transparent to users, who should detect Guile via
3358the guile.m4 macro, or the guile-2.0.pc pkg-config file. It will allow
3359parallel installs for multiple versions of Guile development
3360environments.
3361
b0217d17
AW
3362** Dynamically loadable extensions may be placed in a Guile-specific path
3363
3364Before, Guile only searched the system library paths for extensions
3365(e.g. /usr/lib), which meant that the names of Guile extensions had to
3366be globally unique. Installing them to a Guile-specific extensions
66ad445d 3367directory is cleaner. Use `pkg-config --variable=extensiondir
b0217d17
AW
3368guile-2.0' to get the location of the extensions directory.
3369
51cb0cca
AW
3370** User Scheme code may be placed in a version-specific path
3371
3372Before, there was only one way to install user Scheme code to a
3373version-specific Guile directory: install to Guile's own path,
3374e.g. /usr/share/guile/2.0. The site directory,
3375e.g. /usr/share/guile/site, was unversioned. This has been changed to
3376add a version-specific site directory, e.g. /usr/share/guile/site/2.0,
3377searched before the global site directory.
3378
7b96f3dd
LC
3379** New dependency: libgc
3380
3381See http://www.hpl.hp.com/personal/Hans_Boehm/gc/, for more information.
3382
3383** New dependency: GNU libunistring
32e29e24 3384
108e18b1 3385See http://www.gnu.org/software/libunistring/, for more information. Our
7b96f3dd 3386Unicode support uses routines from libunistring.
32e29e24 3387
dbd9532e
LC
3388** New dependency: libffi
3389
3390See http://sourceware.org/libffi/, for more information.
3391
a4f1c77d 3392
dc686d7b 3393\f
9957b1c7
LC
3394Changes in 1.8.8 (since 1.8.7)
3395
3396* Bugs fixed
3397
3398** Fix possible buffer overruns when parsing numbers
c15d8e6a 3399** Avoid clash with system setjmp/longjmp on IA64
1ff4da65 3400** Fix `wrong type arg' exceptions with IPv6 addresses
9957b1c7
LC
3401
3402\f
dc686d7b
NJ
3403Changes in 1.8.7 (since 1.8.6)
3404
922d417b
JG
3405* New modules (see the manual for details)
3406
3407** `(srfi srfi-98)', an interface to access environment variables
3408
dc686d7b
NJ
3409* Bugs fixed
3410
f5851b89 3411** Fix compilation with `--disable-deprecated'
dc686d7b 3412** Fix %fast-slot-ref/set!, to avoid possible segmentation fault
cbee5075 3413** Fix MinGW build problem caused by HAVE_STRUCT_TIMESPEC confusion
ab878b0f 3414** Fix build problem when scm_t_timespec is different from struct timespec
95a040cd 3415** Fix build when compiled with -Wundef -Werror
1bcf7993 3416** More build fixes for `alphaev56-dec-osf5.1b' (Tru64)
5374ec9c 3417** Build fixes for `powerpc-ibm-aix5.3.0.0' (AIX 5.3)
5c006c3f
LC
3418** With GCC, always compile with `-mieee' on `alpha*' and `sh*'
3419** Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130)
fc76c08d 3420** Fix parsing of SRFI-88/postfix keywords longer than 128 characters
40f89215 3421** Fix reading of complex numbers where both parts are inexact decimals
d41668fa 3422
ad5f5ada
NJ
3423** Allow @ macro to work with (ice-9 syncase)
3424
3425Previously, use of the @ macro in a module whose code is being
3426transformed by (ice-9 syncase) would cause an "Invalid syntax" error.
3427Now it works as you would expect (giving the value of the specified
3428module binding).
3429
05588a1a
LC
3430** Have `scm_take_locale_symbol ()' return an interned symbol (bug #25865)
3431
d41668fa 3432\f
8c40b75d
LC
3433Changes in 1.8.6 (since 1.8.5)
3434
071bb6a8
LC
3435* New features (see the manual for details)
3436
3437** New convenience function `scm_c_symbol_length ()'
3438
091baf9e
NJ
3439** Single stepping through code from Emacs
3440
3441When you use GDS to evaluate Scheme code from Emacs, you can now use
3442`C-u' to indicate that you want to single step through that code. See
3443`Evaluating Scheme Code' in the manual for more details.
3444
9e4db0ef
LC
3445** New "guile(1)" man page!
3446
242ebeaf
LC
3447* Changes to the distribution
3448
3449** Automake's `AM_MAINTAINER_MODE' is no longer used
3450
3451Thus, the `--enable-maintainer-mode' configure option is no longer
3452available: Guile is now always configured in "maintainer mode".
3453
e0063477
LC
3454** `ChangeLog' files are no longer updated
3455
3456Instead, changes are detailed in the version control system's logs. See
3457the top-level `ChangeLog' files for details.
3458
3459
8c40b75d
LC
3460* Bugs fixed
3461
fd2b17b9 3462** `symbol->string' now returns a read-only string, as per R5RS
c6333102 3463** Fix incorrect handling of the FLAGS argument of `fold-matches'
589d9eb8 3464** `guile-config link' now prints `-L$libdir' before `-lguile'
4a1db3a9 3465** Fix memory corruption involving GOOPS' `class-redefinition'
191e7165 3466** Fix possible deadlock in `mutex-lock'
95c6523b 3467** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro)
4696a666 3468** Fix build issue on mips, mipsel, powerpc and ia64 (stack direction)
450be18d 3469** Fix build issue on hppa2.0w-hp-hpux11.11 (`dirent64' and `readdir64_r')
88cefbc7 3470** Fix build issue on i386-unknown-freebsd7.0 ("break strict-aliasing rules")
76dae881 3471** Fix misleading output from `(help rationalize)'
5ea8e76e 3472** Fix build failure on Debian hppa architecture (bad stack growth detection)
1dd79792 3473** Fix `gcd' when called with a single, negative argument.
d8b6e191 3474** Fix `Stack overflow' errors seen when building on some platforms
ccf1ca4a
LC
3475** Fix bug when `scm_with_guile ()' was called several times from the
3476 same thread
76350432
LC
3477** The handler of SRFI-34 `with-exception-handler' is now invoked in the
3478 dynamic environment of the call to `raise'
cb823e63 3479** Fix potential deadlock in `make-struct'
691343ea 3480** Fix compilation problem with libltdl from Libtool 2.2.x
3ae3166b 3481** Fix sloppy bound checking in `string-{ref,set!}' with the empty string
6eadcdab 3482
8c40b75d 3483\f
5305df84
LC
3484Changes in 1.8.5 (since 1.8.4)
3485
4b824aae
LC
3486* Infrastructure changes
3487
3488** Guile repository switched from CVS to Git
3489
3490The new repository can be accessed using
3491"git-clone git://git.sv.gnu.org/guile.git", or can be browsed on-line at
3492http://git.sv.gnu.org/gitweb/?p=guile.git . See `README' for details.
3493
92826dd0
LC
3494** Add support for `pkg-config'
3495
3496See "Autoconf Support" in the manual for details.
3497
189681f5
LC
3498* New modules (see the manual for details)
3499
3500** `(srfi srfi-88)'
3501
ef4cbc08
LC
3502* New features (see the manual for details)
3503
3504** New `postfix' read option, for SRFI-88 keyword syntax
f5c2af4b 3505** Some I/O primitives have been inlined, which improves I/O performance
b20ef3a6 3506** New object-based traps infrastructure
ef4cbc08 3507
b20ef3a6
NJ
3508This is a GOOPS-based infrastructure that builds on Guile's low-level
3509evaluator trap calls and facilitates the development of debugging
3510features like single-stepping, breakpoints, tracing and profiling.
3511See the `Traps' node of the manual for details.
3512
3513** New support for working on Guile code from within Emacs
3514
3515Guile now incorporates the `GDS' library (previously distributed
3516separately) for working on Guile code from within Emacs. See the
3517`Using Guile In Emacs' node of the manual for details.
3518
5305df84
LC
3519* Bugs fixed
3520
e27d2495
LC
3521** `scm_add_slot ()' no longer segfaults (fixes bug #22369)
3522** Fixed `(ice-9 match)' for patterns like `((_ ...) ...)'
3523
3524Previously, expressions like `(match '((foo) (bar)) (((_ ...) ...) #t))'
3525would trigger an unbound variable error for `match:andmap'.
3526
62c5382b
LC
3527** `(oop goops describe)' now properly provides the `describe' feature
3528** Fixed `args-fold' from `(srfi srfi-37)'
3529
3530Previously, parsing short option names of argument-less options would
3531lead to a stack overflow.
3532
816e3edf 3533** `(srfi srfi-35)' is now visible through `cond-expand'
61b6542a 3534** Fixed type-checking for the second argument of `eval'
0fb11ae4 3535** Fixed type-checking for SRFI-1 `partition'
f1c212b1
LC
3536** Fixed `struct-ref' and `struct-set!' on "light structs"
3537** Honor struct field access rights in GOOPS
be10cba8 3538** Changed the storage strategy of source properties, which fixes a deadlock
979eade6 3539** Allow compilation of Guile-using programs in C99 mode with GCC 4.3 and later
bfb64eb4 3540** Fixed build issue for GNU/Linux on IA64
fa80e280 3541** Fixed build issues on NetBSD 1.6
a2c25234 3542** Fixed build issue on Solaris 2.10 x86_64
3f520967 3543** Fixed build issue with DEC/Compaq/HP's compiler
c2ad98ad
LC
3544** Fixed `scm_from_complex_double' build issue on FreeBSD
3545** Fixed `alloca' build issue on FreeBSD 6
a7286720 3546** Removed use of non-portable makefile constructs
535b3592 3547** Fixed shadowing of libc's <random.h> on Tru64, which broke compilation
eedcb08a 3548** Make sure all tests honor `$TMPDIR'
5305df84
LC
3549
3550\f
d41668fa
LC
3551Changes in 1.8.4 (since 1.8.3)
3552
3553* Bugs fixed
3554
3555** CR (ASCII 0x0d) is (again) recognized as a token delimiter by the reader
6e14de7d
NJ
3556** Fixed a segmentation fault which occurred when displaying the
3557backtrace of a stack with a promise object (made by `delay') in it.
7d1fc872 3558** Make `accept' leave guile mode while blocking
693758d5 3559** `scm_c_read ()' and `scm_c_write ()' now type-check their port argument
378cc645 3560** Fixed a build problem on AIX (use of func_data identifier)
15bd90ea
NJ
3561** Fixed a segmentation fault which occurred when hashx-ref or hashx-set! was
3562called with an associator proc that returns neither a pair nor #f.
3ac8359a 3563** Secondary threads now always return a valid module for (current-module).
d05bcb2e
NJ
3564** Avoid MacOS build problems caused by incorrect combination of "64"
3565system and library calls.
9a6fac59 3566** `guile-snarf' now honors `$TMPDIR'
25a640ca 3567** `guile-config compile' now reports CPPFLAGS used at compile-time
7f74cf9a 3568** Fixed build with Sun Studio (Solaris 9)
4a19ed04
NJ
3569** Fixed wrong-type-arg errors when creating zero length SRFI-4
3570uniform vectors on AIX.
86a597f8 3571** Fixed a deadlock that occurs upon GC with multiple threads.
4b26c03e 3572** Fixed compile problem with GCC on Solaris and AIX (use of _Complex_I)
d4a00708 3573** Fixed autotool-derived build problems on AIX 6.1.
9a6fac59 3574** Fixed NetBSD/alpha support
b226295a 3575** Fixed MacOS build problem caused by use of rl_get_keymap(_name)
7d1fc872
LC
3576
3577* New modules (see the manual for details)
3578
3579** `(srfi srfi-69)'
d41668fa 3580
b226295a
NJ
3581* Documentation fixes and improvements
3582
3583** Removed premature breakpoint documentation
3584
3585The features described are not available in the series of 1.8.x
3586releases, so the documentation was misleading and has been removed.
3587
3588** More about Guile's default *random-state* variable
3589
3590** GOOPS: more about how to use `next-method'
3591
d3cf93bc
NJ
3592* Changes to the distribution
3593
3594** Corrected a few files that referred incorrectly to the old GPL + special exception licence
3595
3596In fact Guile since 1.8.0 has been licensed with the GNU Lesser
3597General Public License, and the few incorrect files have now been
3598fixed to agree with the rest of the Guile distribution.
3599
5e42b8e7
NJ
3600** Removed unnecessary extra copies of COPYING*
3601
3602The distribution now contains a single COPYING.LESSER at its top level.
3603
a4f1c77d 3604\f
d4c38221
LC
3605Changes in 1.8.3 (since 1.8.2)
3606
3607* New modules (see the manual for details)
3608
f50ca8da 3609** `(srfi srfi-35)'
d4c38221
LC
3610** `(srfi srfi-37)'
3611
e08f3f7a
LC
3612* Bugs fixed
3613
dc061a74 3614** The `(ice-9 slib)' module now works as expected
e08f3f7a 3615** Expressions like "(set! 'x #t)" no longer yield a crash
d7c0c26d 3616** Warnings about duplicate bindings now go to stderr
1ac5fb45 3617** A memory leak in `make-socket-address' was fixed
f43f3620 3618** Alignment issues (e.g., on SPARC) in network routines were fixed
29776e85 3619** A threading issue that showed up at least on NetBSD was fixed
66302618 3620** Build problems on Solaris and IRIX fixed
e08f3f7a 3621
1fdd8ffa
LC
3622* Implementation improvements
3623
7ff6c169 3624** The reader is now faster, which reduces startup time
1fdd8ffa
LC
3625** Procedures returned by `record-accessor' and `record-modifier' are faster
3626
d4c38221 3627\f
45c0ff10
KR
3628Changes in 1.8.2 (since 1.8.1):
3629
3630* New procedures (see the manual for details)
3631
3632** set-program-arguments
b3aa4626 3633** make-vtable
45c0ff10 3634
9320e933
LC
3635* Incompatible changes
3636
3637** The body of a top-level `define' no longer sees the binding being created
3638
3639In a top-level `define', the binding being created is no longer visible
3640from the `define' body. This breaks code like
3641"(define foo (begin (set! foo 1) (+ foo 1)))", where `foo' is now
3642unbound in the body. However, such code was not R5RS-compliant anyway,
3643per Section 5.2.1.
3644
45c0ff10
KR
3645* Bugs fixed
3646
3647** Fractions were not `equal?' if stored in unreduced form.
3648(A subtle problem, since printing a value reduced it, making it work.)
3649** srfi-60 `copy-bit' failed on 64-bit systems
3650** "guile --use-srfi" option at the REPL can replace core functions
3651(Programs run with that option were ok, but in the interactive REPL
3652the core bindings got priority, preventing SRFI replacements or
3653extensions.)
3654** `regexp-exec' doesn't abort() on #\nul in the input or bad flags arg
df449722 3655** `kill' on mingw throws an error for a PID other than oneself
45c0ff10
KR
3656** Procedure names are attached to procedure-with-setters
3657** Array read syntax works with negative lower bound
3658** `array-in-bounds?' fix if an array has different lower bounds on each index
3659** `*' returns exact 0 for "(* inexact 0)"
3660This follows what it always did for "(* 0 inexact)".
c122500a 3661** SRFI-19: Value returned by `(current-time time-process)' was incorrect
0867f7ba 3662** SRFI-19: `date->julian-day' did not account for timezone offset
a1ef7406 3663** `ttyname' no longer crashes when passed a non-tty argument
27782696 3664** `inet-ntop' no longer crashes on SPARC when passed an `AF_INET' address
0867f7ba 3665** Small memory leaks have been fixed in `make-fluid' and `add-history'
b1f57ea4 3666** GOOPS: Fixed a bug in `method-more-specific?'
45c0ff10 3667** Build problems on Solaris fixed
df449722
LC
3668** Build problems on HP-UX IA64 fixed
3669** Build problems on MinGW fixed
45c0ff10
KR
3670
3671\f
a4f1c77d
KR
3672Changes in 1.8.1 (since 1.8.0):
3673
8ab3d8a0 3674* LFS functions are now used to access 64-bit files on 32-bit systems.
a4f1c77d 3675
8ab3d8a0 3676* New procedures (see the manual for details)
4f416616 3677
8ab3d8a0
KR
3678** primitive-_exit - [Scheme] the-root-module
3679** scm_primitive__exit - [C]
3680** make-completion-function - [Scheme] (ice-9 readline)
3681** scm_c_locale_stringn_to_number - [C]
3682** scm_srfi1_append_reverse [C]
3683** scm_srfi1_append_reverse_x [C]
3684** scm_log - [C]
3685** scm_log10 - [C]
3686** scm_exp - [C]
3687** scm_sqrt - [C]
3688
3689* Bugs fixed
3690
3691** Build problems have been fixed on MacOS, SunOS, and QNX.
af4f8612 3692
b3aa4626
KR
3693** `strftime' fix sign of %z timezone offset.
3694
534cd148 3695** A one-dimensional array can now be 'equal?' to a vector.
8ab3d8a0 3696
ad97642e 3697** Structures, records, and SRFI-9 records can now be compared with `equal?'.
af4f8612 3698
8ab3d8a0
KR
3699** SRFI-14 standard char sets are recomputed upon a successful `setlocale'.
3700
3701** `record-accessor' and `record-modifier' now have strict type checks.
3702
3703Record accessor and modifier procedures now throw an error if the
3704record type of the record they're given is not the type expected.
3705(Previously accessors returned #f and modifiers silently did nothing).
3706
3707** It is now OK to use both autoload and use-modules on a given module.
3708
3709** `apply' checks the number of arguments more carefully on "0 or 1" funcs.
3710
3711Previously there was no checking on primatives like make-vector that
3712accept "one or two" arguments. Now there is.
3713
3714** The srfi-1 assoc function now calls its equality predicate properly.
3715
3716Previously srfi-1 assoc would call the equality predicate with the key
3717last. According to the SRFI, the key should be first.
3718
3719** A bug in n-par-for-each and n-for-each-par-map has been fixed.
3720
3721** The array-set! procedure no longer segfaults when given a bit vector.
3722
3723** Bugs in make-shared-array have been fixed.
3724
3725** string<? and friends now follow char<? etc order on 8-bit chars.
3726
3727** The format procedure now handles inf and nan values for ~f correctly.
3728
3729** exact->inexact should no longer overflow when given certain large fractions.
3730
3731** srfi-9 accessor and modifier procedures now have strict record type checks.
a4f1c77d 3732
8ab3d8a0 3733This matches the srfi-9 specification.
a4f1c77d 3734
8ab3d8a0 3735** (ice-9 ftw) procedures won't ignore different files with same inode number.
a4f1c77d 3736
8ab3d8a0
KR
3737Previously the (ice-9 ftw) procedures would ignore any file that had
3738the same inode number as a file they had already seen, even if that
3739file was on a different device.
4f416616
KR
3740
3741\f
8ab3d8a0 3742Changes in 1.8.0 (changes since the 1.6.x series):
ee0c7345 3743
4e250ded
MV
3744* Changes to the distribution
3745
eff2965e
MV
3746** Guile is now licensed with the GNU Lesser General Public License.
3747
77e51fd6
MV
3748** The manual is now licensed with the GNU Free Documentation License.
3749
e2d0a649
RB
3750** Guile now requires GNU MP (http://swox.com/gmp).
3751
3752Guile now uses the GNU MP library for arbitrary precision arithmetic.
e2d0a649 3753
5ebbe4ef
RB
3754** Guile now has separate private and public configuration headers.
3755
b0d10ba6
MV
3756That is, things like HAVE_STRING_H no longer leak from Guile's
3757headers.
5ebbe4ef
RB
3758
3759** Guile now provides and uses an "effective" version number.
b2cbe8d8
RB
3760
3761Guile now provides scm_effective_version and effective-version
3762functions which return the "effective" version number. This is just
3763the normal full version string without the final micro-version number,
a4f1c77d 3764so the current effective-version is "1.8". The effective version
b2cbe8d8
RB
3765should remain unchanged during a stable series, and should be used for
3766items like the versioned share directory name
a4f1c77d 3767i.e. /usr/share/guile/1.8.
b2cbe8d8
RB
3768
3769Providing an unchanging version number during a stable release for
3770things like the versioned share directory can be particularly
3771important for Guile "add-on" packages, since it provides a directory
3772that they can install to that won't be changed out from under them
3773with each micro release during a stable series.
3774
8d54e73a 3775** Thread implementation has changed.
f0b4d944
MV
3776
3777When you configure "--with-threads=null", you will get the usual
3778threading API (call-with-new-thread, make-mutex, etc), but you can't
429d88d4
MV
3779actually create new threads. Also, "--with-threads=no" is now
3780equivalent to "--with-threads=null". This means that the thread API
3781is always present, although you might not be able to create new
3782threads.
f0b4d944 3783
8d54e73a
MV
3784When you configure "--with-threads=pthreads" or "--with-threads=yes",
3785you will get threads that are implemented with the portable POSIX
3786threads. These threads can run concurrently (unlike the previous
3787"coop" thread implementation), but need to cooperate for things like
a558cc63 3788the GC.
f0b4d944 3789
8d54e73a
MV
3790The default is "pthreads", unless your platform doesn't have pthreads,
3791in which case "null" threads are used.
2902a459 3792
a6d75e53
MV
3793See the manual for details, nodes "Initialization", "Multi-Threading",
3794"Blocking", and others.
a558cc63 3795
f74bdbd3
MV
3796** There is the new notion of 'discouraged' features.
3797
3798This is a milder form of deprecation.
3799
3800Things that are discouraged should not be used in new code, but it is
3801OK to leave them in old code for now. When a discouraged feature is
3802used, no warning message is printed like there is for 'deprecated'
3803features. Also, things that are merely discouraged are nevertheless
3804implemented efficiently, while deprecated features can be very slow.
3805
3806You can omit discouraged features from libguile by configuring it with
3807the '--disable-discouraged' option.
3808
3809** Deprecation warnings can be controlled at run-time.
3810
3811(debug-enable 'warn-deprecated) switches them on and (debug-disable
3812'warn-deprecated) switches them off.
3813
0f24e75b 3814** Support for SRFI 61, extended cond syntax for multiple values has
a81d0de1
MV
3815 been added.
3816
3817This SRFI is always available.
3818
f7fb2f39 3819** Support for require-extension, SRFI-55, has been added.
9a5fc8c2 3820
f7fb2f39
RB
3821The SRFI-55 special form `require-extension' has been added. It is
3822available at startup, and provides a portable way to load Scheme
3823extensions. SRFI-55 only requires support for one type of extension,
3824"srfi"; so a set of SRFIs may be loaded via (require-extension (srfi 1
382513 14)).
3826
3827** New module (srfi srfi-26) provides support for `cut' and `cute'.
3828
3829The (srfi srfi-26) module is an implementation of SRFI-26 which
3830provides the `cut' and `cute' syntax. These may be used to specialize
3831parameters without currying.
9a5fc8c2 3832
f5d54eb7
RB
3833** New module (srfi srfi-31)
3834
3835This is an implementation of SRFI-31 which provides a special form
3836`rec' for recursive evaluation.
3837
7b1574ed
MV
3838** The modules (srfi srfi-13), (srfi srfi-14) and (srfi srfi-4) have
3839 been merged with the core, making their functionality always
3840 available.
c5080b51 3841
ce7c0293
MV
3842The modules are still available, tho, and you could use them together
3843with a renaming import, for example.
c5080b51 3844
6191ccec 3845** Guile no longer includes its own version of libltdl.
4e250ded 3846
6191ccec 3847The official version is good enough now.
4e250ded 3848
ae7ded56
MV
3849** The --enable-htmldoc option has been removed from 'configure'.
3850
3851Support for translating the documentation into HTML is now always
3852provided. Use 'make html'.
3853
0f24e75b
MV
3854** New module (ice-9 serialize):
3855
3856(serialize FORM1 ...) and (parallelize FORM1 ...) are useful when you
3857don't trust the thread safety of most of your program, but where you
3858have some section(s) of code which you consider can run in parallel to
3859other sections. See ice-9/serialize.scm for more information.
3860
c34e5780
MV
3861** The configure option '--disable-arrays' has been removed.
3862
3863Support for arrays and uniform numeric arrays is now always included
3864in Guile.
3865
328dc9a3 3866* Changes to the stand-alone interpreter
f12ef3fd 3867
3ece39d6
MV
3868** New command line option `-L'.
3869
3870This option adds a directory to the front of the load path.
3871
f12ef3fd
MV
3872** New command line option `--no-debug'.
3873
3874Specifying `--no-debug' on the command line will keep the debugging
3875evaluator turned off, even for interactive sessions.
3876
3877** User-init file ~/.guile is now loaded with the debugging evaluator.
3878
3879Previously, the normal evaluator would have been used. Using the
3880debugging evaluator gives better error messages.
3881
aff7e166
MV
3882** The '-e' option now 'read's its argument.
3883
3884This is to allow the new '(@ MODULE-NAME VARIABLE-NAME)' construct to
3885be used with '-e'. For example, you can now write a script like
3886
3887 #! /bin/sh
3888 exec guile -e '(@ (demo) main)' -s "$0" "$@"
3889 !#
3890
3891 (define-module (demo)
3892 :export (main))
3893
3894 (define (main args)
3895 (format #t "Demo: ~a~%" args))
3896
3897
f12ef3fd
MV
3898* Changes to Scheme functions and syntax
3899
930888e8
MV
3900** Guardians have changed back to their original semantics
3901
3902Guardians now behave like described in the paper by Dybvig et al. In
3903particular, they no longer make guarantees about the order in which
3904they return objects, and they can no longer be greedy.
3905
3906They no longer drop cyclic data structures.
3907
3908The C function scm_make_guardian has been changed incompatibly and no
3909longer takes the 'greedy_p' argument.
3910
87bdbdbc
MV
3911** New function hashx-remove!
3912
3913This function completes the set of 'hashx' functions.
3914
a558cc63
MV
3915** The concept of dynamic roots has been factored into continuation
3916 barriers and dynamic states.
3917
3918Each thread has a current dynamic state that carries the values of the
3919fluids. You can create and copy dynamic states and use them as the
3920second argument for 'eval'. See "Fluids and Dynamic States" in the
3921manual.
3922
3923To restrict the influence that captured continuations can have on the
3924control flow, you can errect continuation barriers. See "Continuation
3925Barriers" in the manual.
3926
3927The function call-with-dynamic-root now essentially temporarily
3928installs a new dynamic state and errects a continuation barrier.
3929
a2b6a0e7
MV
3930** The default load path no longer includes "." at the end.
3931
3932Automatically loading modules from the current directory should not
3933happen by default. If you want to allow it in a more controlled
3934manner, set the environment variable GUILE_LOAD_PATH or the Scheme
3935variable %load-path.
3936
7b1574ed
MV
3937** The uniform vector and array support has been overhauled.
3938
3939It now complies with SRFI-4 and the weird prototype based uniform
3940array creation has been deprecated. See the manual for more details.
3941
d233b123
MV
3942Some non-compatible changes have been made:
3943 - characters can no longer be stored into byte arrays.
0f24e75b
MV
3944 - strings and bit vectors are no longer considered to be uniform numeric
3945 vectors.
3167d5e4
MV
3946 - array-rank throws an error for non-arrays instead of returning zero.
3947 - array-ref does no longer accept non-arrays when no indices are given.
d233b123
MV
3948
3949There is the new notion of 'generalized vectors' and corresponding
3950procedures like 'generalized-vector-ref'. Generalized vectors include
c34e5780 3951strings, bitvectors, ordinary vectors, and uniform numeric vectors.
d233b123 3952
a558cc63
MV
3953Arrays use generalized vectors as their storage, so that you still
3954have arrays of characters, bits, etc. However, uniform-array-read!
3955and uniform-array-write can no longer read/write strings and
3956bitvectors.
bb9f50ae 3957
ce7c0293
MV
3958** There is now support for copy-on-write substrings, mutation-sharing
3959 substrings and read-only strings.
3ff9283d 3960
ce7c0293
MV
3961Three new procedures are related to this: substring/shared,
3962substring/copy, and substring/read-only. See the manual for more
3963information.
3964
6a1d27ea
MV
3965** Backtraces will now highlight the value that caused the error.
3966
3967By default, these values are enclosed in "{...}", such as in this
3968example:
3969
3970 guile> (car 'a)
3971
3972 Backtrace:
3973 In current input:
3974 1: 0* [car {a}]
3975
3976 <unnamed port>:1:1: In procedure car in expression (car (quote a)):
3977 <unnamed port>:1:1: Wrong type (expecting pair): a
3978 ABORT: (wrong-type-arg)
3979
3980The prefix and suffix used for highlighting can be set via the two new
3981printer options 'highlight-prefix' and 'highlight-suffix'. For
3982example, putting this into ~/.guile will output the bad value in bold
3983on an ANSI terminal:
3984
3985 (print-set! highlight-prefix "\x1b[1m")
3986 (print-set! highlight-suffix "\x1b[22m")
3987
3988
8dbafacd
MV
3989** 'gettext' support for internationalization has been added.
3990
3991See the manual for details.
3992
aff7e166
MV
3993** New syntax '@' and '@@':
3994
3995You can now directly refer to variables exported from a module by
3996writing
3997
3998 (@ MODULE-NAME VARIABLE-NAME)
3999
4000For example (@ (ice-9 pretty-print) pretty-print) will directly access
4001the pretty-print variable exported from the (ice-9 pretty-print)
4002module. You don't need to 'use' that module first. You can also use
b0d10ba6 4003'@' as a target of 'set!', as in (set! (@ mod var) val).
aff7e166
MV
4004
4005The related syntax (@@ MODULE-NAME VARIABLE-NAME) works just like '@',
4006but it can also access variables that have not been exported. It is
4007intended only for kluges and temporary fixes and for debugging, not
4008for ordinary code.
4009
aef0bdb4
MV
4010** Keyword syntax has been made more disciplined.
4011
4012Previously, the name of a keyword was read as a 'token' but printed as
4013a symbol. Now, it is read as a general Scheme datum which must be a
4014symbol.
4015
4016Previously:
4017
4018 guile> #:12
4019 #:#{12}#
4020 guile> #:#{12}#
4021 #:#{\#{12}\#}#
4022 guile> #:(a b c)
4023 #:#{}#
4024 ERROR: In expression (a b c):
4025 Unbound variable: a
4026 guile> #: foo
4027 #:#{}#
4028 ERROR: Unbound variable: foo
4029
4030Now:
4031
4032 guile> #:12
4033 ERROR: Wrong type (expecting symbol): 12
4034 guile> #:#{12}#
4035 #:#{12}#
4036 guile> #:(a b c)
4037 ERROR: Wrong type (expecting symbol): (a b c)
4038 guile> #: foo
4039 #:foo
4040
227eafdb
MV
4041** The printing of symbols that might look like keywords can be
4042 controlled.
4043
4044The new printer option 'quote-keywordish-symbols' controls how symbols
4045are printed that have a colon as their first or last character. The
4046default now is to only quote a symbol with #{...}# when the read
4047option 'keywords' is not '#f'. Thus:
4048
4049 guile> (define foo (string->symbol ":foo"))
4050 guile> (read-set! keywords #f)
4051 guile> foo
4052 :foo
4053 guile> (read-set! keywords 'prefix)
4054 guile> foo
4055 #{:foo}#
4056 guile> (print-set! quote-keywordish-symbols #f)
4057 guile> foo
4058 :foo
4059
1363e3e7
KR
4060** 'while' now provides 'break' and 'continue'
4061
4062break and continue were previously bound in a while loop, but not
4063documented, and continue didn't quite work properly. The undocumented
4064parameter to break which gave a return value for the while has been
4065dropped.
4066
570b5b14
MV
4067** 'call-with-current-continuation' is now also available under the name
4068 'call/cc'.
4069
b0d10ba6 4070** The module system now checks for duplicate bindings.
7b07e5ef 4071
fe6ee052
MD
4072The module system now can check for name conflicts among imported
4073bindings.
f595ccfe 4074
b0d10ba6 4075The behavior can be controlled by specifying one or more 'duplicates'
fe6ee052
MD
4076handlers. For example, to make Guile return an error for every name
4077collision, write:
7b07e5ef
MD
4078
4079(define-module (foo)
4080 :use-module (bar)
4081 :use-module (baz)
fe6ee052 4082 :duplicates check)
f595ccfe 4083
fe6ee052
MD
4084The new default behavior of the module system when a name collision
4085has been detected is to
4086
4087 1. Give priority to bindings marked as a replacement.
6496a663 4088 2. Issue a warning (different warning if overriding core binding).
fe6ee052
MD
4089 3. Give priority to the last encountered binding (this corresponds to
4090 the old behavior).
4091
4092If you want the old behavior back without replacements or warnings you
4093can add the line:
f595ccfe 4094
70a9dc9c 4095 (default-duplicate-binding-handler 'last)
7b07e5ef 4096
fe6ee052 4097to your .guile init file.
7b07e5ef 4098
f595ccfe
MD
4099** New define-module option: :replace
4100
4101:replace works as :export, but, in addition, marks the binding as a
4102replacement.
4103
4104A typical example is `format' in (ice-9 format) which is a replacement
4105for the core binding `format'.
7b07e5ef 4106
70da0033
MD
4107** Adding prefixes to imported bindings in the module system
4108
4109There is now a new :use-module option :prefix. It can be used to add
4110a prefix to all imported bindings.
4111
4112 (define-module (foo)
4113 :use-module ((bar) :prefix bar:))
4114
4115will import all bindings exported from bar, but rename them by adding
4116the prefix `bar:'.
4117
b0d10ba6
MV
4118** Conflicting generic functions can be automatically merged.
4119
4120When two imported bindings conflict and they are both generic
4121functions, the two functions can now be merged automatically. This is
4122activated with the 'duplicates' handler 'merge-generics'.
4123
b2cbe8d8
RB
4124** New function: effective-version
4125
4126Returns the "effective" version number. This is just the normal full
4127version string without the final micro-version number. See "Changes
4128to the distribution" above.
4129
382053e9 4130** New threading functions: parallel, letpar, par-map, and friends
dbe30084 4131
382053e9
KR
4132These are convenient ways to run calculations in parallel in new
4133threads. See "Parallel forms" in the manual for details.
359aab24 4134
e2d820a1
MV
4135** New function 'try-mutex'.
4136
4137This function will attempt to lock a mutex but will return immediately
0f24e75b 4138instead of blocking and indicate failure.
e2d820a1
MV
4139
4140** Waiting on a condition variable can have a timeout.
4141
0f24e75b 4142The function 'wait-condition-variable' now takes a third, optional
e2d820a1
MV
4143argument that specifies the point in time where the waiting should be
4144aborted.
4145
4146** New function 'broadcast-condition-variable'.
4147
5e405a60
MV
4148** New functions 'all-threads' and 'current-thread'.
4149
4150** Signals and system asyncs work better with threads.
4151
4152The function 'sigaction' now takes a fourth, optional, argument that
4153specifies the thread that the handler should run in. When the
4154argument is omitted, the handler will run in the thread that called
4155'sigaction'.
4156
4157Likewise, 'system-async-mark' takes a second, optional, argument that
4158specifies the thread that the async should run in. When it is
4159omitted, the async will run in the thread that called
4160'system-async-mark'.
4161
4162C code can use the new functions scm_sigaction_for_thread and
4163scm_system_async_mark_for_thread to pass the new thread argument.
4164
a558cc63
MV
4165When a thread blocks on a mutex, a condition variable or is waiting
4166for IO to be possible, it will still execute system asyncs. This can
4167be used to interrupt such a thread by making it execute a 'throw', for
4168example.
4169
5e405a60
MV
4170** The function 'system-async' is deprecated.
4171
4172You can now pass any zero-argument procedure to 'system-async-mark'.
4173The function 'system-async' will just return its argument unchanged
4174now.
4175
acfa1f52
MV
4176** New functions 'call-with-blocked-asyncs' and
4177 'call-with-unblocked-asyncs'
4178
4179The expression (call-with-blocked-asyncs PROC) will call PROC and will
4180block execution of system asyncs for the current thread by one level
4181while PROC runs. Likewise, call-with-unblocked-asyncs will call a
4182procedure and will unblock the execution of system asyncs by one
4183level for the current thread.
4184
4185Only system asyncs are affected by these functions.
4186
4187** The functions 'mask-signals' and 'unmask-signals' are deprecated.
4188
4189Use 'call-with-blocked-asyncs' or 'call-with-unblocked-asyncs'
4190instead. Those functions are easier to use correctly and can be
4191nested.
4192
7b232758
MV
4193** New function 'unsetenv'.
4194
f30482f3
MV
4195** New macro 'define-syntax-public'.
4196
4197It works like 'define-syntax' and also exports the defined macro (but
4198only on top-level).
4199
1ee34062
MV
4200** There is support for Infinity and NaNs.
4201
4202Following PLT Scheme, Guile can now work with infinite numbers, and
4203'not-a-numbers'.
4204
4205There is new syntax for numbers: "+inf.0" (infinity), "-inf.0"
4206(negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as
4207"+nan.0"). These numbers are inexact and have no exact counterpart.
4208
4209Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the
4210sign of the dividend. The infinities are integers, and they answer #t
4211for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is
4212not '=' to itself, but '+nan.0' is 'eqv?' to itself.
4213
4214For example
4215
4216 (/ 1 0.0)
4217 => +inf.0
4218
4219 (/ 0 0.0)
4220 => +nan.0
4221
4222 (/ 0)
4223 ERROR: Numerical overflow
4224
7b232758
MV
4225Two new predicates 'inf?' and 'nan?' can be used to test for the
4226special values.
4227
ba1b077b
MV
4228** Inexact zero can have a sign.
4229
4230Guile can now distinguish between plus and minus inexact zero, if your
4231platform supports this, too. The two zeros are equal according to
4232'=', but not according to 'eqv?'. For example
4233
4234 (- 0.0)
4235 => -0.0
4236
4237 (= 0.0 (- 0.0))
4238 => #t
4239
4240 (eqv? 0.0 (- 0.0))
4241 => #f
4242
bdf26b60
MV
4243** Guile now has exact rationals.
4244
4245Guile can now represent fractions such as 1/3 exactly. Computing with
4246them is also done exactly, of course:
4247
4248 (* 1/3 3/2)
4249 => 1/2
4250
4251** 'floor', 'ceiling', 'round' and 'truncate' now return exact numbers
4252 for exact arguments.
4253
4254For example: (floor 2) now returns an exact 2 where in the past it
4255returned an inexact 2.0. Likewise, (floor 5/4) returns an exact 1.
4256
4257** inexact->exact no longer returns only integers.
4258
4259Without exact rationals, the closest exact number was always an
4260integer, but now inexact->exact returns the fraction that is exactly
4261equal to a floating point number. For example:
4262
4263 (inexact->exact 1.234)
4264 => 694680242521899/562949953421312
4265
e299cee2 4266When you want the old behavior, use 'round' explicitly:
bdf26b60
MV
4267
4268 (inexact->exact (round 1.234))
4269 => 1
4270
4271** New function 'rationalize'.
4272
4273This function finds a simple fraction that is close to a given real
4274number. For example (and compare with inexact->exact above):
4275
fb16d26e 4276 (rationalize (inexact->exact 1.234) 1/2000)
bdf26b60
MV
4277 => 58/47
4278
fb16d26e
MV
4279Note that, as required by R5RS, rationalize returns only then an exact
4280result when both its arguments are exact.
4281
bdf26b60
MV
4282** 'odd?' and 'even?' work also for inexact integers.
4283
4284Previously, (odd? 1.0) would signal an error since only exact integers
4285were recognized as integers. Now (odd? 1.0) returns #t, (odd? 2.0)
4286returns #f and (odd? 1.5) signals an error.
4287
b0d10ba6 4288** Guile now has uninterned symbols.
610922b2 4289
b0d10ba6 4290The new function 'make-symbol' will return an uninterned symbol. This
610922b2
MV
4291is a symbol that is unique and is guaranteed to remain unique.
4292However, uninterned symbols can not yet be read back in.
4293
4294Use the new function 'symbol-interned?' to check whether a symbol is
4295interned or not.
4296
0e6f7775
MV
4297** pretty-print has more options.
4298
4299The function pretty-print from the (ice-9 pretty-print) module can now
4300also be invoked with keyword arguments that control things like
71f271b2 4301maximum output width. See the manual for details.
0e6f7775 4302
8c84b81e 4303** Variables have no longer a special behavior for `equal?'.
ee0c7345
MV
4304
4305Previously, comparing two variables with `equal?' would recursivly
4306compare their values. This is no longer done. Variables are now only
4307`equal?' if they are `eq?'.
4308
4e21fa60
MV
4309** `(begin)' is now valid.
4310
4311You can now use an empty `begin' form. It will yield #<unspecified>
4312when evaluated and simply be ignored in a definition context.
4313
3063e30a
DH
4314** Deprecated: procedure->macro
4315
b0d10ba6
MV
4316Change your code to use 'define-macro' or r5rs macros. Also, be aware
4317that macro expansion will not be done during evaluation, but prior to
4318evaluation.
3063e30a 4319
0a50eeaa
NJ
4320** Soft ports now allow a `char-ready?' procedure
4321
4322The vector argument to `make-soft-port' can now have a length of
4323either 5 or 6. (Previously the length had to be 5.) The optional 6th
4324element is interpreted as an `input-waiting' thunk -- i.e. a thunk
4325that returns the number of characters that can be read immediately
4326without the soft port blocking.
4327
63dd3413
DH
4328** Deprecated: undefine
4329
4330There is no replacement for undefine.
4331
9abd541e
NJ
4332** The functions make-keyword-from-dash-symbol and keyword-dash-symbol
4333 have been discouraged.
aef0bdb4
MV
4334
4335They are relics from a time where a keyword like #:foo was used
4336directly as a Tcl option "-foo" and thus keywords were internally
4337stored as a symbol with a starting dash. We now store a symbol
4338without the dash.
4339
4340Use symbol->keyword and keyword->symbol instead.
4341
9abd541e
NJ
4342** The `cheap' debug option is now obsolete
4343
4344Evaluator trap calls are now unconditionally "cheap" - in other words,
4345they pass a debug object to the trap handler rather than a full
4346continuation. The trap handler code can capture a full continuation
4347by using `call-with-current-continuation' in the usual way, if it so
4348desires.
4349
4350The `cheap' option is retained for now so as not to break existing
4351code which gets or sets it, but setting it now has no effect. It will
4352be removed in the next major Guile release.
4353
4354** Evaluator trap calls now support `tweaking'
4355
4356`Tweaking' means that the trap handler code can modify the Scheme
4357expression that is about to be evaluated (in the case of an
4358enter-frame trap) or the value that is being returned (in the case of
4359an exit-frame trap). The trap handler code indicates that it wants to
4360do this by returning a pair whose car is the symbol 'instead and whose
4361cdr is the modified expression or return value.
36a9b236 4362
b00418df
DH
4363* Changes to the C interface
4364
87bdbdbc
MV
4365** The functions scm_hash_fn_remove_x and scm_hashx_remove_x no longer
4366 take a 'delete' function argument.
4367
4368This argument makes no sense since the delete function is used to
4369remove a pair from an alist, and this must not be configurable.
4370
4371This is an incompatible change.
4372
1cf1bb95
MV
4373** The GH interface is now subject to the deprecation mechanism
4374
4375The GH interface has been deprecated for quite some time but now it is
4376actually removed from Guile when it is configured with
4377--disable-deprecated.
4378
4379See the manual "Transitioning away from GH" for more information.
4380
f7f3964e
MV
4381** A new family of functions for converting between C values and
4382 Scheme values has been added.
4383
4384These functions follow a common naming scheme and are designed to be
4385easier to use, thread-safe and more future-proof than the older
4386alternatives.
4387
4388 - int scm_is_* (...)
4389
4390 These are predicates that return a C boolean: 1 or 0. Instead of
4391 SCM_NFALSEP, you can now use scm_is_true, for example.
4392
4393 - <type> scm_to_<type> (SCM val, ...)
4394
4395 These are functions that convert a Scheme value into an appropriate
4396 C value. For example, you can use scm_to_int to safely convert from
4397 a SCM to an int.
4398
a2b6a0e7 4399 - SCM scm_from_<type> (<type> val, ...)
f7f3964e
MV
4400
4401 These functions convert from a C type to a SCM value; for example,
4402 scm_from_int for ints.
4403
4404There is a huge number of these functions, for numbers, strings,
4405symbols, vectors, etc. They are documented in the reference manual in
4406the API section together with the types that they apply to.
4407
96d8c217
MV
4408** New functions for dealing with complex numbers in C have been added.
4409
4410The new functions are scm_c_make_rectangular, scm_c_make_polar,
4411scm_c_real_part, scm_c_imag_part, scm_c_magnitude and scm_c_angle.
4412They work like scm_make_rectangular etc but take or return doubles
4413directly.
4414
4415** The function scm_make_complex has been discouraged.
4416
4417Use scm_c_make_rectangular instead.
4418
f7f3964e
MV
4419** The INUM macros have been deprecated.
4420
4421A lot of code uses these macros to do general integer conversions,
b0d10ba6
MV
4422although the macros only work correctly with fixnums. Use the
4423following alternatives.
f7f3964e
MV
4424
4425 SCM_INUMP -> scm_is_integer or similar
4426 SCM_NINUMP -> !scm_is_integer or similar
4427 SCM_MAKINUM -> scm_from_int or similar
4428 SCM_INUM -> scm_to_int or similar
4429
b0d10ba6 4430 SCM_VALIDATE_INUM_* -> Do not use these; scm_to_int, etc. will
f7f3964e
MV
4431 do the validating for you.
4432
f9656a9f
MV
4433** The scm_num2<type> and scm_<type>2num functions and scm_make_real
4434 have been discouraged.
f7f3964e
MV
4435
4436Use the newer scm_to_<type> and scm_from_<type> functions instead for
4437new code. The functions have been discouraged since they don't fit
4438the naming scheme.
4439
4440** The 'boolean' macros SCM_FALSEP etc have been discouraged.
4441
4442They have strange names, especially SCM_NFALSEP, and SCM_BOOLP
4443evaluates its argument twice. Use scm_is_true, etc. instead for new
4444code.
4445
4446** The macro SCM_EQ_P has been discouraged.
4447
4448Use scm_is_eq for new code, which fits better into the naming
4449conventions.
d5b203a6 4450
d5ac9b2a
MV
4451** The macros SCM_CONSP, SCM_NCONSP, SCM_NULLP, and SCM_NNULLP have
4452 been discouraged.
4453
4454Use the function scm_is_pair or scm_is_null instead.
4455
409eb4e5
MV
4456** The functions scm_round and scm_truncate have been deprecated and
4457 are now available as scm_c_round and scm_c_truncate, respectively.
4458
4459These functions occupy the names that scm_round_number and
4460scm_truncate_number should have.
4461
3ff9283d
MV
4462** The functions scm_c_string2str, scm_c_substring2str, and
4463 scm_c_symbol2str have been deprecated.
c41acab3
MV
4464
4465Use scm_to_locale_stringbuf or similar instead, maybe together with
4466scm_substring.
4467
3ff9283d
MV
4468** New functions scm_c_make_string, scm_c_string_length,
4469 scm_c_string_ref, scm_c_string_set_x, scm_c_substring,
4470 scm_c_substring_shared, scm_c_substring_copy.
4471
4472These are like scm_make_string, scm_length, etc. but are slightly
4473easier to use from C.
4474
4475** The macros SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_LENGTH,
4476 SCM_SYMBOL_CHARS, and SCM_SYMBOL_LENGTH have been deprecated.
4477
4478They export too many assumptions about the implementation of strings
4479and symbols that are no longer true in the presence of
b0d10ba6
MV
4480mutation-sharing substrings and when Guile switches to some form of
4481Unicode.
3ff9283d
MV
4482
4483When working with strings, it is often best to use the normal string
4484functions provided by Guile, such as scm_c_string_ref,
b0d10ba6
MV
4485scm_c_string_set_x, scm_string_append, etc. Be sure to look in the
4486manual since many more such functions are now provided than
4487previously.
3ff9283d
MV
4488
4489When you want to convert a SCM string to a C string, use the
4490scm_to_locale_string function or similar instead. For symbols, use
4491scm_symbol_to_string and then work with that string. Because of the
4492new string representation, scm_symbol_to_string does not need to copy
4493and is thus quite efficient.
4494
aef0bdb4 4495** Some string, symbol and keyword functions have been discouraged.
3ff9283d 4496
b0d10ba6 4497They don't fit into the uniform naming scheme and are not explicit
3ff9283d
MV
4498about the character encoding.
4499
4500Replace according to the following table:
4501
4502 scm_allocate_string -> scm_c_make_string
4503 scm_take_str -> scm_take_locale_stringn
4504 scm_take0str -> scm_take_locale_string
4505 scm_mem2string -> scm_from_locale_stringn
4506 scm_str2string -> scm_from_locale_string
4507 scm_makfrom0str -> scm_from_locale_string
4508 scm_mem2symbol -> scm_from_locale_symboln
b0d10ba6 4509 scm_mem2uninterned_symbol -> scm_from_locale_stringn + scm_make_symbol
3ff9283d
MV
4510 scm_str2symbol -> scm_from_locale_symbol
4511
4512 SCM_SYMBOL_HASH -> scm_hashq
4513 SCM_SYMBOL_INTERNED_P -> scm_symbol_interned_p
4514
aef0bdb4
MV
4515 scm_c_make_keyword -> scm_from_locale_keyword
4516
4517** The functions scm_keyword_to_symbol and sym_symbol_to_keyword are
4518 now also available to C code.
4519
4520** SCM_KEYWORDP and SCM_KEYWORDSYM have been deprecated.
4521
4522Use scm_is_keyword and scm_keyword_to_symbol instead, but note that
4523the latter returns the true name of the keyword, not the 'dash name',
4524as SCM_KEYWORDSYM used to do.
4525
dc91d8de
MV
4526** A new way to access arrays in a thread-safe and efficient way has
4527 been added.
4528
4529See the manual, node "Accessing Arrays From C".
4530
3167d5e4
MV
4531** The old uniform vector and bitvector implementations have been
4532 unceremoniously removed.
d4ea47c8 4533
a558cc63 4534This implementation exposed the details of the tagging system of
d4ea47c8 4535Guile. Use the new C API explained in the manual in node "Uniform
c34e5780 4536Numeric Vectors" and "Bit Vectors", respectively.
d4ea47c8
MV
4537
4538The following macros are gone: SCM_UVECTOR_BASE, SCM_SET_UVECTOR_BASE,
4539SCM_UVECTOR_MAXLENGTH, SCM_UVECTOR_LENGTH, SCM_MAKE_UVECTOR_TAG,
3167d5e4
MV
4540SCM_SET_UVECTOR_LENGTH, SCM_BITVECTOR_P, SCM_BITVECTOR_BASE,
4541SCM_SET_BITVECTOR_BASE, SCM_BITVECTOR_MAX_LENGTH,
4542SCM_BITVECTOR_LENGTH, SCM_MAKE_BITVECTOR_TAG,
0b63c1ee
MV
4543SCM_SET_BITVECTOR_LENGTH, SCM_BITVEC_REF, SCM_BITVEC_SET,
4544SCM_BITVEC_CLR.
d4ea47c8 4545
c34e5780
MV
4546** The macros dealing with vectors have been deprecated.
4547
4548Use the new functions scm_is_vector, scm_vector_elements,
0b63c1ee
MV
4549scm_vector_writable_elements, etc, or scm_is_simple_vector,
4550SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, etc instead. See the
4551manual for more details.
c34e5780
MV
4552
4553Deprecated are SCM_VECTORP, SCM_VELTS, SCM_VECTOR_MAX_LENGTH,
4554SCM_VECTOR_LENGTH, SCM_VECTOR_REF, SCM_VECTOR_SET, SCM_WRITABLE_VELTS.
4555
4556The following macros have been removed: SCM_VECTOR_BASE,
4557SCM_SET_VECTOR_BASE, SCM_MAKE_VECTOR_TAG, SCM_SET_VECTOR_LENGTH,
4558SCM_VELTS_AS_STACKITEMS, SCM_SETVELTS, SCM_GC_WRITABLE_VELTS.
4559
0c7a5cab 4560** Some C functions and macros related to arrays have been deprecated.
dc91d8de
MV
4561
4562Migrate according to the following table:
4563
e94d0be2 4564 scm_make_uve -> scm_make_typed_array, scm_make_u8vector etc.
dc91d8de
MV
4565 scm_make_ra -> scm_make_array
4566 scm_shap2ra -> scm_make_array
4567 scm_cvref -> scm_c_generalized_vector_ref
4568 scm_ra_set_contp -> do not use
4569 scm_aind -> scm_array_handle_pos
4570 scm_raprin1 -> scm_display or scm_write
4571
0c7a5cab
MV
4572 SCM_ARRAYP -> scm_is_array
4573 SCM_ARRAY_NDIM -> scm_c_array_rank
4574 SCM_ARRAY_DIMS -> scm_array_handle_dims
4575 SCM_ARRAY_CONTP -> do not use
4576 SCM_ARRAY_MEM -> do not use
4577 SCM_ARRAY_V -> scm_array_handle_elements or similar
4578 SCM_ARRAY_BASE -> do not use
4579
c1e7caf7
MV
4580** SCM_CELL_WORD_LOC has been deprecated.
4581
b0d10ba6 4582Use the new macro SCM_CELL_OBJECT_LOC instead, which returns a pointer
c1e7caf7
MV
4583to a SCM, as opposed to a pointer to a scm_t_bits.
4584
4585This was done to allow the correct use of pointers into the Scheme
4586heap. Previously, the heap words were of type scm_t_bits and local
4587variables and function arguments were of type SCM, making it
4588non-standards-conformant to have a pointer that can point to both.
4589
3ff9283d 4590** New macros SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, etc.
27968825
MV
4591
4592These macros should be used instead of SCM_CELL_WORD_2/3 to access the
4593second and third words of double smobs. Likewise for
4594SCM_SET_SMOB_DATA_2 and SCM_SET_SMOB_DATA_3.
4595
4596Also, there is SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS that should be
4597used to get and set the 16 exra bits in the zeroth word of a smob.
4598
4599And finally, there is SCM_SMOB_OBJECT and SCM_SMOB_SET_OBJECT for
4600accesing the first immediate word of a smob as a SCM value, and there
4601is SCM_SMOB_OBJECT_LOC for getting a pointer to the first immediate
b0d10ba6 4602smob word. Like wise for SCM_SMOB_OBJECT_2, etc.
27968825 4603
b0d10ba6 4604** New way to deal with non-local exits and re-entries.
9879d390
MV
4605
4606There is a new set of functions that essentially do what
fc6bb283
MV
4607scm_internal_dynamic_wind does, but in a way that is more convenient
4608for C code in some situations. Here is a quick example of how to
4609prevent a potential memory leak:
9879d390
MV
4610
4611 void
4612 foo ()
4613 {
4614 char *mem;
4615
661ae7ab 4616 scm_dynwind_begin (0);
9879d390
MV
4617
4618 mem = scm_malloc (100);
661ae7ab 4619 scm_dynwind_unwind_handler (free, mem, SCM_F_WIND_EXPLICITLY);
f1da8e4e
MV
4620
4621 /* MEM would leak if BAR throws an error.
661ae7ab 4622 SCM_DYNWIND_UNWIND_HANDLER frees it nevertheless.
c41acab3 4623 */
9879d390 4624
9879d390
MV
4625 bar ();
4626
661ae7ab 4627 scm_dynwind_end ();
9879d390 4628
e299cee2 4629 /* Because of SCM_F_WIND_EXPLICITLY, MEM will be freed by
661ae7ab 4630 SCM_DYNWIND_END as well.
9879d390
MV
4631 */
4632 }
4633
661ae7ab 4634For full documentation, see the node "Dynamic Wind" in the manual.
9879d390 4635
661ae7ab 4636** New function scm_dynwind_free
c41acab3 4637
661ae7ab
MV
4638This function calls 'free' on a given pointer when a dynwind context
4639is left. Thus the call to scm_dynwind_unwind_handler above could be
4640replaced with simply scm_dynwind_free (mem).
c41acab3 4641
a6d75e53
MV
4642** New functions scm_c_call_with_blocked_asyncs and
4643 scm_c_call_with_unblocked_asyncs
4644
4645Like scm_call_with_blocked_asyncs etc. but for C functions.
4646
661ae7ab 4647** New functions scm_dynwind_block_asyncs and scm_dynwind_unblock_asyncs
49c00ecc
MV
4648
4649In addition to scm_c_call_with_blocked_asyncs you can now also use
661ae7ab
MV
4650scm_dynwind_block_asyncs in a 'dynwind context' (see above). Likewise for
4651scm_c_call_with_unblocked_asyncs and scm_dynwind_unblock_asyncs.
49c00ecc 4652
a558cc63
MV
4653** The macros SCM_DEFER_INTS, SCM_ALLOW_INTS, SCM_REDEFER_INTS,
4654 SCM_REALLOW_INTS have been deprecated.
4655
4656They do no longer fulfill their original role of blocking signal
4657delivery. Depending on what you want to achieve, replace a pair of
661ae7ab
MV
4658SCM_DEFER_INTS and SCM_ALLOW_INTS with a dynwind context that locks a
4659mutex, blocks asyncs, or both. See node "Critical Sections" in the
4660manual.
a6d75e53
MV
4661
4662** The value 'scm_mask_ints' is no longer writable.
4663
4664Previously, you could set scm_mask_ints directly. This is no longer
4665possible. Use scm_c_call_with_blocked_asyncs and
4666scm_c_call_with_unblocked_asyncs instead.
a558cc63 4667
49c00ecc
MV
4668** New way to temporarily set the current input, output or error ports
4669
661ae7ab 4670C code can now use scm_dynwind_current_<foo>_port in a 'dynwind
0f24e75b 4671context' (see above). <foo> is one of "input", "output" or "error".
49c00ecc 4672
fc6bb283
MV
4673** New way to temporarily set fluids
4674
661ae7ab 4675C code can now use scm_dynwind_fluid in a 'dynwind context' (see
fc6bb283
MV
4676above) to temporarily set the value of a fluid.
4677
89fcf1b4
MV
4678** New types scm_t_intmax and scm_t_uintmax.
4679
4680On platforms that have them, these types are identical to intmax_t and
4681uintmax_t, respectively. On other platforms, they are identical to
4682the largest integer types that Guile knows about.
4683
b0d10ba6 4684** The functions scm_unmemocopy and scm_unmemoize have been removed.
9fcf3cbb 4685
b0d10ba6 4686You should not have used them.
9fcf3cbb 4687
5ebbe4ef
RB
4688** Many public #defines with generic names have been made private.
4689
4690#defines with generic names like HAVE_FOO or SIZEOF_FOO have been made
b0d10ba6 4691private or renamed with a more suitable public name.
f03314f9
DH
4692
4693** The macro SCM_TYP16S has been deprecated.
4694
b0d10ba6 4695This macro is not intended for public use.
f03314f9 4696
0d5e3480
DH
4697** The macro SCM_SLOPPY_INEXACTP has been deprecated.
4698
b0d10ba6 4699Use scm_is_true (scm_inexact_p (...)) instead.
0d5e3480
DH
4700
4701** The macro SCM_SLOPPY_REALP has been deprecated.
4702
b0d10ba6 4703Use scm_is_real instead.
0d5e3480
DH
4704
4705** The macro SCM_SLOPPY_COMPLEXP has been deprecated.
4706
b0d10ba6 4707Use scm_is_complex instead.
5ebbe4ef 4708
b0d10ba6 4709** Some preprocessor defines have been deprecated.
5ebbe4ef 4710
b0d10ba6
MV
4711These defines indicated whether a certain feature was present in Guile
4712or not. Going forward, assume that the features are always present.
5ebbe4ef 4713
b0d10ba6
MV
4714The macros are: USE_THREADS, GUILE_ISELECT, READER_EXTENSIONS,
4715DEBUG_EXTENSIONS, DYNAMIC_LINKING.
5ebbe4ef 4716
b0d10ba6
MV
4717The following macros have been removed completely: MEMOIZE_LOCALS,
4718SCM_RECKLESS, SCM_CAUTIOUS.
5ebbe4ef
RB
4719
4720** The preprocessor define STACK_DIRECTION has been deprecated.
4721
4722There should be no need to know about the stack direction for ordinary
b0d10ba6 4723programs.
5ebbe4ef 4724
b2cbe8d8
RB
4725** New function: scm_effective_version
4726
4727Returns the "effective" version number. This is just the normal full
4728version string without the final micro-version number. See "Changes
4729to the distribution" above.
4730
2902a459
MV
4731** The function scm_call_with_new_thread has a new prototype.
4732
4733Instead of taking a list with the thunk and handler, these two
4734arguments are now passed directly:
4735
4736 SCM scm_call_with_new_thread (SCM thunk, SCM handler);
4737
4738This is an incompatible change.
4739
ffd0ef3b
MV
4740** New snarfer macro SCM_DEFINE_PUBLIC.
4741
4742This is like SCM_DEFINE, but also calls scm_c_export for the defined
4743function in the init section.
4744
8734ce02
MV
4745** The snarfer macro SCM_SNARF_INIT is now officially supported.
4746
39e8f371
HWN
4747** Garbage collector rewrite.
4748
4749The garbage collector is cleaned up a lot, and now uses lazy
4750sweeping. This is reflected in the output of (gc-stats); since cells
4751are being freed when they are allocated, the cells-allocated field
4752stays roughly constant.
4753
4754For malloc related triggers, the behavior is changed. It uses the same
4755heuristic as the cell-triggered collections. It may be tuned with the
4756environment variables GUILE_MIN_YIELD_MALLOC. This is the percentage
4757for minimum yield of malloc related triggers. The default is 40.
4758GUILE_INIT_MALLOC_LIMIT sets the initial trigger for doing a GC. The
4759default is 200 kb.
4760
4761Debugging operations for the freelist have been deprecated, along with
4762the C variables that control garbage collection. The environment
4763variables GUILE_MAX_SEGMENT_SIZE, GUILE_INIT_SEGMENT_SIZE_2,
4764GUILE_INIT_SEGMENT_SIZE_1, and GUILE_MIN_YIELD_2 should be used.
4765
1367aa5e
HWN
4766For understanding the memory usage of a GUILE program, the routine
4767gc-live-object-stats returns an alist containing the number of live
4768objects for every type.
4769
4770
5ec1d2c8
DH
4771** The function scm_definedp has been renamed to scm_defined_p
4772
4773The name scm_definedp is deprecated.
4774
b0d10ba6 4775** The struct scm_cell type has been renamed to scm_t_cell
228a24ef
DH
4776
4777This is in accordance to Guile's naming scheme for types. Note that
4778the name scm_cell is now used for a function that allocates and
4779initializes a new cell (see below).
4780
0906625f
MV
4781** New functions for memory management
4782
4783A new set of functions for memory management has been added since the
4784old way (scm_must_malloc, scm_must_free, etc) was error prone and
4785indeed, Guile itself contained some long standing bugs that could
4786cause aborts in long running programs.
4787
4788The new functions are more symmetrical and do not need cooperation
4789from smob free routines, among other improvements.
4790
eab1b259
HWN
4791The new functions are scm_malloc, scm_realloc, scm_calloc, scm_strdup,
4792scm_strndup, scm_gc_malloc, scm_gc_calloc, scm_gc_realloc,
4793scm_gc_free, scm_gc_register_collectable_memory, and
0906625f
MV
4794scm_gc_unregister_collectable_memory. Refer to the manual for more
4795details and for upgrading instructions.
4796
4797The old functions for memory management have been deprecated. They
4798are: scm_must_malloc, scm_must_realloc, scm_must_free,
4799scm_must_strdup, scm_must_strndup, scm_done_malloc, scm_done_free.
4800
4aa104a4
MV
4801** Declarations of exported features are marked with SCM_API.
4802
4803Every declaration of a feature that belongs to the exported Guile API
4804has been marked by adding the macro "SCM_API" to the start of the
4805declaration. This macro can expand into different things, the most
4806common of which is just "extern" for Unix platforms. On Win32, it can
4807be used to control which symbols are exported from a DLL.
4808
8f99e3f3 4809If you `#define SCM_IMPORT' before including <libguile.h>, SCM_API
4aa104a4
MV
4810will expand into "__declspec (dllimport) extern", which is needed for
4811linking to the Guile DLL in Windows.
4812
b0d10ba6 4813There are also SCM_RL_IMPORT, SCM_SRFI1314_IMPORT, and
8f99e3f3 4814SCM_SRFI4_IMPORT, for the corresponding libraries.
4aa104a4 4815
a9930d22
MV
4816** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated.
4817
b0d10ba6
MV
4818Use the new functions scm_cell and scm_double_cell instead. The old
4819macros had problems because with them allocation and initialization
4820was separated and the GC could sometimes observe half initialized
4821cells. Only careful coding by the user of SCM_NEWCELL and
4822SCM_NEWCELL2 could make this safe and efficient.
a9930d22 4823
5132eef0
DH
4824** CHECK_ENTRY, CHECK_APPLY and CHECK_EXIT have been deprecated.
4825
4826Use the variables scm_check_entry_p, scm_check_apply_p and scm_check_exit_p
4827instead.
4828
bc76d628
DH
4829** SRCBRKP has been deprecated.
4830
4831Use scm_c_source_property_breakpoint_p instead.
4832
3063e30a
DH
4833** Deprecated: scm_makmacro
4834
b0d10ba6
MV
4835Change your code to use either scm_makmmacro or to define macros in
4836Scheme, using 'define-macro'.
1e5f92ce 4837
1a61d41b
MV
4838** New function scm_c_port_for_each.
4839
4840This function is like scm_port_for_each but takes a pointer to a C
4841function as the callback instead of a SCM value.
4842
1f834c95
MV
4843** The names scm_internal_select, scm_thread_sleep, and
4844 scm_thread_usleep have been discouraged.
4845
4846Use scm_std_select, scm_std_sleep, scm_std_usleep instead.
4847
aa9200e5
MV
4848** The GC can no longer be blocked.
4849
4850The global flags scm_gc_heap_lock and scm_block_gc have been removed.
4851The GC can now run (partially) concurrently with other code and thus
4852blocking it is not well defined.
4853
b0d10ba6
MV
4854** Many definitions have been removed that were previously deprecated.
4855
4856scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify,
4857scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify,
4858scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2,
4859scm_tc16_allocated, SCM_SET_SYMBOL_HASH, SCM_IM_NIL_IFY, SCM_IM_T_IFY,
4860SCM_IM_0_COND, SCM_IM_0_IFY, SCM_IM_1_IFY, SCM_GC_SET_ALLOCATED,
4861scm_debug_newcell, scm_debug_newcell2, SCM_HUP_SIGNAL, SCM_INT_SIGNAL,
4862SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, SCM_ALRM_SIGNAL,
4863SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, SCM_ORD_SIG,
4864SCM_NUM_SIGS, scm_top_level_lookup_closure_var,
4865*top-level-lookup-closure*, scm_system_transformer, scm_eval_3,
4866scm_eval2, root_module_lookup_closure, SCM_SLOPPY_STRINGP,
4867SCM_RWSTRINGP, scm_read_only_string_p, scm_make_shared_substring,
4868scm_tc7_substring, sym_huh, SCM_VARVCELL, SCM_UDVARIABLEP,
4869SCM_DEFVARIABLEP, scm_mkbig, scm_big2inum, scm_adjbig, scm_normbig,
4870scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl, SCM_FIXNUM_BIT,
4871SCM_SETCHARS, SCM_SLOPPY_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
4872SCM_LENGTH_MAX, SCM_SETLENGTH, SCM_ROSTRINGP, SCM_ROLENGTH,
4873SCM_ROCHARS, SCM_ROUCHARS, SCM_SUBSTRP, SCM_COERCE_SUBSTR,
4874scm_sym2vcell, scm_intern, scm_intern0, scm_sysintern, scm_sysintern0,
66c8ded2 4875scm_sysintern0_no_module_lookup, scm_init_symbols_deprecated,
2109da78 4876scm_vector_set_length_x, scm_contregs, scm_debug_info,
983e697d
MV
4877scm_debug_frame, SCM_DSIDEVAL, SCM_CONST_LONG, SCM_VCELL,
4878SCM_GLOBAL_VCELL, SCM_VCELL_INIT, SCM_GLOBAL_VCELL_INIT,
4879SCM_HUGE_LENGTH, SCM_VALIDATE_STRINGORSUBSTR, SCM_VALIDATE_ROSTRING,
4880SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY,
4881SCM_VALIDATE_RWSTRING, DIGITS, scm_small_istr2int, scm_istr2int,
2109da78
MV
4882scm_istr2flo, scm_istring2number, scm_istr2int, scm_istr2flo,
4883scm_istring2number, scm_vtable_index_vcell, scm_si_vcell, SCM_ECONSP,
4884SCM_NECONSP, SCM_GLOC_VAR, SCM_GLOC_VAL, SCM_GLOC_SET_VAL,
c41acab3
MV
4885SCM_GLOC_VAL_LOC, scm_make_gloc, scm_gloc_p, scm_tc16_variable,
4886SCM_CHARS, SCM_LENGTH, SCM_SET_STRING_CHARS, SCM_SET_STRING_LENGTH.
b51bad08 4887
09172f9c
NJ
4888* Changes to bundled modules
4889
4890** (ice-9 debug)
4891
4892Using the (ice-9 debug) module no longer automatically switches Guile
4893to use the debugging evaluator. If you want to switch to the
4894debugging evaluator (which is needed for backtrace information if you
4895hit an error), please add an explicit "(debug-enable 'debug)" to your
4896code just after the code to use (ice-9 debug).
4897
328dc9a3 4898\f
c299f186
MD
4899Changes since Guile 1.4:
4900
4901* Changes to the distribution
4902
32d6f999
TTN
4903** A top-level TODO file is included.
4904
311b6a3c 4905** Guile now uses a versioning scheme similar to that of the Linux kernel.
c81ea65d
RB
4906
4907Guile now always uses three numbers to represent the version,
4908i.e. "1.6.5". The first number, 1, is the major version number, the
4909second number, 6, is the minor version number, and the third number,
49105, is the micro version number. Changes in major version number
4911indicate major changes in Guile.
4912
4913Minor version numbers that are even denote stable releases, and odd
4914minor version numbers denote development versions (which may be
4915unstable). The micro version number indicates a minor sub-revision of
4916a given MAJOR.MINOR release.
4917
4918In keeping with the new scheme, (minor-version) and scm_minor_version
4919no longer return everything but the major version number. They now
4920just return the minor version number. Two new functions
4921(micro-version) and scm_micro_version have been added to report the
4922micro version number.
4923
4924In addition, ./GUILE-VERSION now defines GUILE_MICRO_VERSION.
4925
5c790b44
RB
4926** New preprocessor definitions are available for checking versions.
4927
4928version.h now #defines SCM_MAJOR_VERSION, SCM_MINOR_VERSION, and
4929SCM_MICRO_VERSION to the appropriate integer values.
4930
311b6a3c
MV
4931** Guile now actively warns about deprecated features.
4932
4933The new configure option `--enable-deprecated=LEVEL' and the
4934environment variable GUILE_WARN_DEPRECATED control this mechanism.
4935See INSTALL and README for more information.
4936
0b073f0f
RB
4937** Guile is much more likely to work on 64-bit architectures.
4938
4939Guile now compiles and passes "make check" with only two UNRESOLVED GC
5e137c65
RB
4940cases on Alpha and ia64 based machines now. Thanks to John Goerzen
4941for the use of a test machine, and thanks to Stefan Jahn for ia64
4942patches.
0b073f0f 4943
e658215a
RB
4944** New functions: setitimer and getitimer.
4945
4946These implement a fairly direct interface to the libc functions of the
4947same name.
4948
8630fdfc
RB
4949** The #. reader extension is now disabled by default.
4950
4951For safety reasons, #. evaluation is disabled by default. To
4952re-enable it, set the fluid read-eval? to #t. For example:
4953
67b7dd9e 4954 (fluid-set! read-eval? #t)
8630fdfc
RB
4955
4956but make sure you realize the potential security risks involved. With
4957read-eval? enabled, reading a data file from an untrusted source can
4958be dangerous.
4959
f2a75d81 4960** New SRFI modules have been added:
4df36934 4961
dfdf5826
MG
4962SRFI-0 `cond-expand' is now supported in Guile, without requiring
4963using a module.
4964
e8bb0476
MG
4965(srfi srfi-1) is a library containing many useful pair- and list-processing
4966 procedures.
4967
7adc2c58 4968(srfi srfi-2) exports and-let*.
4df36934 4969
b74a7ec8
MG
4970(srfi srfi-4) implements homogeneous numeric vector datatypes.
4971
7adc2c58
RB
4972(srfi srfi-6) is a dummy module for now, since guile already provides
4973 all of the srfi-6 procedures by default: open-input-string,
4974 open-output-string, get-output-string.
4df36934 4975
7adc2c58 4976(srfi srfi-8) exports receive.
4df36934 4977
7adc2c58 4978(srfi srfi-9) exports define-record-type.
4df36934 4979
dfdf5826
MG
4980(srfi srfi-10) exports define-reader-ctor and implements the reader
4981 extension #,().
4982
7adc2c58 4983(srfi srfi-11) exports let-values and let*-values.
4df36934 4984
7adc2c58 4985(srfi srfi-13) implements the SRFI String Library.
53e29a1e 4986
7adc2c58 4987(srfi srfi-14) implements the SRFI Character-Set Library.
53e29a1e 4988
dfdf5826
MG
4989(srfi srfi-17) implements setter and getter-with-setter and redefines
4990 some accessor procedures as procedures with getters. (such as car,
4991 cdr, vector-ref etc.)
4992
4993(srfi srfi-19) implements the SRFI Time/Date Library.
2b60bc95 4994
466bb4b3
TTN
4995** New scripts / "executable modules"
4996
4997Subdirectory "scripts" contains Scheme modules that are packaged to
4998also be executable as scripts. At this time, these scripts are available:
4999
5000 display-commentary
5001 doc-snarf
5002 generate-autoload
5003 punify
58e5b910 5004 read-scheme-source
466bb4b3
TTN
5005 use2dot
5006
5007See README there for more info.
5008
54c17ccb
TTN
5009These scripts can be invoked from the shell with the new program
5010"guile-tools", which keeps track of installation directory for you.
5011For example:
5012
5013 $ guile-tools display-commentary srfi/*.scm
5014
5015guile-tools is copied to the standard $bindir on "make install".
5016
0109c4bf
MD
5017** New module (ice-9 stack-catch):
5018
5019stack-catch is like catch, but saves the current state of the stack in
3c1d1301
RB
5020the fluid the-last-stack. This fluid can be useful when using the
5021debugger and when re-throwing an error.
0109c4bf 5022
fbf0c8c7
MV
5023** The module (ice-9 and-let*) has been renamed to (ice-9 and-let-star)
5024
5025This has been done to prevent problems on lesser operating systems
5026that can't tolerate `*'s in file names. The exported macro continues
5027to be named `and-let*', of course.
5028
4f60cc33 5029On systems that support it, there is also a compatibility module named
fbf0c8c7 5030(ice-9 and-let*). It will go away in the next release.
6c0201ad 5031
9d774814 5032** New modules (oop goops) etc.:
14f1d9fe
MD
5033
5034 (oop goops)
5035 (oop goops describe)
5036 (oop goops save)
5037 (oop goops active-slot)
5038 (oop goops composite-slot)
5039
9d774814 5040The Guile Object Oriented Programming System (GOOPS) has been
311b6a3c
MV
5041integrated into Guile. For further information, consult the GOOPS
5042manual and tutorial in the `doc' directory.
14f1d9fe 5043
9d774814
GH
5044** New module (ice-9 rdelim).
5045
5046This exports the following procedures which were previously defined
1c8cbd62 5047in the default environment:
9d774814 5048
1c8cbd62
GH
5049read-line read-line! read-delimited read-delimited! %read-delimited!
5050%read-line write-line
9d774814 5051
1c8cbd62
GH
5052For backwards compatibility the definitions are still imported into the
5053default environment in this version of Guile. However you should add:
9d774814
GH
5054
5055(use-modules (ice-9 rdelim))
5056
1c8cbd62
GH
5057to any program which uses the definitions, since this may change in
5058future.
9d774814
GH
5059
5060Alternatively, if guile-scsh is installed, the (scsh rdelim) module
5061can be used for similar functionality.
5062
7e267da1
GH
5063** New module (ice-9 rw)
5064
5065This is a subset of the (scsh rw) module from guile-scsh. Currently
373f4948 5066it defines two procedures:
7e267da1 5067
311b6a3c 5068*** New function: read-string!/partial str [port_or_fdes [start [end]]]
7e267da1 5069
4bcdfe46
GH
5070 Read characters from a port or file descriptor into a string STR.
5071 A port must have an underlying file descriptor -- a so-called
5072 fport. This procedure is scsh-compatible and can efficiently read
311b6a3c 5073 large strings.
7e267da1 5074
4bcdfe46
GH
5075*** New function: write-string/partial str [port_or_fdes [start [end]]]
5076
5077 Write characters from a string STR to a port or file descriptor.
5078 A port must have an underlying file descriptor -- a so-called
5079 fport. This procedure is mostly compatible and can efficiently
5080 write large strings.
5081
e5005373
KN
5082** New module (ice-9 match)
5083
311b6a3c
MV
5084This module includes Andrew K. Wright's pattern matcher. See
5085ice-9/match.scm for brief description or
e5005373 5086
311b6a3c 5087 http://www.star-lab.com/wright/code.html
e5005373 5088
311b6a3c 5089for complete documentation.
e5005373 5090
4f60cc33
NJ
5091** New module (ice-9 buffered-input)
5092
5093This module provides procedures to construct an input port from an
5094underlying source of input that reads and returns its input in chunks.
5095The underlying input source is a Scheme procedure, specified by the
5096caller, which the port invokes whenever it needs more input.
5097
5098This is useful when building an input port whose back end is Readline
5099or a UI element such as the GtkEntry widget.
5100
5101** Documentation
5102
5103The reference and tutorial documentation that was previously
5104distributed separately, as `guile-doc', is now included in the core
5105Guile distribution. The documentation consists of the following
5106manuals.
5107
5108- The Guile Tutorial (guile-tut.texi) contains a tutorial introduction
5109 to using Guile.
5110
5111- The Guile Reference Manual (guile.texi) contains (or is intended to
5112 contain) reference documentation on all aspects of Guile.
5113
5114- The GOOPS Manual (goops.texi) contains both tutorial-style and
5115 reference documentation for using GOOPS, Guile's Object Oriented
5116 Programming System.
5117
c3e62877
NJ
5118- The Revised^5 Report on the Algorithmic Language Scheme
5119 (r5rs.texi).
4f60cc33
NJ
5120
5121See the README file in the `doc' directory for more details.
5122
094a67bb
MV
5123** There are a couple of examples in the examples/ directory now.
5124
9d774814
GH
5125* Changes to the stand-alone interpreter
5126
e7e58018
MG
5127** New command line option `--use-srfi'
5128
5129Using this option, SRFI modules can be loaded on startup and be
5130available right from the beginning. This makes programming portable
5131Scheme programs easier.
5132
5133The option `--use-srfi' expects a comma-separated list of numbers,
5134each representing a SRFI number to be loaded into the interpreter
5135before starting evaluating a script file or the REPL. Additionally,
5136the feature identifier for the loaded SRFIs is recognized by
5137`cond-expand' when using this option.
5138
5139Example:
5140$ guile --use-srfi=8,13
5141guile> (receive (x z) (values 1 2) (+ 1 2))
51423
58e5b910 5143guile> (string-pad "bla" 20)
e7e58018
MG
5144" bla"
5145
094a67bb
MV
5146** Guile now always starts up in the `(guile-user)' module.
5147
6e9382f1 5148Previously, scripts executed via the `-s' option would run in the
094a67bb
MV
5149`(guile)' module and the repl would run in the `(guile-user)' module.
5150Now every user action takes place in the `(guile-user)' module by
5151default.
e7e58018 5152
c299f186
MD
5153* Changes to Scheme functions and syntax
5154
720e1c30
MV
5155** Character classifiers work for non-ASCII characters.
5156
5157The predicates `char-alphabetic?', `char-numeric?',
5158`char-whitespace?', `char-lower?', `char-upper?' and `char-is-both?'
5159no longer check whether their arguments are ASCII characters.
5160Previously, a character would only be considered alphabetic when it
5161was also ASCII, for example.
5162
311b6a3c
MV
5163** Previously deprecated Scheme functions have been removed:
5164
5165 tag - no replacement.
5166 fseek - replaced by seek.
5167 list* - replaced by cons*.
5168
5169** It's now possible to create modules with controlled environments
5170
5171Example:
5172
5173(use-modules (ice-9 safe))
5174(define m (make-safe-module))
5175;;; m will now be a module containing only a safe subset of R5RS
5176(eval '(+ 1 2) m) --> 3
5177(eval 'load m) --> ERROR: Unbound variable: load
5178
5179** Evaluation of "()", the empty list, is now an error.
8c2c9967
MV
5180
5181Previously, the expression "()" evaluated to the empty list. This has
5182been changed to signal a "missing expression" error. The correct way
5183to write the empty list as a literal constant is to use quote: "'()".
5184
311b6a3c
MV
5185** New concept of `Guile Extensions'.
5186
5187A Guile Extension is just a ordinary shared library that can be linked
5188at run-time. We found it advantageous to give this simple concept a
5189dedicated name to distinguish the issues related to shared libraries
5190from the issues related to the module system.
5191
5192*** New function: load-extension
5193
5194Executing (load-extension lib init) is mostly equivalent to
5195
5196 (dynamic-call init (dynamic-link lib))
5197
5198except when scm_register_extension has been called previously.
5199Whenever appropriate, you should use `load-extension' instead of
5200dynamic-link and dynamic-call.
5201
5202*** New C function: scm_c_register_extension
5203
5204This function registers a initialization function for use by
5205`load-extension'. Use it when you don't want specific extensions to
5206be loaded as shared libraries (for example on platforms that don't
5207support dynamic linking).
5208
8c2c9967
MV
5209** Auto-loading of compiled-code modules is deprecated.
5210
5211Guile used to be able to automatically find and link a shared
c10ecc4c 5212library to satisfy requests for a module. For example, the module
8c2c9967
MV
5213`(foo bar)' could be implemented by placing a shared library named
5214"foo/libbar.so" (or with a different extension) in a directory on the
5215load path of Guile.
5216
311b6a3c
MV
5217This has been found to be too tricky, and is no longer supported. The
5218shared libraries are now called "extensions". You should now write a
5219small Scheme file that calls `load-extension' to load the shared
e299cee2 5220library and initialize it explicitly.
8c2c9967
MV
5221
5222The shared libraries themselves should be installed in the usual
5223places for shared libraries, with names like "libguile-foo-bar".
5224
5225For example, place this into a file "foo/bar.scm"
5226
5227 (define-module (foo bar))
5228
311b6a3c
MV
5229 (load-extension "libguile-foo-bar" "foobar_init")
5230
5231** Backward incompatible change: eval EXP ENVIRONMENT-SPECIFIER
5232
5233`eval' is now R5RS, that is it takes two arguments.
5234The second argument is an environment specifier, i.e. either
5235
5236 (scheme-report-environment 5)
5237 (null-environment 5)
5238 (interaction-environment)
5239
5240or
8c2c9967 5241
311b6a3c 5242 any module.
8c2c9967 5243
6f76852b
MV
5244** The module system has been made more disciplined.
5245
311b6a3c
MV
5246The function `eval' will save and restore the current module around
5247the evaluation of the specified expression. While this expression is
5248evaluated, `(current-module)' will now return the right module, which
5249is the module specified as the second argument to `eval'.
6f76852b 5250
311b6a3c 5251A consequence of this change is that `eval' is not particularly
6f76852b
MV
5252useful when you want allow the evaluated code to change what module is
5253designated as the current module and have this change persist from one
5254call to `eval' to the next. The read-eval-print-loop is an example
5255where `eval' is now inadequate. To compensate, there is a new
5256function `primitive-eval' that does not take a module specifier and
5257that does not save/restore the current module. You should use this
5258function together with `set-current-module', `current-module', etc
5259when you want to have more control over the state that is carried from
5260one eval to the next.
5261
5262Additionally, it has been made sure that forms that are evaluated at
5263the top level are always evaluated with respect to the current module.
5264Previously, subforms of top-level forms such as `begin', `case',
5265etc. did not respect changes to the current module although these
5266subforms are at the top-level as well.
5267
311b6a3c 5268To prevent strange behavior, the forms `define-module',
6f76852b
MV
5269`use-modules', `use-syntax', and `export' have been restricted to only
5270work on the top level. The forms `define-public' and
5271`defmacro-public' only export the new binding on the top level. They
5272behave just like `define' and `defmacro', respectively, when they are
5273used in a lexical environment.
5274
0a892a2c
MV
5275Also, `export' will no longer silently re-export bindings imported
5276from a used module. It will emit a `deprecation' warning and will
5277cease to perform any re-export in the next version. If you actually
5278want to re-export bindings, use the new `re-export' in place of
5279`export'. The new `re-export' will not make copies of variables when
5280rexporting them, as `export' did wrongly.
5281
047dc3ae
TTN
5282** Module system now allows selection and renaming of imported bindings
5283
5284Previously, when using `use-modules' or the `#:use-module' clause in
5285the `define-module' form, all the bindings (association of symbols to
5286values) for imported modules were added to the "current module" on an
5287as-is basis. This has been changed to allow finer control through two
5288new facilities: selection and renaming.
5289
5290You can now select which of the imported module's bindings are to be
5291visible in the current module by using the `:select' clause. This
5292clause also can be used to rename individual bindings. For example:
5293
5294 ;; import all bindings no questions asked
5295 (use-modules (ice-9 common-list))
5296
5297 ;; import four bindings, renaming two of them;
5298 ;; the current module sees: every some zonk-y zonk-n
5299 (use-modules ((ice-9 common-list)
5300 :select (every some
5301 (remove-if . zonk-y)
5302 (remove-if-not . zonk-n))))
5303
5304You can also programmatically rename all selected bindings using the
5305`:renamer' clause, which specifies a proc that takes a symbol and
5306returns another symbol. Because it is common practice to use a prefix,
5307we now provide the convenience procedure `symbol-prefix-proc'. For
5308example:
5309
5310 ;; import four bindings, renaming two of them specifically,
5311 ;; and all four w/ prefix "CL:";
5312 ;; the current module sees: CL:every CL:some CL:zonk-y CL:zonk-n
5313 (use-modules ((ice-9 common-list)
5314 :select (every some
5315 (remove-if . zonk-y)
5316 (remove-if-not . zonk-n))
5317 :renamer (symbol-prefix-proc 'CL:)))
5318
5319 ;; import four bindings, renaming two of them specifically,
5320 ;; and all four by upcasing.
5321 ;; the current module sees: EVERY SOME ZONK-Y ZONK-N
5322 (define (upcase-symbol sym)
5323 (string->symbol (string-upcase (symbol->string sym))))
5324
5325 (use-modules ((ice-9 common-list)
5326 :select (every some
5327 (remove-if . zonk-y)
5328 (remove-if-not . zonk-n))
5329 :renamer upcase-symbol))
5330
5331Note that programmatic renaming is done *after* individual renaming.
5332Also, the above examples show `use-modules', but the same facilities are
5333available for the `#:use-module' clause of `define-module'.
5334
5335See manual for more info.
5336
b7d69200 5337** The semantics of guardians have changed.
56495472 5338
b7d69200 5339The changes are for the most part compatible. An important criterion
6c0201ad 5340was to keep the typical usage of guardians as simple as before, but to
c0a5d888 5341make the semantics safer and (as a result) more useful.
56495472 5342
c0a5d888 5343*** All objects returned from guardians are now properly alive.
56495472 5344
c0a5d888
ML
5345It is now guaranteed that any object referenced by an object returned
5346from a guardian is alive. It's now impossible for a guardian to
5347return a "contained" object before its "containing" object.
56495472
ML
5348
5349One incompatible (but probably not very important) change resulting
5350from this is that it is no longer possible to guard objects that
5351indirectly reference themselves (i.e. are parts of cycles). If you do
5352so accidentally, you'll get a warning.
5353
c0a5d888
ML
5354*** There are now two types of guardians: greedy and sharing.
5355
5356If you call (make-guardian #t) or just (make-guardian), you'll get a
5357greedy guardian, and for (make-guardian #f) a sharing guardian.
5358
5359Greedy guardians are the default because they are more "defensive".
5360You can only greedily guard an object once. If you guard an object
5361more than once, once in a greedy guardian and the rest of times in
5362sharing guardians, then it is guaranteed that the object won't be
5363returned from sharing guardians as long as it is greedily guarded
5364and/or alive.
5365
5366Guardians returned by calls to `make-guardian' can now take one more
5367optional parameter, which says whether to throw an error in case an
5368attempt is made to greedily guard an object that is already greedily
5369guarded. The default is true, i.e. throw an error. If the parameter
5370is false, the guardian invocation returns #t if guarding was
5371successful and #f if it wasn't.
5372
5373Also, since greedy guarding is, in effect, a side-effecting operation
5374on objects, a new function is introduced: `destroy-guardian!'.
5375Invoking this function on a guardian renders it unoperative and, if
5376the guardian is greedy, clears the "greedily guarded" property of the
5377objects that were guarded by it, thus undoing the side effect.
5378
5379Note that all this hair is hardly very important, since guardian
5380objects are usually permanent.
5381
311b6a3c
MV
5382** Continuations created by call-with-current-continuation now accept
5383any number of arguments, as required by R5RS.
818febc0 5384
c10ecc4c 5385** New function `issue-deprecation-warning'
56426fdb 5386
311b6a3c 5387This function is used to display the deprecation messages that are
c10ecc4c 5388controlled by GUILE_WARN_DEPRECATION as explained in the README.
56426fdb
KN
5389
5390 (define (id x)
c10ecc4c
MV
5391 (issue-deprecation-warning "`id' is deprecated. Use `identity' instead.")
5392 (identity x))
56426fdb
KN
5393
5394 guile> (id 1)
5395 ;; `id' is deprecated. Use `identity' instead.
5396 1
5397 guile> (id 1)
5398 1
5399
c10ecc4c
MV
5400** New syntax `begin-deprecated'
5401
5402When deprecated features are included (as determined by the configure
5403option --enable-deprecated), `begin-deprecated' is identical to
5404`begin'. When deprecated features are excluded, it always evaluates
5405to `#f', ignoring the body forms.
5406
17f367e0
MV
5407** New function `make-object-property'
5408
5409This function returns a new `procedure with setter' P that can be used
5410to attach a property to objects. When calling P as
5411
5412 (set! (P obj) val)
5413
5414where `obj' is any kind of object, it attaches `val' to `obj' in such
5415a way that it can be retrieved by calling P as
5416
5417 (P obj)
5418
5419This function will replace procedure properties, symbol properties and
5420source properties eventually.
5421
76ef92f3
MV
5422** Module (ice-9 optargs) now uses keywords instead of `#&'.
5423
5424Instead of #&optional, #&key, etc you should now use #:optional,
5425#:key, etc. Since #:optional is a keyword, you can write it as just
5426:optional when (read-set! keywords 'prefix) is active.
5427
5428The old reader syntax `#&' is still supported, but deprecated. It
5429will be removed in the next release.
5430
c0997079
MD
5431** New define-module option: pure
5432
5433Tells the module system not to include any bindings from the root
5434module.
5435
5436Example:
5437
5438(define-module (totally-empty-module)
5439 :pure)
5440
5441** New define-module option: export NAME1 ...
5442
5443Export names NAME1 ...
5444
5445This option is required if you want to be able to export bindings from
5446a module which doesn't import one of `define-public' or `export'.
5447
5448Example:
5449
311b6a3c
MV
5450 (define-module (foo)
5451 :pure
5452 :use-module (ice-9 r5rs)
5453 :export (bar))
69b5f65a 5454
311b6a3c 5455 ;;; Note that we're pure R5RS below this point!
69b5f65a 5456
311b6a3c
MV
5457 (define (bar)
5458 ...)
daa6ba18 5459
1f3908c4
KN
5460** New function: object->string OBJ
5461
5462Return a Scheme string obtained by printing a given object.
5463
eb5c0a2a
GH
5464** New function: port? X
5465
5466Returns a boolean indicating whether X is a port. Equivalent to
5467`(or (input-port? X) (output-port? X))'.
5468
efa40607
DH
5469** New function: file-port?
5470
5471Determines whether a given object is a port that is related to a file.
5472
34b56ec4
GH
5473** New function: port-for-each proc
5474
311b6a3c
MV
5475Apply PROC to each port in the Guile port table in turn. The return
5476value is unspecified. More specifically, PROC is applied exactly once
5477to every port that exists in the system at the time PORT-FOR-EACH is
5478invoked. Changes to the port table while PORT-FOR-EACH is running
5479have no effect as far as PORT-FOR-EACH is concerned.
34b56ec4
GH
5480
5481** New function: dup2 oldfd newfd
5482
5483A simple wrapper for the `dup2' system call. Copies the file
5484descriptor OLDFD to descriptor number NEWFD, replacing the
5485previous meaning of NEWFD. Both OLDFD and NEWFD must be integers.
5486Unlike for dup->fdes or primitive-move->fdes, no attempt is made
264e9cbc 5487to move away ports which are using NEWFD. The return value is
34b56ec4
GH
5488unspecified.
5489
5490** New function: close-fdes fd
5491
5492A simple wrapper for the `close' system call. Close file
5493descriptor FD, which must be an integer. Unlike close (*note
5494close: Ports and File Descriptors.), the file descriptor will be
5495closed even if a port is using it. The return value is
5496unspecified.
5497
94e6d793
MG
5498** New function: crypt password salt
5499
5500Encrypts `password' using the standard unix password encryption
5501algorithm.
5502
5503** New function: chroot path
5504
5505Change the root directory of the running process to `path'.
5506
5507** New functions: getlogin, cuserid
5508
5509Return the login name or the user name of the current effective user
5510id, respectively.
5511
5512** New functions: getpriority which who, setpriority which who prio
5513
5514Get or set the priority of the running process.
5515
5516** New function: getpass prompt
5517
5518Read a password from the terminal, first displaying `prompt' and
5519disabling echoing.
5520
5521** New function: flock file operation
5522
5523Set/remove an advisory shared or exclusive lock on `file'.
5524
5525** New functions: sethostname name, gethostname
5526
5527Set or get the hostname of the machine the current process is running
5528on.
5529
6d163216 5530** New function: mkstemp! tmpl
4f60cc33 5531
6d163216
GH
5532mkstemp creates a new unique file in the file system and returns a
5533new buffered port open for reading and writing to the file. TMPL
5534is a string specifying where the file should be created: it must
5535end with `XXXXXX' and will be changed in place to return the name
5536of the temporary file.
5537
62e63ba9
MG
5538** New function: open-input-string string
5539
5540Return an input string port which delivers the characters from
4f60cc33 5541`string'. This procedure, together with `open-output-string' and
62e63ba9
MG
5542`get-output-string' implements SRFI-6.
5543
5544** New function: open-output-string
5545
5546Return an output string port which collects all data written to it.
5547The data can then be retrieved by `get-output-string'.
5548
5549** New function: get-output-string
5550
5551Return the contents of an output string port.
5552
56426fdb
KN
5553** New function: identity
5554
5555Return the argument.
5556
5bef627d
GH
5557** socket, connect, accept etc., now have support for IPv6. IPv6 addresses
5558 are represented in Scheme as integers with normal host byte ordering.
5559
5560** New function: inet-pton family address
5561
311b6a3c
MV
5562Convert a printable string network address into an integer. Note that
5563unlike the C version of this function, the result is an integer with
5564normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
5565e.g.,
5566
5567 (inet-pton AF_INET "127.0.0.1") => 2130706433
5568 (inet-pton AF_INET6 "::1") => 1
5bef627d
GH
5569
5570** New function: inet-ntop family address
5571
311b6a3c
MV
5572Convert an integer network address into a printable string. Note that
5573unlike the C version of this function, the input is an integer with
5574normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
5575e.g.,
5576
5577 (inet-ntop AF_INET 2130706433) => "127.0.0.1"
5578 (inet-ntop AF_INET6 (- (expt 2 128) 1)) =>
5bef627d
GH
5579 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
5580
56426fdb
KN
5581** Deprecated: id
5582
5583Use `identity' instead.
5584
5cd06d5e
DH
5585** Deprecated: -1+
5586
5587Use `1-' instead.
5588
5589** Deprecated: return-it
5590
311b6a3c 5591Do without it.
5cd06d5e
DH
5592
5593** Deprecated: string-character-length
5594
5595Use `string-length' instead.
5596
5597** Deprecated: flags
5598
5599Use `logior' instead.
5600
4f60cc33
NJ
5601** Deprecated: close-all-ports-except.
5602
5603This was intended for closing ports in a child process after a fork,
5604but it has the undesirable side effect of flushing buffers.
5605port-for-each is more flexible.
34b56ec4
GH
5606
5607** The (ice-9 popen) module now attempts to set up file descriptors in
5608the child process from the current Scheme ports, instead of using the
5609current values of file descriptors 0, 1, and 2 in the parent process.
5610
b52e071b
DH
5611** Removed function: builtin-weak-bindings
5612
5613There is no such concept as a weak binding any more.
5614
9d774814 5615** Removed constants: bignum-radix, scm-line-incrementors
0f979f3f 5616
7d435120
MD
5617** define-method: New syntax mandatory.
5618
5619The new method syntax is now mandatory:
5620
5621(define-method (NAME ARG-SPEC ...) BODY ...)
5622(define-method (NAME ARG-SPEC ... . REST-ARG) BODY ...)
5623
5624 ARG-SPEC ::= ARG-NAME | (ARG-NAME TYPE)
5625 REST-ARG ::= ARG-NAME
5626
5627If you have old code using the old syntax, import
5628(oop goops old-define-method) before (oop goops) as in:
5629
5630 (use-modules (oop goops old-define-method) (oop goops))
5631
f3f9dcbc
MV
5632** Deprecated function: builtin-variable
5633 Removed function: builtin-bindings
5634
5635There is no longer a distinction between builtin or other variables.
5636Use module system operations for all variables.
5637
311b6a3c
MV
5638** Lazy-catch handlers are no longer allowed to return.
5639
5640That is, a call to `throw', `error', etc is now guaranteed to not
5641return.
5642
a583bf1e 5643** Bugfixes for (ice-9 getopt-long)
8c84b81e 5644
a583bf1e
TTN
5645This module is now tested using test-suite/tests/getopt-long.test.
5646The following bugs have been fixed:
5647
5648*** Parsing for options that are specified to have `optional' args now checks
5649if the next element is an option instead of unconditionally taking it as the
8c84b81e
TTN
5650option arg.
5651
a583bf1e
TTN
5652*** An error is now thrown for `--opt=val' when the option description
5653does not specify `(value #t)' or `(value optional)'. This condition used to
5654be accepted w/o error, contrary to the documentation.
5655
5656*** The error message for unrecognized options is now more informative.
5657It used to be "not a record", an artifact of the implementation.
5658
5659*** The error message for `--opt' terminating the arg list (no value), when
5660`(value #t)' is specified, is now more informative. It used to be "not enough
5661args".
5662
5663*** "Clumped" single-char args now preserve trailing string, use it as arg.
5664The expansion used to be like so:
5665
5666 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "--xyz")
5667
5668Note that the "5d" is dropped. Now it is like so:
5669
5670 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "5d" "--xyz")
5671
5672This enables single-char options to have adjoining arguments as long as their
5673constituent characters are not potential single-char options.
8c84b81e 5674
998bfc70
TTN
5675** (ice-9 session) procedure `arity' now works with (ice-9 optargs) `lambda*'
5676
5677The `lambda*' and derivative forms in (ice-9 optargs) now set a procedure
5678property `arglist', which can be retrieved by `arity'. The result is that
5679`arity' can give more detailed information than before:
5680
5681Before:
5682
5683 guile> (use-modules (ice-9 optargs))
5684 guile> (define* (foo #:optional a b c) a)
5685 guile> (arity foo)
5686 0 or more arguments in `lambda*:G0'.
5687
5688After:
5689
5690 guile> (arity foo)
5691 3 optional arguments: `a', `b' and `c'.
5692 guile> (define* (bar a b #:key c d #:allow-other-keys) a)
5693 guile> (arity bar)
5694 2 required arguments: `a' and `b', 2 keyword arguments: `c'
5695 and `d', other keywords allowed.
5696 guile> (define* (baz a b #:optional c #:rest r) a)
5697 guile> (arity baz)
5698 2 required arguments: `a' and `b', 1 optional argument: `c',
5699 the rest in `r'.
5700
311b6a3c
MV
5701* Changes to the C interface
5702
c81c130e
MV
5703** Types have been renamed from scm_*_t to scm_t_*.
5704
5705This has been done for POSIX sake. It reserves identifiers ending
5706with "_t". What a concept.
5707
5708The old names are still available with status `deprecated'.
5709
5710** scm_t_bits (former scm_bits_t) is now a unsigned type.
5711
6e9382f1 5712** Deprecated features have been removed.
e6c9e497
MV
5713
5714*** Macros removed
5715
5716 SCM_INPORTP, SCM_OUTPORTP SCM_ICHRP, SCM_ICHR, SCM_MAKICHR
5717 SCM_SETJMPBUF SCM_NSTRINGP SCM_NRWSTRINGP SCM_NVECTORP SCM_DOUBLE_CELLP
5718
5719*** C Functions removed
5720
5721 scm_sysmissing scm_tag scm_tc16_flo scm_tc_flo
5722 scm_fseek - replaced by scm_seek.
5723 gc-thunk - replaced by after-gc-hook.
5724 gh_int2scmb - replaced by gh_bool2scm.
5725 scm_tc_dblr - replaced by scm_tc16_real.
5726 scm_tc_dblc - replaced by scm_tc16_complex.
5727 scm_list_star - replaced by scm_cons_star.
5728
36284627
DH
5729** Deprecated: scm_makfromstr
5730
5731Use scm_mem2string instead.
5732
311b6a3c
MV
5733** Deprecated: scm_make_shared_substring
5734
5735Explicit shared substrings will disappear from Guile.
5736
5737Instead, "normal" strings will be implemented using sharing
5738internally, combined with a copy-on-write strategy.
5739
5740** Deprecated: scm_read_only_string_p
5741
5742The concept of read-only strings will disappear in next release of
5743Guile.
5744
5745** Deprecated: scm_sloppy_memq, scm_sloppy_memv, scm_sloppy_member
c299f186 5746
311b6a3c 5747Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
c299f186 5748
dd0e04ed
KN
5749** New functions: scm_call_0, scm_call_1, scm_call_2, scm_call_3
5750
83dbedcc
KR
5751Call a procedure with the indicated number of arguments. See "Fly
5752Evaluation" in the manual.
dd0e04ed
KN
5753
5754** New functions: scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3
5755
83dbedcc
KR
5756Call a procedure with the indicated number of arguments and a list of
5757further arguments. See "Fly Evaluation" in the manual.
dd0e04ed 5758
e235f2a6
KN
5759** New functions: scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5
5760
83dbedcc
KR
5761Create a list of the given number of elements. See "List
5762Constructors" in the manual.
e235f2a6
KN
5763
5764** Renamed function: scm_listify has been replaced by scm_list_n.
5765
5766** Deprecated macros: SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4,
5767SCM_LIST5, SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9.
5768
5769Use functions scm_list_N instead.
5770
6fe692e9
MD
5771** New function: scm_c_read (SCM port, void *buffer, scm_sizet size)
5772
5773Used by an application to read arbitrary number of bytes from a port.
5774Same semantics as libc read, except that scm_c_read only returns less
5775than SIZE bytes if at end-of-file.
5776
5777Warning: Doesn't update port line and column counts!
5778
5779** New function: scm_c_write (SCM port, const void *ptr, scm_sizet size)
5780
5781Used by an application to write arbitrary number of bytes to an SCM
5782port. Similar semantics as libc write. However, unlike libc
5783write, scm_c_write writes the requested number of bytes and has no
5784return value.
5785
5786Warning: Doesn't update port line and column counts!
5787
17f367e0
MV
5788** New function: scm_init_guile ()
5789
5790In contrast to scm_boot_guile, scm_init_guile will return normally
5791after initializing Guile. It is not available on all systems, tho.
5792
23ade5e7
DH
5793** New functions: scm_str2symbol, scm_mem2symbol
5794
5795The function scm_str2symbol takes a const char* pointing to a zero-terminated
5796field of characters and creates a scheme symbol object from that C string.
5797The function scm_mem2symbol takes a const char* and a number of characters and
5798creates a symbol from the characters in that memory area.
5799
17f367e0
MV
5800** New functions: scm_primitive_make_property
5801 scm_primitive_property_ref
5802 scm_primitive_property_set_x
5803 scm_primitive_property_del_x
5804
5805These functions implement a new way to deal with object properties.
5806See libguile/properties.c for their documentation.
5807
9d47a1e6
ML
5808** New function: scm_done_free (long size)
5809
5810This function is the inverse of scm_done_malloc. Use it to report the
5811amount of smob memory you free. The previous method, which involved
5812calling scm_done_malloc with negative argument, was somewhat
5813unintuitive (and is still available, of course).
5814
79a3dafe
DH
5815** New function: scm_c_memq (SCM obj, SCM list)
5816
5817This function provides a fast C level alternative for scm_memq for the case
5818that the list parameter is known to be a proper list. The function is a
5819replacement for scm_sloppy_memq, but is stricter in its requirements on its
5820list input parameter, since for anything else but a proper list the function's
5821behaviour is undefined - it may even crash or loop endlessly. Further, for
5822the case that the object is not found in the list, scm_c_memq returns #f which
5823is similar to scm_memq, but different from scm_sloppy_memq's behaviour.
5824
6c0201ad 5825** New functions: scm_remember_upto_here_1, scm_remember_upto_here_2,
5d2b97cd
DH
5826scm_remember_upto_here
5827
5828These functions replace the function scm_remember.
5829
5830** Deprecated function: scm_remember
5831
5832Use one of the new functions scm_remember_upto_here_1,
5833scm_remember_upto_here_2 or scm_remember_upto_here instead.
5834
be54b15d
DH
5835** New function: scm_allocate_string
5836
5837This function replaces the function scm_makstr.
5838
5839** Deprecated function: scm_makstr
5840
5841Use the new function scm_allocate_string instead.
5842
32d0d4b1
DH
5843** New global variable scm_gc_running_p introduced.
5844
5845Use this variable to find out if garbage collection is being executed. Up to
5846now applications have used scm_gc_heap_lock to test if garbage collection was
5847running, which also works because of the fact that up to know only the garbage
5848collector has set this variable. But, this is an implementation detail that
5849may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use
5850of this variable is (and has been) not fully safe anyway.
5851
5b9eb8ae
DH
5852** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH
5853
5854Use these instead of SCM_LENGTH_MAX.
5855
6c0201ad 5856** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH,
a6d9e5ab
DH
5857SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH,
5858SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH.
5859
5860Use these instead of SCM_LENGTH.
5861
6c0201ad 5862** New macros: SCM_SET_CONTINUATION_LENGTH, SCM_SET_STRING_LENGTH,
93778877
DH
5863SCM_SET_SYMBOL_LENGTH, SCM_SET_VECTOR_LENGTH, SCM_SET_UVECTOR_LENGTH,
5864SCM_SET_BITVECTOR_LENGTH
bc0eaf7b
DH
5865
5866Use these instead of SCM_SETLENGTH
5867
6c0201ad 5868** New macros: SCM_STRING_CHARS, SCM_SYMBOL_CHARS, SCM_CCLO_BASE,
a6d9e5ab
DH
5869SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM,
5870SCM_ARRAY_MEM
5871
e51fe79c
DH
5872Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or
5873SCM_VELTS.
a6d9e5ab 5874
6c0201ad 5875** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS,
6a0476fd
DH
5876SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE,
5877SCM_SET_VECTOR_BASE
5878
5879Use these instead of SCM_SETCHARS.
5880
a6d9e5ab
DH
5881** New macro: SCM_BITVECTOR_P
5882
5883** New macro: SCM_STRING_COERCE_0TERMINATION_X
5884
5885Use instead of SCM_COERCE_SUBSTR.
5886
30ea841d
DH
5887** New macros: SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN
5888
5889For directory objects, use these instead of SCM_OPDIRP and SCM_OPN.
5890
6c0201ad
TTN
5891** Deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL,
5892SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL,
5893SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD,
d1ca2c64 5894SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SYMBOL_SLOTS, SCM_SLOTS, SCM_SLOPPY_STRINGP,
a6d9e5ab
DH
5895SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
5896SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
5897SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
b24b5e13 5898SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
34f0f2b8 5899SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
fd336365 5900SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP,
30ea841d 5901SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC,
b3fcac34
DH
5902SCM_OPDIRP, SCM_VALIDATE_OPDIR, SCM_WTA, RETURN_SCM_WTA, SCM_CONST_LONG,
5903SCM_WNA, SCM_FUNC_NAME, SCM_VALIDATE_NUMBER_COPY,
61045190 5904SCM_VALIDATE_NUMBER_DEF_COPY, SCM_SLOPPY_CONSP, SCM_SLOPPY_NCONSP,
e038c042 5905SCM_SETAND_CDR, SCM_SETOR_CDR, SCM_SETAND_CAR, SCM_SETOR_CAR
b63a956d
DH
5906
5907Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
5908Use scm_memory_error instead of SCM_NALLOC.
c1aef037 5909Use SCM_STRINGP instead of SCM_SLOPPY_STRINGP.
d1ca2c64
DH
5910Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_STRINGORSUBSTR.
5911Use SCM_FREE_CELL_P instead of SCM_FREEP/SCM_NFREEP
a6d9e5ab 5912Use a type specific accessor macro instead of SCM_CHARS/SCM_UCHARS.
6c0201ad 5913Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH.
a6d9e5ab
DH
5914Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING.
5915Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
b24b5e13 5916Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
f0942910
DH
5917Use SCM_STRINGP instead of SCM_RWSTRINGP.
5918Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
34f0f2b8
DH
5919Use SCM_STRING_CHARS instead of SCM_ROCHARS.
5920Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
93778877 5921Use a type specific setter macro instead of SCM_SETLENGTH.
6a0476fd 5922Use a type specific setter macro instead of SCM_SETCHARS.
5b9eb8ae 5923Use a type specific length macro instead of SCM_LENGTH_MAX.
fd336365
DH
5924Use SCM_GCMARKP instead of SCM_GC8MARKP.
5925Use SCM_SETGCMARK instead of SCM_SETGC8MARK.
5926Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK.
5927Use SCM_TYP16 instead of SCM_GCTYP16.
5928Use SCM_CDR instead of SCM_GCCDR.
30ea841d 5929Use SCM_DIR_OPEN_P instead of SCM_OPDIRP.
276dd677
DH
5930Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of SCM_WTA.
5931Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of RETURN_SCM_WTA.
8dea8611 5932Use SCM_VCELL_INIT instead of SCM_CONST_LONG.
b3fcac34 5933Use SCM_WRONG_NUM_ARGS instead of SCM_WNA.
ced99e92
DH
5934Use SCM_CONSP instead of SCM_SLOPPY_CONSP.
5935Use !SCM_CONSP instead of SCM_SLOPPY_NCONSP.
b63a956d 5936
f7620510
DH
5937** Removed function: scm_struct_init
5938
93d40df2
DH
5939** Removed variable: scm_symhash_dim
5940
818febc0
GH
5941** Renamed function: scm_make_cont has been replaced by
5942scm_make_continuation, which has a different interface.
5943
cc4feeca
DH
5944** Deprecated function: scm_call_catching_errors
5945
5946Use scm_catch or scm_lazy_catch from throw.[ch] instead.
5947
28b06554
DH
5948** Deprecated function: scm_strhash
5949
5950Use scm_string_hash instead.
5951
1b9be268
DH
5952** Deprecated function: scm_vector_set_length_x
5953
5954Instead, create a fresh vector of the desired size and copy the contents.
5955
302f229e
MD
5956** scm_gensym has changed prototype
5957
5958scm_gensym now only takes one argument.
5959
1660782e
DH
5960** Deprecated type tags: scm_tc7_ssymbol, scm_tc7_msymbol, scm_tcs_symbols,
5961scm_tc7_lvector
28b06554
DH
5962
5963There is now only a single symbol type scm_tc7_symbol.
1660782e 5964The tag scm_tc7_lvector was not used anyway.
28b06554 5965
2f6fb7c5
KN
5966** Deprecated function: scm_make_smob_type_mfpe, scm_set_smob_mfpe.
5967
5968Use scm_make_smob_type and scm_set_smob_XXX instead.
5969
5970** New function scm_set_smob_apply.
5971
5972This can be used to set an apply function to a smob type.
5973
1f3908c4
KN
5974** Deprecated function: scm_strprint_obj
5975
5976Use scm_object_to_string instead.
5977
b3fcac34
DH
5978** Deprecated function: scm_wta
5979
5980Use scm_wrong_type_arg, or another appropriate error signalling function
5981instead.
5982
f3f9dcbc
MV
5983** Explicit support for obarrays has been deprecated.
5984
5985Use `scm_str2symbol' and the generic hashtable functions instead.
5986
5987** The concept of `vcells' has been deprecated.
5988
5989The data type `variable' is now used exclusively. `Vcells' have been
5990a low-level concept so you are likely not affected by this change.
5991
5992*** Deprecated functions: scm_sym2vcell, scm_sysintern,
5993 scm_sysintern0, scm_symbol_value0, scm_intern, scm_intern0.
5994
5995Use scm_c_define or scm_c_lookup instead, as appropriate.
5996
5997*** New functions: scm_c_module_lookup, scm_c_lookup,
5998 scm_c_module_define, scm_c_define, scm_module_lookup, scm_lookup,
5999 scm_module_define, scm_define.
6000
6001These functions work with variables instead of with vcells.
6002
311b6a3c
MV
6003** New functions for creating and defining `subr's and `gsubr's.
6004
6005The new functions more clearly distinguish between creating a subr (or
6006gsubr) object and adding it to the current module.
6007
6008These new functions are available: scm_c_make_subr, scm_c_define_subr,
6009scm_c_make_subr_with_generic, scm_c_define_subr_with_generic,
6010scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
6011scm_c_define_gsubr_with_generic.
6012
6013** Deprecated functions: scm_make_subr, scm_make_subr_opt,
6014 scm_make_subr_with_generic, scm_make_gsubr,
6015 scm_make_gsubr_with_generic.
6016
6017Use the new ones from above instead.
6018
6019** C interface to the module system has changed.
6020
6021While we suggest that you avoid as many explicit module system
6022operations from C as possible for the time being, the C interface has
6023been made more similar to the high-level Scheme module system.
6024
6025*** New functions: scm_c_define_module, scm_c_use_module,
6026 scm_c_export, scm_c_resolve_module.
6027
6028They mostly work like their Scheme namesakes. scm_c_define_module
6029takes a function that is called a context where the new module is
6030current.
6031
6032*** Deprecated functions: scm_the_root_module, scm_make_module,
6033 scm_ensure_user_module, scm_load_scheme_module.
6034
6035Use the new functions instead.
6036
6037** Renamed function: scm_internal_with_fluids becomes
6038 scm_c_with_fluids.
6039
6040scm_internal_with_fluids is available as a deprecated function.
6041
6042** New function: scm_c_with_fluid.
6043
6044Just like scm_c_with_fluids, but takes one fluid and one value instead
6045of lists of same.
6046
1be6b49c
ML
6047** Deprecated typedefs: long_long, ulong_long.
6048
6049They are of questionable utility and they pollute the global
6050namespace.
6051
1be6b49c
ML
6052** Deprecated typedef: scm_sizet
6053
6054It is of questionable utility now that Guile requires ANSI C, and is
6055oddly named.
6056
6057** Deprecated typedefs: scm_port_rw_active, scm_port,
6058 scm_ptob_descriptor, scm_debug_info, scm_debug_frame, scm_fport,
6059 scm_option, scm_rstate, scm_rng, scm_array, scm_array_dim.
6060
6061Made more compliant with the naming policy by adding a _t at the end.
6062
6063** Deprecated functions: scm_mkbig, scm_big2num, scm_adjbig,
6064 scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl
6065
373f4948 6066With the exception of the mysterious scm_2ulong2big, they are still
1be6b49c
ML
6067available under new names (scm_i_mkbig etc). These functions are not
6068intended to be used in user code. You should avoid dealing with
6069bignums directly, and should deal with numbers in general (which can
6070be bignums).
6071
147c18a0
MD
6072** Change in behavior: scm_num2long, scm_num2ulong
6073
6074The scm_num2[u]long functions don't any longer accept an inexact
6075argument. This change in behavior is motivated by concordance with
6076R5RS: It is more common that a primitive doesn't want to accept an
6077inexact for an exact.
6078
1be6b49c 6079** New functions: scm_short2num, scm_ushort2num, scm_int2num,
f3f70257
ML
6080 scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
6081 scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff,
1be6b49c
ML
6082 scm_num2size.
6083
6084These are conversion functions between the various ANSI C integral
147c18a0
MD
6085types and Scheme numbers. NOTE: The scm_num2xxx functions don't
6086accept an inexact argument.
1be6b49c 6087
5437598b
MD
6088** New functions: scm_float2num, scm_double2num,
6089 scm_num2float, scm_num2double.
6090
6091These are conversion functions between the two ANSI C float types and
6092Scheme numbers.
6093
1be6b49c 6094** New number validation macros:
f3f70257 6095 SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF]
1be6b49c
ML
6096
6097See above.
6098
fc62c86a
ML
6099** New functions: scm_gc_protect_object, scm_gc_unprotect_object
6100
6101These are just nicer-named old scm_protect_object and
6102scm_unprotect_object.
6103
6104** Deprecated functions: scm_protect_object, scm_unprotect_object
6105
6106** New functions: scm_gc_[un]register_root, scm_gc_[un]register_roots
6107
6108These functions can be used to register pointers to locations that
6109hold SCM values.
6110
5b2ad23b
ML
6111** Deprecated function: scm_create_hook.
6112
6113Its sins are: misleading name, non-modularity and lack of general
6114usefulness.
6115
c299f186 6116\f
cc36e791
JB
6117Changes since Guile 1.3.4:
6118
80f27102
JB
6119* Changes to the distribution
6120
ce358662
JB
6121** Trees from nightly snapshots and CVS now require you to run autogen.sh.
6122
6123We've changed the way we handle generated files in the Guile source
6124repository. As a result, the procedure for building trees obtained
6125from the nightly FTP snapshots or via CVS has changed:
6126- You must have appropriate versions of autoconf, automake, and
6127 libtool installed on your system. See README for info on how to
6128 obtain these programs.
6129- Before configuring the tree, you must first run the script
6130 `autogen.sh' at the top of the source tree.
6131
6132The Guile repository used to contain not only source files, written by
6133humans, but also some generated files, like configure scripts and
6134Makefile.in files. Even though the contents of these files could be
6135derived mechanically from other files present, we thought it would
6136make the tree easier to build if we checked them into CVS.
6137
6138However, this approach means that minor differences between
6139developer's installed tools and habits affected the whole team.
6140So we have removed the generated files from the repository, and
6141added the autogen.sh script, which will reconstruct them
6142appropriately.
6143
6144
dc914156
GH
6145** configure now has experimental options to remove support for certain
6146features:
52cfc69b 6147
dc914156
GH
6148--disable-arrays omit array and uniform array support
6149--disable-posix omit posix interfaces
6150--disable-networking omit networking interfaces
6151--disable-regex omit regular expression interfaces
52cfc69b
GH
6152
6153These are likely to become separate modules some day.
6154
9764c29b 6155** New configure option --enable-debug-freelist
e1b0d0ac 6156
38a15cfd
GB
6157This enables a debugging version of SCM_NEWCELL(), and also registers
6158an extra primitive, the setter `gc-set-debug-check-freelist!'.
6159
6160Configure with the --enable-debug-freelist option to enable
6161the gc-set-debug-check-freelist! primitive, and then use:
6162
6163(gc-set-debug-check-freelist! #t) # turn on checking of the freelist
6164(gc-set-debug-check-freelist! #f) # turn off checking
6165
6166Checking of the freelist forces a traversal of the freelist and
6167a garbage collection before each allocation of a cell. This can
6168slow down the interpreter dramatically, so the setter should be used to
6169turn on this extra processing only when necessary.
e1b0d0ac 6170
9764c29b
MD
6171** New configure option --enable-debug-malloc
6172
6173Include code for debugging of calls to scm_must_malloc/realloc/free.
6174
6175Checks that
6176
61771. objects freed by scm_must_free has been mallocated by scm_must_malloc
61782. objects reallocated by scm_must_realloc has been allocated by
6179 scm_must_malloc
61803. reallocated objects are reallocated with the same what string
6181
6182But, most importantly, it records the number of allocated objects of
6183each kind. This is useful when searching for memory leaks.
6184
6185A Guile compiled with this option provides the primitive
6186`malloc-stats' which returns an alist with pairs of kind and the
6187number of objects of that kind.
6188
e415cb06
MD
6189** All includes are now referenced relative to the root directory
6190
6191Since some users have had problems with mixups between Guile and
6192system headers, we have decided to always refer to Guile headers via
6193their parent directories. This essentially creates a "private name
6194space" for Guile headers. This means that the compiler only is given
6195-I options for the root build and root source directory.
6196
341f78c9
MD
6197** Header files kw.h and genio.h have been removed.
6198
6199** The module (ice-9 getopt-gnu-style) has been removed.
6200
e8855f8d
MD
6201** New module (ice-9 documentation)
6202
6203Implements the interface to documentation strings associated with
6204objects.
6205
0c0ffe09
KN
6206** New module (ice-9 time)
6207
6208Provides a macro `time', which displays execution time of a given form.
6209
cf7a5ee5
KN
6210** New module (ice-9 history)
6211
6212Loading this module enables value history in the repl.
6213
0af43c4a 6214* Changes to the stand-alone interpreter
bd9e24b3 6215
67ef2dca
MD
6216** New command line option --debug
6217
6218Start Guile with debugging evaluator and backtraces enabled.
6219
6220This is useful when debugging your .guile init file or scripts.
6221
aa4bb95d
MD
6222** New help facility
6223
341f78c9
MD
6224Usage: (help NAME) gives documentation about objects named NAME (a symbol)
6225 (help REGEXP) ditto for objects with names matching REGEXP (a string)
58e5b910 6226 (help 'NAME) gives documentation for NAME, even if it is not an object
341f78c9 6227 (help ,EXPR) gives documentation for object returned by EXPR
6c0201ad 6228 (help (my module)) gives module commentary for `(my module)'
341f78c9
MD
6229 (help) gives this text
6230
6231`help' searches among bindings exported from loaded modules, while
6232`apropos' searches among bindings visible from the "current" module.
6233
6234Examples: (help help)
6235 (help cons)
6236 (help "output-string")
aa4bb95d 6237
e8855f8d
MD
6238** `help' and `apropos' now prints full module names
6239
0af43c4a 6240** Dynamic linking now uses libltdl from the libtool package.
bd9e24b3 6241
0af43c4a
MD
6242The old system dependent code for doing dynamic linking has been
6243replaced with calls to the libltdl functions which do all the hairy
6244details for us.
bd9e24b3 6245
0af43c4a
MD
6246The major improvement is that you can now directly pass libtool
6247library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
6248will be able to do the best shared library job you can get, via
6249libltdl.
bd9e24b3 6250
0af43c4a
MD
6251The way dynamic libraries are found has changed and is not really
6252portable across platforms, probably. It is therefore recommended to
6253use absolute filenames when possible.
6254
6255If you pass a filename without an extension to `dynamic-link', it will
6256try a few appropriate ones. Thus, the most platform ignorant way is
6257to specify a name like "libfoo", without any directories and
6258extensions.
0573ddae 6259
91163914
MD
6260** Guile COOP threads are now compatible with LinuxThreads
6261
6262Previously, COOP threading wasn't possible in applications linked with
6263Linux POSIX threads due to their use of the stack pointer to find the
6264thread context. This has now been fixed with a workaround which uses
6265the pthreads to allocate the stack.
6266
6c0201ad 6267** New primitives: `pkgdata-dir', `site-dir', `library-dir'
62b82274 6268
9770d235
MD
6269** Positions of erring expression in scripts
6270
6271With version 1.3.4, the location of the erring expression in Guile
6272scipts is no longer automatically reported. (This should have been
6273documented before the 1.3.4 release.)
6274
6275You can get this information by enabling recording of positions of
6276source expressions and running the debugging evaluator. Put this at
6277the top of your script (or in your "site" file):
6278
6279 (read-enable 'positions)
6280 (debug-enable 'debug)
6281
0573ddae
MD
6282** Backtraces in scripts
6283
6284It is now possible to get backtraces in scripts.
6285
6286Put
6287
6288 (debug-enable 'debug 'backtrace)
6289
6290at the top of the script.
6291
6292(The first options enables the debugging evaluator.
6293 The second enables backtraces.)
6294
e8855f8d
MD
6295** Part of module system symbol lookup now implemented in C
6296
6297The eval closure of most modules is now implemented in C. Since this
6298was one of the bottlenecks for loading speed, Guile now loads code
6299substantially faster than before.
6300
f25f761d
GH
6301** Attempting to get the value of an unbound variable now produces
6302an exception with a key of 'unbound-variable instead of 'misc-error.
6303
1a35eadc
GH
6304** The initial default output port is now unbuffered if it's using a
6305tty device. Previously in this situation it was line-buffered.
6306
820920e6
MD
6307** New hook: after-gc-hook
6308
6309after-gc-hook takes over the role of gc-thunk. This hook is run at
6310the first SCM_TICK after a GC. (Thus, the code is run at the same
6311point during evaluation as signal handlers.)
6312
6313Note that this hook should be used only for diagnostic and debugging
6314purposes. It is not certain that it will continue to be well-defined
6315when this hook is run in the future.
6316
6317C programmers: Note the new C level hooks scm_before_gc_c_hook,
6318scm_before_sweep_c_hook, scm_after_gc_c_hook.
6319
b5074b23
MD
6320** Improvements to garbage collector
6321
6322Guile 1.4 has a new policy for triggering heap allocation and
6323determining the sizes of heap segments. It fixes a number of problems
6324in the old GC.
6325
63261. The new policy can handle two separate pools of cells
6327 (2-word/4-word) better. (The old policy would run wild, allocating
6328 more and more memory for certain programs.)
6329
63302. The old code would sometimes allocate far too much heap so that the
6331 Guile process became gigantic. The new code avoids this.
6332
63333. The old code would sometimes allocate too little so that few cells
6334 were freed at GC so that, in turn, too much time was spent in GC.
6335
63364. The old code would often trigger heap allocation several times in a
6337 row. (The new scheme predicts how large the segments needs to be
6338 in order not to need further allocation.)
6339
e8855f8d
MD
6340All in all, the new GC policy will make larger applications more
6341efficient.
6342
b5074b23
MD
6343The new GC scheme also is prepared for POSIX threading. Threads can
6344allocate private pools of cells ("clusters") with just a single
6345function call. Allocation of single cells from such a cluster can
6346then proceed without any need of inter-thread synchronization.
6347
6348** New environment variables controlling GC parameters
6349
6350GUILE_MAX_SEGMENT_SIZE Maximal segment size
6351 (default = 2097000)
6352
6353Allocation of 2-word cell heaps:
6354
6355GUILE_INIT_SEGMENT_SIZE_1 Size of initial heap segment in bytes
6356 (default = 360000)
6357
6358GUILE_MIN_YIELD_1 Minimum number of freed cells at each
6359 GC in percent of total heap size
6360 (default = 40)
6361
6362Allocation of 4-word cell heaps
6363(used for real numbers and misc other objects):
6364
6365GUILE_INIT_SEGMENT_SIZE_2, GUILE_MIN_YIELD_2
6366
6367(See entry "Way for application to customize GC parameters" under
6368 section "Changes to the scm_ interface" below.)
6369
67ef2dca
MD
6370** Guile now implements reals using 4-word cells
6371
6372This speeds up computation with reals. (They were earlier allocated
6373with `malloc'.) There is still some room for optimizations, however.
6374
6375** Some further steps toward POSIX thread support have been taken
6376
6377*** Guile's critical sections (SCM_DEFER/ALLOW_INTS)
6378don't have much effect any longer, and many of them will be removed in
6379next release.
6380
6381*** Signals
6382are only handled at the top of the evaluator loop, immediately after
6383I/O, and in scm_equalp.
6384
6385*** The GC can allocate thread private pools of pairs.
6386
0af43c4a
MD
6387* Changes to Scheme functions and syntax
6388
a0128ebe 6389** close-input-port and close-output-port are now R5RS
7c1e0b12 6390
a0128ebe 6391These procedures have been turned into primitives and have R5RS behaviour.
7c1e0b12 6392
0af43c4a
MD
6393** New procedure: simple-format PORT MESSAGE ARG1 ...
6394
6395(ice-9 boot) makes `format' an alias for `simple-format' until possibly
6396extended by the more sophisticated version in (ice-9 format)
6397
6398(simple-format port message . args)
6399Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
6400MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
6401the escapes are replaced with corresponding members of ARGS:
6402~A formats using `display' and ~S formats using `write'.
6403If DESTINATION is #t, then use the `current-output-port',
6404if DESTINATION is #f, then return a string containing the formatted text.
6405Does not add a trailing newline."
6406
6407** string-ref: the second argument is no longer optional.
6408
6409** string, list->string: no longer accept strings in their arguments,
6410only characters, for compatibility with R5RS.
6411
6412** New procedure: port-closed? PORT
6413Returns #t if PORT is closed or #f if it is open.
6414
0a9e521f
MD
6415** Deprecated: list*
6416
6417The list* functionality is now provided by cons* (SRFI-1 compliant)
6418
b5074b23
MD
6419** New procedure: cons* ARG1 ARG2 ... ARGn
6420
6421Like `list', but the last arg provides the tail of the constructed list,
6422returning (cons ARG1 (cons ARG2 (cons ... ARGn))).
6423
6424Requires at least one argument. If given one argument, that argument
6425is returned as result.
6426
6427This function is called `list*' in some other Schemes and in Common LISP.
6428
341f78c9
MD
6429** Removed deprecated: serial-map, serial-array-copy!, serial-array-map!
6430
e8855f8d
MD
6431** New procedure: object-documentation OBJECT
6432
6433Returns the documentation string associated with OBJECT. The
6434procedure uses a caching mechanism so that subsequent lookups are
6435faster.
6436
6437Exported by (ice-9 documentation).
6438
6439** module-name now returns full names of modules
6440
6441Previously, only the last part of the name was returned (`session' for
6442`(ice-9 session)'). Ex: `(ice-9 session)'.
6443
894a712b
DH
6444* Changes to the gh_ interface
6445
6446** Deprecated: gh_int2scmb
6447
6448Use gh_bool2scm instead.
6449
a2349a28
GH
6450* Changes to the scm_ interface
6451
810e1aec
MD
6452** Guile primitives now carry docstrings!
6453
6454Thanks to Greg Badros!
6455
0a9e521f 6456** Guile primitives are defined in a new way: SCM_DEFINE/SCM_DEFINE1/SCM_PROC
0af43c4a 6457
0a9e521f
MD
6458Now Guile primitives are defined using the SCM_DEFINE/SCM_DEFINE1/SCM_PROC
6459macros and must contain a docstring that is extracted into foo.doc using a new
0af43c4a
MD
6460guile-doc-snarf script (that uses guile-doc-snarf.awk).
6461
0a9e521f
MD
6462However, a major overhaul of these macros is scheduled for the next release of
6463guile.
6464
0af43c4a
MD
6465** Guile primitives use a new technique for validation of arguments
6466
6467SCM_VALIDATE_* macros are defined to ease the redundancy and improve
6468the readability of argument checking.
6469
6470** All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
6471
894a712b 6472** New macros: SCM_PACK, SCM_UNPACK
f8a72ca4
MD
6473
6474Compose/decompose an SCM value.
6475
894a712b
DH
6476The SCM type is now treated as an abstract data type and may be defined as a
6477long, a void* or as a struct, depending on the architecture and compile time
6478options. This makes it easier to find several types of bugs, for example when
6479SCM values are treated as integers without conversion. Values of the SCM type
6480should be treated as "atomic" values. These macros are used when
f8a72ca4
MD
6481composing/decomposing an SCM value, either because you want to access
6482individual bits, or because you want to treat it as an integer value.
6483
6484E.g., in order to set bit 7 in an SCM value x, use the expression
6485
6486 SCM_PACK (SCM_UNPACK (x) | 0x80)
6487
e11f8b42
DH
6488** The name property of hooks is deprecated.
6489Thus, the use of SCM_HOOK_NAME and scm_make_hook_with_name is deprecated.
6490
6491You can emulate this feature by using object properties.
6492
6c0201ad 6493** Deprecated macros: SCM_INPORTP, SCM_OUTPORTP, SCM_CRDY, SCM_ICHRP,
894a712b
DH
6494SCM_ICHR, SCM_MAKICHR, SCM_SETJMPBUF, SCM_NSTRINGP, SCM_NRWSTRINGP,
6495SCM_NVECTORP
f8a72ca4 6496
894a712b 6497These macros will be removed in a future release of Guile.
7c1e0b12 6498
6c0201ad 6499** The following types, functions and macros from numbers.h are deprecated:
0a9e521f
MD
6500scm_dblproc, SCM_UNEGFIXABLE, SCM_FLOBUFLEN, SCM_INEXP, SCM_CPLXP, SCM_REAL,
6501SCM_IMAG, SCM_REALPART, scm_makdbl, SCM_SINGP, SCM_NUM2DBL, SCM_NO_BIGDIG
6502
a2349a28
GH
6503** Port internals: the rw_random variable in the scm_port structure
6504must be set to non-zero in any random access port. In recent Guile
6505releases it was only set for bidirectional random-access ports.
6506
7dcb364d
GH
6507** Port internals: the seek ptob procedure is now responsible for
6508resetting the buffers if required. The change was made so that in the
6509special case of reading the current position (i.e., seek p 0 SEEK_CUR)
6510the fport and strport ptobs can avoid resetting the buffers,
6511in particular to avoid discarding unread chars. An existing port
6512type can be fixed by adding something like the following to the
6513beginning of the ptob seek procedure:
6514
6515 if (pt->rw_active == SCM_PORT_READ)
6516 scm_end_input (object);
6517 else if (pt->rw_active == SCM_PORT_WRITE)
6518 ptob->flush (object);
6519
6520although to actually avoid resetting the buffers and discard unread
6521chars requires further hacking that depends on the characteristics
6522of the ptob.
6523
894a712b
DH
6524** Deprecated functions: scm_fseek, scm_tag
6525
6526These functions are no longer used and will be removed in a future version.
6527
f25f761d
GH
6528** The scm_sysmissing procedure is no longer used in libguile.
6529Unless it turns out to be unexpectedly useful to somebody, it will be
6530removed in a future version.
6531
0af43c4a
MD
6532** The format of error message strings has changed
6533
6534The two C procedures: scm_display_error and scm_error, as well as the
6535primitive `scm-error', now use scm_simple_format to do their work.
6536This means that the message strings of all code must be updated to use
6537~A where %s was used before, and ~S where %S was used before.
6538
6539During the period when there still are a lot of old Guiles out there,
6540you might want to support both old and new versions of Guile.
6541
6542There are basically two methods to achieve this. Both methods use
6543autoconf. Put
6544
6545 AC_CHECK_FUNCS(scm_simple_format)
6546
6547in your configure.in.
6548
6549Method 1: Use the string concatenation features of ANSI C's
6550 preprocessor.
6551
6552In C:
6553
6554#ifdef HAVE_SCM_SIMPLE_FORMAT
6555#define FMT_S "~S"
6556#else
6557#define FMT_S "%S"
6558#endif
6559
6560Then represent each of your error messages using a preprocessor macro:
6561
6562#define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!"
6563
6564In Scheme:
6565
6566(define fmt-s (if (defined? 'simple-format) "~S" "%S"))
6567(define make-message string-append)
6568
6569(define e-spider-error (make-message "There's a spider in your " fmt-s "!!!"))
6570
6571Method 2: Use the oldfmt function found in doc/oldfmt.c.
6572
6573In C:
6574
6575scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"),
6576 ...);
6577
6578In Scheme:
6579
6580(scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!")
6581 ...)
6582
6583
f3b5e185
MD
6584** Deprecated: coop_mutex_init, coop_condition_variable_init
6585
6586Don't use the functions coop_mutex_init and
6587coop_condition_variable_init. They will change.
6588
6589Use scm_mutex_init and scm_cond_init instead.
6590
f3b5e185
MD
6591** New function: int scm_cond_timedwait (scm_cond_t *COND, scm_mutex_t *MUTEX, const struct timespec *ABSTIME)
6592 `scm_cond_timedwait' atomically unlocks MUTEX and waits on
6593 COND, as `scm_cond_wait' does, but it also bounds the duration
6594 of the wait. If COND has not been signaled before time ABSTIME,
6595 the mutex MUTEX is re-acquired and `scm_cond_timedwait'
6596 returns the error code `ETIMEDOUT'.
6597
6598 The ABSTIME parameter specifies an absolute time, with the same
6599 origin as `time' and `gettimeofday': an ABSTIME of 0 corresponds
6600 to 00:00:00 GMT, January 1, 1970.
6601
6602** New function: scm_cond_broadcast (scm_cond_t *COND)
6603 `scm_cond_broadcast' restarts all the threads that are waiting
6604 on the condition variable COND. Nothing happens if no threads are
6605 waiting on COND.
6606
6607** New function: scm_key_create (scm_key_t *KEY, void (*destr_function) (void *))
6608 `scm_key_create' allocates a new TSD key. The key is stored in
6609 the location pointed to by KEY. There is no limit on the number
6610 of keys allocated at a given time. The value initially associated
6611 with the returned key is `NULL' in all currently executing threads.
6612
6613 The DESTR_FUNCTION argument, if not `NULL', specifies a destructor
6614 function associated with the key. When a thread terminates,
6615 DESTR_FUNCTION is called on the value associated with the key in
6616 that thread. The DESTR_FUNCTION is not called if a key is deleted
6617 with `scm_key_delete' or a value is changed with
6618 `scm_setspecific'. The order in which destructor functions are
6619 called at thread termination time is unspecified.
6620
6621 Destructors are not yet implemented.
6622
6623** New function: scm_setspecific (scm_key_t KEY, const void *POINTER)
6624 `scm_setspecific' changes the value associated with KEY in the
6625 calling thread, storing the given POINTER instead.
6626
6627** New function: scm_getspecific (scm_key_t KEY)
6628 `scm_getspecific' returns the value currently associated with
6629 KEY in the calling thread.
6630
6631** New function: scm_key_delete (scm_key_t KEY)
6632 `scm_key_delete' deallocates a TSD key. It does not check
6633 whether non-`NULL' values are associated with that key in the
6634 currently executing threads, nor call the destructor function
6635 associated with the key.
6636
820920e6
MD
6637** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE)
6638
6639Initialize a C level hook HOOK with associated HOOK_DATA and type
6640TYPE. (See scm_c_hook_run ().)
6641
6642** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP)
6643
6644Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP
6645is true, add it last, otherwise first. The same FUNC can be added
6646multiple times if FUNC_DATA differ and vice versa.
6647
6648** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA)
6649
6650Remove hook function FUNC with associated FUNC_DATA from HOOK. A
6651function is only removed if both FUNC and FUNC_DATA matches.
6652
6653** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA)
6654
6655Run hook HOOK passing DATA to the hook functions.
6656
6657If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value
6658returned is undefined.
6659
6660If TYPE is SCM_C_HOOK_OR, hook functions are run until a function
6661returns a non-NULL value. This value is returned as the result of
6662scm_c_hook_run. If all functions return NULL, NULL is returned.
6663
6664If TYPE is SCM_C_HOOK_AND, hook functions are run until a function
6665returns a NULL value, and NULL is returned. If all functions returns
6666a non-NULL value, the last value is returned.
6667
6668** New C level GC hooks
6669
6670Five new C level hooks has been added to the garbage collector.
6671
6672 scm_before_gc_c_hook
6673 scm_after_gc_c_hook
6674
6675are run before locking and after unlocking the heap. The system is
6676thus in a mode where evaluation can take place. (Except that
6677scm_before_gc_c_hook must not allocate new cells.)
6678
6679 scm_before_mark_c_hook
6680 scm_before_sweep_c_hook
6681 scm_after_sweep_c_hook
6682
6683are run when the heap is locked. These are intended for extension of
6684the GC in a modular fashion. Examples are the weaks and guardians
6685modules.
6686
b5074b23
MD
6687** Way for application to customize GC parameters
6688
6689The application can set up other default values for the GC heap
6690allocation parameters
6691
6692 GUILE_INIT_HEAP_SIZE_1, GUILE_MIN_YIELD_1,
6693 GUILE_INIT_HEAP_SIZE_2, GUILE_MIN_YIELD_2,
6694 GUILE_MAX_SEGMENT_SIZE,
6695
6696by setting
6697
6698 scm_default_init_heap_size_1, scm_default_min_yield_1,
6699 scm_default_init_heap_size_2, scm_default_min_yield_2,
6700 scm_default_max_segment_size
6701
6702respectively before callong scm_boot_guile.
6703
6704(See entry "New environment variables ..." in section
6705"Changes to the stand-alone interpreter" above.)
6706
9704841c
MD
6707** scm_protect_object/scm_unprotect_object now nest
6708
67ef2dca
MD
6709This means that you can call scm_protect_object multiple times on an
6710object and count on the object being protected until
6711scm_unprotect_object has been call the same number of times.
6712
6713The functions also have better time complexity.
6714
6715Still, it is usually possible to structure the application in a way
6716that you don't need to use these functions. For example, if you use a
6717protected standard Guile list to keep track of live objects rather
6718than some custom data type, objects will die a natural death when they
6719are no longer needed.
6720
0a9e521f
MD
6721** Deprecated type tags: scm_tc16_flo, scm_tc_flo, scm_tc_dblr, scm_tc_dblc
6722
6723Guile does not provide the float representation for inexact real numbers any
6724more. Now, only doubles are used to represent inexact real numbers. Further,
6725the tag names scm_tc_dblr and scm_tc_dblc have been changed to scm_tc16_real
6726and scm_tc16_complex, respectively.
6727
341f78c9
MD
6728** Removed deprecated type scm_smobfuns
6729
6730** Removed deprecated function scm_newsmob
6731
b5074b23
MD
6732** Warning: scm_make_smob_type_mfpe might become deprecated in a future release
6733
6734There is an ongoing discussion among the developers whether to
6735deprecate `scm_make_smob_type_mfpe' or not. Please use the current
6736standard interface (scm_make_smob_type, scm_set_smob_XXX) in new code
6737until this issue has been settled.
6738
341f78c9
MD
6739** Removed deprecated type tag scm_tc16_kw
6740
2728d7f4
MD
6741** Added type tag scm_tc16_keyword
6742
6743(This was introduced already in release 1.3.4 but was not documented
6744 until now.)
6745
67ef2dca
MD
6746** gdb_print now prints "*** Guile not initialized ***" until Guile initialized
6747
f25f761d
GH
6748* Changes to system call interfaces:
6749
28d77376
GH
6750** The "select" procedure now tests port buffers for the ability to
6751provide input or accept output. Previously only the underlying file
6752descriptors were checked.
6753
bd9e24b3
GH
6754** New variable PIPE_BUF: the maximum number of bytes that can be
6755atomically written to a pipe.
6756
f25f761d
GH
6757** If a facility is not available on the system when Guile is
6758compiled, the corresponding primitive procedure will not be defined.
6759Previously it would have been defined but would throw a system-error
6760exception if called. Exception handlers which catch this case may
6761need minor modification: an error will be thrown with key
6762'unbound-variable instead of 'system-error. Alternatively it's
6763now possible to use `defined?' to check whether the facility is
6764available.
6765
38c1d3c4 6766** Procedures which depend on the timezone should now give the correct
6c0201ad 6767result on systems which cache the TZ environment variable, even if TZ
38c1d3c4
GH
6768is changed without calling tzset.
6769
5c11cc9d
GH
6770* Changes to the networking interfaces:
6771
6772** New functions: htons, ntohs, htonl, ntohl: for converting short and
6773long integers between network and host format. For now, it's not
6774particularly convenient to do this kind of thing, but consider:
6775
6776(define write-network-long
6777 (lambda (value port)
6778 (let ((v (make-uniform-vector 1 1 0)))
6779 (uniform-vector-set! v 0 (htonl value))
6780 (uniform-vector-write v port))))
6781
6782(define read-network-long
6783 (lambda (port)
6784 (let ((v (make-uniform-vector 1 1 0)))
6785 (uniform-vector-read! v port)
6786 (ntohl (uniform-vector-ref v 0)))))
6787
6788** If inet-aton fails, it now throws an error with key 'misc-error
6789instead of 'system-error, since errno is not relevant.
6790
6791** Certain gethostbyname/gethostbyaddr failures now throw errors with
6792specific keys instead of 'system-error. The latter is inappropriate
6793since errno will not have been set. The keys are:
afe5177e 6794'host-not-found, 'try-again, 'no-recovery and 'no-data.
5c11cc9d
GH
6795
6796** sethostent, setnetent, setprotoent, setservent: now take an
6797optional argument STAYOPEN, which specifies whether the database
6798remains open after a database entry is accessed randomly (e.g., using
6799gethostbyname for the hosts database.) The default is #f. Previously
6800#t was always used.
6801
cc36e791 6802\f
43fa9a05
JB
6803Changes since Guile 1.3.2:
6804
0fdcbcaa
MD
6805* Changes to the stand-alone interpreter
6806
6807** Debugger
6808
6809An initial version of the Guile debugger written by Chris Hanson has
6810been added. The debugger is still under development but is included
6811in the distribution anyway since it is already quite useful.
6812
6813Type
6814
6815 (debug)
6816
6817after an error to enter the debugger. Type `help' inside the debugger
6818for a description of available commands.
6819
6820If you prefer to have stack frames numbered and printed in
6821anti-chronological order and prefer up in the stack to be down on the
6822screen as is the case in gdb, you can put
6823
6824 (debug-enable 'backwards)
6825
6826in your .guile startup file. (However, this means that Guile can't
6827use indentation to indicate stack level.)
6828
6829The debugger is autoloaded into Guile at the first use.
6830
6831** Further enhancements to backtraces
6832
6833There is a new debug option `width' which controls the maximum width
6834on the screen of printed stack frames. Fancy printing parameters
6835("level" and "length" as in Common LISP) are adaptively adjusted for
6836each stack frame to give maximum information while still fitting
6837within the bounds. If the stack frame can't be made to fit by
6838adjusting parameters, it is simply cut off at the end. This is marked
6839with a `$'.
6840
6841** Some modules are now only loaded when the repl is started
6842
6843The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
6844regex) are now loaded into (guile-user) only if the repl has been
6845started. The effect is that the startup time for scripts has been
6846reduced to 30% of what it was previously.
6847
6848Correctly written scripts load the modules they require at the top of
6849the file and should not be affected by this change.
6850
ece41168
MD
6851** Hooks are now represented as smobs
6852
6822fe53
MD
6853* Changes to Scheme functions and syntax
6854
0ce204b0
MV
6855** Readline support has changed again.
6856
6857The old (readline-activator) module is gone. Use (ice-9 readline)
6858instead, which now contains all readline functionality. So the code
6859to activate readline is now
6860
6861 (use-modules (ice-9 readline))
6862 (activate-readline)
6863
6864This should work at any time, including from the guile prompt.
6865
5d195868
JB
6866To avoid confusion about the terms of Guile's license, please only
6867enable readline for your personal use; please don't make it the
6868default for others. Here is why we make this rather odd-sounding
6869request:
6870
6871Guile is normally licensed under a weakened form of the GNU General
6872Public License, which allows you to link code with Guile without
6873placing that code under the GPL. This exception is important to some
6874people.
6875
6876However, since readline is distributed under the GNU General Public
6877License, when you link Guile with readline, either statically or
6878dynamically, you effectively change Guile's license to the strict GPL.
6879Whenever you link any strictly GPL'd code into Guile, uses of Guile
6880which are normally permitted become forbidden. This is a rather
6881non-obvious consequence of the licensing terms.
6882
6883So, to make sure things remain clear, please let people choose for
6884themselves whether to link GPL'd libraries like readline with Guile.
6885
25b0654e
JB
6886** regexp-substitute/global has changed slightly, but incompatibly.
6887
6888If you include a function in the item list, the string of the match
6889object it receives is the same string passed to
6890regexp-substitute/global, not some suffix of that string.
6891Correspondingly, the match's positions are relative to the entire
6892string, not the suffix.
6893
6894If the regexp can match the empty string, the way matches are chosen
6895from the string has changed. regexp-substitute/global recognizes the
6896same set of matches that list-matches does; see below.
6897
6898** New function: list-matches REGEXP STRING [FLAGS]
6899
6900Return a list of match objects, one for every non-overlapping, maximal
6901match of REGEXP in STRING. The matches appear in left-to-right order.
6902list-matches only reports matches of the empty string if there are no
6903other matches which begin on, end at, or include the empty match's
6904position.
6905
6906If present, FLAGS is passed as the FLAGS argument to regexp-exec.
6907
6908** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
6909
6910For each match of REGEXP in STRING, apply PROC to the match object,
6911and the last value PROC returned, or INIT for the first call. Return
6912the last value returned by PROC. We apply PROC to the matches as they
6913appear from left to right.
6914
6915This function recognizes matches according to the same criteria as
6916list-matches.
6917
6918Thus, you could define list-matches like this:
6919
6920 (define (list-matches regexp string . flags)
6921 (reverse! (apply fold-matches regexp string '() cons flags)))
6922
6923If present, FLAGS is passed as the FLAGS argument to regexp-exec.
6924
bc848f7f
MD
6925** Hooks
6926
6927*** New function: hook? OBJ
6928
6929Return #t if OBJ is a hook, otherwise #f.
6930
ece41168
MD
6931*** New function: make-hook-with-name NAME [ARITY]
6932
6933Return a hook with name NAME and arity ARITY. The default value for
6934ARITY is 0. The only effect of NAME is that it will appear when the
6935hook object is printed to ease debugging.
6936
bc848f7f
MD
6937*** New function: hook-empty? HOOK
6938
6939Return #t if HOOK doesn't contain any procedures, otherwise #f.
6940
6941*** New function: hook->list HOOK
6942
6943Return a list of the procedures that are called when run-hook is
6944applied to HOOK.
6945
b074884f
JB
6946** `map' signals an error if its argument lists are not all the same length.
6947
6948This is the behavior required by R5RS, so this change is really a bug
6949fix. But it seems to affect a lot of people's code, so we're
6950mentioning it here anyway.
6951
6822fe53
MD
6952** Print-state handling has been made more transparent
6953
6954Under certain circumstances, ports are represented as a port with an
6955associated print state. Earlier, this pair was represented as a pair
6956(see "Some magic has been added to the printer" below). It is now
6957indistinguishable (almost; see `get-print-state') from a port on the
6958user level.
6959
6960*** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
6961
6962Return a new port with the associated print state PRINT-STATE.
6963
6964*** New function: get-print-state OUTPUT-PORT
6965
6966Return the print state associated with this port if it exists,
6967otherwise return #f.
6968
340a8770 6969*** New function: directory-stream? OBJECT
77242ff9 6970
340a8770 6971Returns true iff OBJECT is a directory stream --- the sort of object
77242ff9
GH
6972returned by `opendir'.
6973
0fdcbcaa
MD
6974** New function: using-readline?
6975
6976Return #t if readline is in use in the current repl.
6977
26405bc1
MD
6978** structs will be removed in 1.4
6979
6980Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
6981and use GOOPS objects as the fundamental record type.
6982
49199eaa
MD
6983* Changes to the scm_ interface
6984
26405bc1
MD
6985** structs will be removed in 1.4
6986
6987The entire current struct interface (struct.c, struct.h) will be
6988replaced in Guile 1.4. We will merge GOOPS into libguile and use
6989GOOPS objects as the fundamental record type.
6990
49199eaa
MD
6991** The internal representation of subr's has changed
6992
6993Instead of giving a hint to the subr name, the CAR field of the subr
6994now contains an index to a subr entry in scm_subr_table.
6995
6996*** New variable: scm_subr_table
6997
6998An array of subr entries. A subr entry contains the name, properties
6999and documentation associated with the subr. The properties and
7000documentation slots are not yet used.
7001
7002** A new scheme for "forwarding" calls to a builtin to a generic function
7003
7004It is now possible to extend the functionality of some Guile
7005primitives by letting them defer a call to a GOOPS generic function on
240ed66f 7006argument mismatch. This means that there is no loss of efficiency in
daf516d6 7007normal evaluation.
49199eaa
MD
7008
7009Example:
7010
daf516d6 7011 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
49199eaa
MD
7012 (define-method + ((x <string>) (y <string>))
7013 (string-append x y))
7014
86a4d62e
MD
7015+ will still be as efficient as usual in numerical calculations, but
7016can also be used for concatenating strings.
49199eaa 7017
86a4d62e 7018Who will be the first one to extend Guile's numerical tower to
daf516d6
MD
7019rationals? :) [OK, there a few other things to fix before this can
7020be made in a clean way.]
49199eaa
MD
7021
7022*** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
7023
7024 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
7025
7026 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
7027
d02cafe7 7028These do the same job as SCM_PROC and SCM_PROC1, but they also define
49199eaa
MD
7029a variable GENERIC which can be used by the dispatch macros below.
7030
7031[This is experimental code which may change soon.]
7032
7033*** New macros for forwarding control to a generic on arg type error
7034
7035 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
7036
7037 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
7038
7039These correspond to the scm_wta function call, and have the same
7040behaviour until the user has called the GOOPS primitive
7041`enable-primitive-generic!'. After that, these macros will apply the
7042generic function GENERIC to the argument(s) instead of calling
7043scm_wta.
7044
7045[This is experimental code which may change soon.]
7046
7047*** New macros for argument testing with generic dispatch
7048
7049 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
7050
7051 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
7052
7053These correspond to the SCM_ASSERT macro, but will defer control to
7054GENERIC on error after `enable-primitive-generic!' has been called.
7055
7056[This is experimental code which may change soon.]
7057
7058** New function: SCM scm_eval_body (SCM body, SCM env)
7059
7060Evaluates the body of a special form.
7061
7062** The internal representation of struct's has changed
7063
7064Previously, four slots were allocated for the procedure(s) of entities
7065and operators. The motivation for this representation had to do with
7066the structure of the evaluator, the wish to support tail-recursive
7067generic functions, and efficiency. Since the generic function
7068dispatch mechanism has changed, there is no longer a need for such an
7069expensive representation, and the representation has been simplified.
7070
7071This should not make any difference for most users.
7072
7073** GOOPS support has been cleaned up.
7074
7075Some code has been moved from eval.c to objects.c and code in both of
7076these compilation units has been cleaned up and better structured.
7077
7078*** New functions for applying generic functions
7079
7080 New function: SCM scm_apply_generic (GENERIC, ARGS)
7081 New function: SCM scm_call_generic_0 (GENERIC)
7082 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
7083 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
7084 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
7085
ece41168
MD
7086** Deprecated function: scm_make_named_hook
7087
7088It is now replaced by:
7089
7090** New function: SCM scm_create_hook (const char *name, int arity)
7091
7092Creates a hook in the same way as make-hook above but also
7093binds a variable named NAME to it.
7094
7095This is the typical way of creating a hook from C code.
7096
7097Currently, the variable is created in the "current" module.
7098This might change when we get the new module system.
7099
7100[The behaviour is identical to scm_make_named_hook.]
7101
7102
43fa9a05 7103\f
f3227c7a
JB
7104Changes since Guile 1.3:
7105
6ca345f3
JB
7106* Changes to mailing lists
7107
7108** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
7109
7110See the README file to find current addresses for all the Guile
7111mailing lists.
7112
d77fb593
JB
7113* Changes to the distribution
7114
1d335863
JB
7115** Readline support is no longer included with Guile by default.
7116
7117Based on the different license terms of Guile and Readline, we
7118concluded that Guile should not *by default* cause the linking of
7119Readline into an application program. Readline support is now offered
7120as a separate module, which is linked into an application only when
7121you explicitly specify it.
7122
7123Although Guile is GNU software, its distribution terms add a special
7124exception to the usual GNU General Public License (GPL). Guile's
7125license includes a clause that allows you to link Guile with non-free
7126programs. We add this exception so as not to put Guile at a
7127disadvantage vis-a-vis other extensibility packages that support other
7128languages.
7129
7130In contrast, the GNU Readline library is distributed under the GNU
7131General Public License pure and simple. This means that you may not
7132link Readline, even dynamically, into an application unless it is
7133distributed under a free software license that is compatible the GPL.
7134
7135Because of this difference in distribution terms, an application that
7136can use Guile may not be able to use Readline. Now users will be
7137explicitly offered two independent decisions about the use of these
7138two packages.
d77fb593 7139
0e8a8468
MV
7140You can activate the readline support by issuing
7141
7142 (use-modules (readline-activator))
7143 (activate-readline)
7144
7145from your ".guile" file, for example.
7146
e4eae9b1
MD
7147* Changes to the stand-alone interpreter
7148
67ad463a
MD
7149** All builtins now print as primitives.
7150Previously builtin procedures not belonging to the fundamental subr
7151types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
7152Now, they print as #<primitive-procedure NAME>.
7153
7154** Backtraces slightly more intelligible.
7155gsubr-apply and macro transformer application frames no longer appear
7156in backtraces.
7157
69c6acbb
JB
7158* Changes to Scheme functions and syntax
7159
2a52b429
MD
7160** Guile now correctly handles internal defines by rewriting them into
7161their equivalent letrec. Previously, internal defines would
7162incrementally add to the innermost environment, without checking
7163whether the restrictions specified in RnRS were met. This lead to the
7164correct behaviour when these restriction actually were met, but didn't
7165catch all illegal uses. Such an illegal use could lead to crashes of
b3da54d1 7166the Guile interpreter or other unwanted results. An example of
2a52b429
MD
7167incorrect internal defines that made Guile behave erratically:
7168
7169 (let ()
7170 (define a 1)
7171 (define (b) a)
7172 (define c (1+ (b)))
7173 (define d 3)
7174
7175 (b))
7176
7177 => 2
7178
7179The problem with this example is that the definition of `c' uses the
7180value of `b' directly. This confuses the meoization machine of Guile
7181so that the second call of `b' (this time in a larger environment that
7182also contains bindings for `c' and `d') refers to the binding of `c'
7183instead of `a'. You could also make Guile crash with a variation on
7184this theme:
7185
7186 (define (foo flag)
7187 (define a 1)
7188 (define (b flag) (if flag a 1))
7189 (define c (1+ (b flag)))
7190 (define d 3)
7191
7192 (b #t))
7193
7194 (foo #f)
7195 (foo #t)
7196
7197From now on, Guile will issue an `Unbound variable: b' error message
7198for both examples.
7199
36d3d540
MD
7200** Hooks
7201
7202A hook contains a list of functions which should be called on
7203particular occasions in an existing program. Hooks are used for
7204customization.
7205
7206A window manager might have a hook before-window-map-hook. The window
7207manager uses the function run-hooks to call all functions stored in
7208before-window-map-hook each time a window is mapped. The user can
7209store functions in the hook using add-hook!.
7210
7211In Guile, hooks are first class objects.
7212
7213*** New function: make-hook [N_ARGS]
7214
7215Return a hook for hook functions which can take N_ARGS arguments.
7216The default value for N_ARGS is 0.
7217
ad91d6c3
MD
7218(See also scm_make_named_hook below.)
7219
36d3d540
MD
7220*** New function: add-hook! HOOK PROC [APPEND_P]
7221
7222Put PROC at the beginning of the list of functions stored in HOOK.
7223If APPEND_P is supplied, and non-false, put PROC at the end instead.
7224
7225PROC must be able to take the number of arguments specified when the
7226hook was created.
7227
7228If PROC already exists in HOOK, then remove it first.
7229
7230*** New function: remove-hook! HOOK PROC
7231
7232Remove PROC from the list of functions in HOOK.
7233
7234*** New function: reset-hook! HOOK
7235
7236Clear the list of hook functions stored in HOOK.
7237
7238*** New function: run-hook HOOK ARG1 ...
7239
7240Run all hook functions stored in HOOK with arguments ARG1 ... .
7241The number of arguments supplied must correspond to the number given
7242when the hook was created.
7243
56a19408
MV
7244** The function `dynamic-link' now takes optional keyword arguments.
7245 The only keyword argument that is currently defined is `:global
7246 BOOL'. With it, you can control whether the shared library will be
7247 linked in global mode or not. In global mode, the symbols from the
7248 linked library can be used to resolve references from other
7249 dynamically linked libraries. In non-global mode, the linked
7250 library is essentially invisible and can only be accessed via
7251 `dynamic-func', etc. The default is now to link in global mode.
7252 Previously, the default has been non-global mode.
7253
7254 The `#:global' keyword is only effective on platforms that support
7255 the dlopen family of functions.
7256
ad226f25 7257** New function `provided?'
b7e13f65
JB
7258
7259 - Function: provided? FEATURE
7260 Return true iff FEATURE is supported by this installation of
7261 Guile. FEATURE must be a symbol naming a feature; the global
7262 variable `*features*' is a list of available features.
7263
ad226f25
JB
7264** Changes to the module (ice-9 expect):
7265
7266*** The expect-strings macro now matches `$' in a regular expression
7267 only at a line-break or end-of-file by default. Previously it would
ab711359
JB
7268 match the end of the string accumulated so far. The old behaviour
7269 can be obtained by setting the variable `expect-strings-exec-flags'
7270 to 0.
ad226f25
JB
7271
7272*** The expect-strings macro now uses a variable `expect-strings-exec-flags'
7273 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
7274 in a regular expression will still match before a line-break or
7275 end-of-file. The default is `regexp/noteol'.
7276
6c0201ad 7277*** The expect-strings macro now uses a variable
ad226f25
JB
7278 `expect-strings-compile-flags' for the flags to be supplied to
7279 `make-regexp'. The default is `regexp/newline', which was previously
7280 hard-coded.
7281
7282*** The expect macro now supplies two arguments to a match procedure:
ab711359
JB
7283 the current accumulated string and a flag to indicate whether
7284 end-of-file has been reached. Previously only the string was supplied.
7285 If end-of-file is reached, the match procedure will be called an
7286 additional time with the same accumulated string as the previous call
7287 but with the flag set.
ad226f25 7288
b7e13f65
JB
7289** New module (ice-9 format), implementing the Common Lisp `format' function.
7290
7291This code, and the documentation for it that appears here, was
7292borrowed from SLIB, with minor adaptations for Guile.
7293
7294 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
7295 An almost complete implementation of Common LISP format description
7296 according to the CL reference book `Common LISP' from Guy L.
7297 Steele, Digital Press. Backward compatible to most of the
7298 available Scheme format implementations.
7299
7300 Returns `#t', `#f' or a string; has side effect of printing
7301 according to FORMAT-STRING. If DESTINATION is `#t', the output is
7302 to the current output port and `#t' is returned. If DESTINATION
7303 is `#f', a formatted string is returned as the result of the call.
7304 NEW: If DESTINATION is a string, DESTINATION is regarded as the
7305 format string; FORMAT-STRING is then the first argument and the
7306 output is returned as a string. If DESTINATION is a number, the
7307 output is to the current error port if available by the
7308 implementation. Otherwise DESTINATION must be an output port and
7309 `#t' is returned.
7310
7311 FORMAT-STRING must be a string. In case of a formatting error
7312 format returns `#f' and prints a message on the current output or
7313 error port. Characters are output as if the string were output by
7314 the `display' function with the exception of those prefixed by a
7315 tilde (~). For a detailed description of the FORMAT-STRING syntax
7316 please consult a Common LISP format reference manual. For a test
7317 suite to verify this format implementation load `formatst.scm'.
7318 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
7319
7320 Note: `format' is not reentrant, i.e. only one `format'-call may
7321 be executed at a time.
7322
7323
7324*** Format Specification (Format version 3.0)
7325
7326 Please consult a Common LISP format reference manual for a detailed
7327description of the format string syntax. For a demonstration of the
7328implemented directives see `formatst.scm'.
7329
7330 This implementation supports directive parameters and modifiers (`:'
7331and `@' characters). Multiple parameters must be separated by a comma
7332(`,'). Parameters can be numerical parameters (positive or negative),
7333character parameters (prefixed by a quote character (`''), variable
7334parameters (`v'), number of rest arguments parameter (`#'), empty and
7335default parameters. Directive characters are case independent. The
7336general form of a directive is:
7337
7338DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
7339
7340DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
7341
7342*** Implemented CL Format Control Directives
7343
7344 Documentation syntax: Uppercase characters represent the
7345corresponding control directive characters. Lowercase characters
7346represent control directive parameter descriptions.
7347
7348`~A'
7349 Any (print as `display' does).
7350 `~@A'
7351 left pad.
7352
7353 `~MINCOL,COLINC,MINPAD,PADCHARA'
7354 full padding.
7355
7356`~S'
7357 S-expression (print as `write' does).
7358 `~@S'
7359 left pad.
7360
7361 `~MINCOL,COLINC,MINPAD,PADCHARS'
7362 full padding.
7363
7364`~D'
7365 Decimal.
7366 `~@D'
7367 print number sign always.
7368
7369 `~:D'
7370 print comma separated.
7371
7372 `~MINCOL,PADCHAR,COMMACHARD'
7373 padding.
7374
7375`~X'
7376 Hexadecimal.
7377 `~@X'
7378 print number sign always.
7379
7380 `~:X'
7381 print comma separated.
7382
7383 `~MINCOL,PADCHAR,COMMACHARX'
7384 padding.
7385
7386`~O'
7387 Octal.
7388 `~@O'
7389 print number sign always.
7390
7391 `~:O'
7392 print comma separated.
7393
7394 `~MINCOL,PADCHAR,COMMACHARO'
7395 padding.
7396
7397`~B'
7398 Binary.
7399 `~@B'
7400 print number sign always.
7401
7402 `~:B'
7403 print comma separated.
7404
7405 `~MINCOL,PADCHAR,COMMACHARB'
7406 padding.
7407
7408`~NR'
7409 Radix N.
7410 `~N,MINCOL,PADCHAR,COMMACHARR'
7411 padding.
7412
7413`~@R'
7414 print a number as a Roman numeral.
7415
7416`~:@R'
7417 print a number as an "old fashioned" Roman numeral.
7418
7419`~:R'
7420 print a number as an ordinal English number.
7421
7422`~:@R'
7423 print a number as a cardinal English number.
7424
7425`~P'
7426 Plural.
7427 `~@P'
7428 prints `y' and `ies'.
7429
7430 `~:P'
7431 as `~P but jumps 1 argument backward.'
7432
7433 `~:@P'
7434 as `~@P but jumps 1 argument backward.'
7435
7436`~C'
7437 Character.
7438 `~@C'
7439 prints a character as the reader can understand it (i.e. `#\'
7440 prefixing).
7441
7442 `~:C'
7443 prints a character as emacs does (eg. `^C' for ASCII 03).
7444
7445`~F'
7446 Fixed-format floating-point (prints a flonum like MMM.NNN).
7447 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
7448 `~@F'
7449 If the number is positive a plus sign is printed.
7450
7451`~E'
7452 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
7453 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
7454 `~@E'
7455 If the number is positive a plus sign is printed.
7456
7457`~G'
7458 General floating-point (prints a flonum either fixed or
7459 exponential).
7460 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
7461 `~@G'
7462 If the number is positive a plus sign is printed.
7463
7464`~$'
7465 Dollars floating-point (prints a flonum in fixed with signs
7466 separated).
7467 `~DIGITS,SCALE,WIDTH,PADCHAR$'
7468 `~@$'
7469 If the number is positive a plus sign is printed.
7470
7471 `~:@$'
7472 A sign is always printed and appears before the padding.
7473
7474 `~:$'
7475 The sign appears before the padding.
7476
7477`~%'
7478 Newline.
7479 `~N%'
7480 print N newlines.
7481
7482`~&'
7483 print newline if not at the beginning of the output line.
7484 `~N&'
7485 prints `~&' and then N-1 newlines.
7486
7487`~|'
7488 Page Separator.
7489 `~N|'
7490 print N page separators.
7491
7492`~~'
7493 Tilde.
7494 `~N~'
7495 print N tildes.
7496
7497`~'<newline>
7498 Continuation Line.
7499 `~:'<newline>
7500 newline is ignored, white space left.
7501
7502 `~@'<newline>
7503 newline is left, white space ignored.
7504
7505`~T'
7506 Tabulation.
7507 `~@T'
7508 relative tabulation.
7509
7510 `~COLNUM,COLINCT'
7511 full tabulation.
7512
7513`~?'
7514 Indirection (expects indirect arguments as a list).
7515 `~@?'
7516 extracts indirect arguments from format arguments.
7517
7518`~(STR~)'
7519 Case conversion (converts by `string-downcase').
7520 `~:(STR~)'
7521 converts by `string-capitalize'.
7522
7523 `~@(STR~)'
7524 converts by `string-capitalize-first'.
7525
7526 `~:@(STR~)'
7527 converts by `string-upcase'.
7528
7529`~*'
7530 Argument Jumping (jumps 1 argument forward).
7531 `~N*'
7532 jumps N arguments forward.
7533
7534 `~:*'
7535 jumps 1 argument backward.
7536
7537 `~N:*'
7538 jumps N arguments backward.
7539
7540 `~@*'
7541 jumps to the 0th argument.
7542
7543 `~N@*'
7544 jumps to the Nth argument (beginning from 0)
7545
7546`~[STR0~;STR1~;...~;STRN~]'
7547 Conditional Expression (numerical clause conditional).
7548 `~N['
7549 take argument from N.
7550
7551 `~@['
7552 true test conditional.
7553
7554 `~:['
7555 if-else-then conditional.
7556
7557 `~;'
7558 clause separator.
7559
7560 `~:;'
7561 default clause follows.
7562
7563`~{STR~}'
7564 Iteration (args come from the next argument (a list)).
7565 `~N{'
7566 at most N iterations.
7567
7568 `~:{'
7569 args from next arg (a list of lists).
7570
7571 `~@{'
7572 args from the rest of arguments.
7573
7574 `~:@{'
7575 args from the rest args (lists).
7576
7577`~^'
7578 Up and out.
7579 `~N^'
7580 aborts if N = 0
7581
7582 `~N,M^'
7583 aborts if N = M
7584
7585 `~N,M,K^'
7586 aborts if N <= M <= K
7587
7588*** Not Implemented CL Format Control Directives
7589
7590`~:A'
7591 print `#f' as an empty list (see below).
7592
7593`~:S'
7594 print `#f' as an empty list (see below).
7595
7596`~<~>'
7597 Justification.
7598
7599`~:^'
7600 (sorry I don't understand its semantics completely)
7601
7602*** Extended, Replaced and Additional Control Directives
7603
7604`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
7605`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
7606`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
7607`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
7608`~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
7609 COMMAWIDTH is the number of characters between two comma
7610 characters.
7611
7612`~I'
7613 print a R4RS complex number as `~F~@Fi' with passed parameters for
7614 `~F'.
7615
7616`~Y'
7617 Pretty print formatting of an argument for scheme code lists.
7618
7619`~K'
7620 Same as `~?.'
7621
7622`~!'
7623 Flushes the output if format DESTINATION is a port.
7624
7625`~_'
7626 Print a `#\space' character
7627 `~N_'
7628 print N `#\space' characters.
7629
7630`~/'
7631 Print a `#\tab' character
7632 `~N/'
7633 print N `#\tab' characters.
7634
7635`~NC'
7636 Takes N as an integer representation for a character. No arguments
7637 are consumed. N is converted to a character by `integer->char'. N
7638 must be a positive decimal number.
7639
7640`~:S'
7641 Print out readproof. Prints out internal objects represented as
7642 `#<...>' as strings `"#<...>"' so that the format output can always
7643 be processed by `read'.
7644
7645`~:A'
7646 Print out readproof. Prints out internal objects represented as
7647 `#<...>' as strings `"#<...>"' so that the format output can always
7648 be processed by `read'.
7649
7650`~Q'
7651 Prints information and a copyright notice on the format
7652 implementation.
7653 `~:Q'
7654 prints format version.
7655
7656`~F, ~E, ~G, ~$'
7657 may also print number strings, i.e. passing a number as a string
7658 and format it accordingly.
7659
7660*** Configuration Variables
7661
7662 The format module exports some configuration variables to suit the
7663systems and users needs. There should be no modification necessary for
7664the configuration that comes with Guile. Format detects automatically
7665if the running scheme system implements floating point numbers and
7666complex numbers.
7667
7668format:symbol-case-conv
7669 Symbols are converted by `symbol->string' so the case type of the
7670 printed symbols is implementation dependent.
7671 `format:symbol-case-conv' is a one arg closure which is either
7672 `#f' (no conversion), `string-upcase', `string-downcase' or
7673 `string-capitalize'. (default `#f')
7674
7675format:iobj-case-conv
7676 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
7677 implementation internal objects. (default `#f')
7678
7679format:expch
7680 The character prefixing the exponent value in `~E' printing.
7681 (default `#\E')
7682
7683*** Compatibility With Other Format Implementations
7684
7685SLIB format 2.x:
7686 See `format.doc'.
7687
7688SLIB format 1.4:
7689 Downward compatible except for padding support and `~A', `~S',
7690 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
7691 `printf' padding support which is completely replaced by the CL
7692 `format' padding style.
7693
7694MIT C-Scheme 7.1:
7695 Downward compatible except for `~', which is not documented
7696 (ignores all characters inside the format string up to a newline
7697 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
7698 numerical and variable parameters and `:/@' modifiers in the CL
7699 sense).
7700
7701Elk 1.5/2.0:
7702 Downward compatible except for `~A' and `~S' which print in
7703 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
7704 directive parameters or modifiers)).
7705
7706Scheme->C 01nov91:
7707 Downward compatible except for an optional destination parameter:
7708 S2C accepts a format call without a destination which returns a
7709 formatted string. This is equivalent to a #f destination in S2C.
7710 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
7711 parameters or modifiers)).
7712
7713
e7d37b0a 7714** Changes to string-handling functions.
b7e13f65 7715
e7d37b0a 7716These functions were added to support the (ice-9 format) module, above.
b7e13f65 7717
e7d37b0a
JB
7718*** New function: string-upcase STRING
7719*** New function: string-downcase STRING
b7e13f65 7720
e7d37b0a
JB
7721These are non-destructive versions of the existing string-upcase! and
7722string-downcase! functions.
b7e13f65 7723
e7d37b0a
JB
7724*** New function: string-capitalize! STRING
7725*** New function: string-capitalize STRING
7726
7727These functions convert the first letter of each word in the string to
7728upper case. Thus:
7729
7730 (string-capitalize "howdy there")
7731 => "Howdy There"
7732
7733As with the other functions, string-capitalize! modifies the string in
7734place, while string-capitalize returns a modified copy of its argument.
7735
7736*** New function: string-ci->symbol STRING
7737
7738Return a symbol whose name is STRING, but having the same case as if
7739the symbol had be read by `read'.
7740
7741Guile can be configured to be sensitive or insensitive to case
7742differences in Scheme identifiers. If Guile is case-insensitive, all
7743symbols are converted to lower case on input. The `string-ci->symbol'
7744function returns a symbol whose name in STRING, transformed as Guile
7745would if STRING were input.
7746
7747*** New function: substring-move! STRING1 START END STRING2 START
7748
7749Copy the substring of STRING1 from START (inclusive) to END
7750(exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
7751string, and the source and destination areas may overlap; in all
7752cases, the function behaves as if all the characters were copied
7753simultanously.
7754
6c0201ad 7755*** Extended functions: substring-move-left! substring-move-right!
e7d37b0a
JB
7756
7757These functions now correctly copy arbitrarily overlapping substrings;
7758they are both synonyms for substring-move!.
b7e13f65 7759
b7e13f65 7760
deaceb4e
JB
7761** New module (ice-9 getopt-long), with the function `getopt-long'.
7762
7763getopt-long is a function for parsing command-line arguments in a
7764manner consistent with other GNU programs.
7765
7766(getopt-long ARGS GRAMMAR)
7767Parse the arguments ARGS according to the argument list grammar GRAMMAR.
7768
7769ARGS should be a list of strings. Its first element should be the
7770name of the program; subsequent elements should be the arguments
7771that were passed to the program on the command line. The
7772`program-arguments' procedure returns a list of this form.
7773
7774GRAMMAR is a list of the form:
7775((OPTION (PROPERTY VALUE) ...) ...)
7776
7777Each OPTION should be a symbol. `getopt-long' will accept a
7778command-line option named `--OPTION'.
7779Each option can have the following (PROPERTY VALUE) pairs:
7780
7781 (single-char CHAR) --- Accept `-CHAR' as a single-character
7782 equivalent to `--OPTION'. This is how to specify traditional
7783 Unix-style flags.
7784 (required? BOOL) --- If BOOL is true, the option is required.
7785 getopt-long will raise an error if it is not found in ARGS.
7786 (value BOOL) --- If BOOL is #t, the option accepts a value; if
7787 it is #f, it does not; and if it is the symbol
7788 `optional', the option may appear in ARGS with or
6c0201ad 7789 without a value.
deaceb4e
JB
7790 (predicate FUNC) --- If the option accepts a value (i.e. you
7791 specified `(value #t)' for this option), then getopt
7792 will apply FUNC to the value, and throw an exception
7793 if it returns #f. FUNC should be a procedure which
7794 accepts a string and returns a boolean value; you may
7795 need to use quasiquotes to get it into GRAMMAR.
7796
7797The (PROPERTY VALUE) pairs may occur in any order, but each
7798property may occur only once. By default, options do not have
7799single-character equivalents, are not required, and do not take
7800values.
7801
7802In ARGS, single-character options may be combined, in the usual
7803Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
7804accepts values, then it must be the last option in the
7805combination; the value is the next argument. So, for example, using
7806the following grammar:
7807 ((apples (single-char #\a))
7808 (blimps (single-char #\b) (value #t))
7809 (catalexis (single-char #\c) (value #t)))
7810the following argument lists would be acceptable:
7811 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
7812 for "blimps" and "catalexis")
7813 ("-ab" "bang" "-c" "couth") (same)
7814 ("-ac" "couth" "-b" "bang") (same)
7815 ("-abc" "couth" "bang") (an error, since `-b' is not the
7816 last option in its combination)
7817
7818If an option's value is optional, then `getopt-long' decides
7819whether it has a value by looking at what follows it in ARGS. If
7820the next element is a string, and it does not appear to be an
7821option itself, then that string is the option's value.
7822
7823The value of a long option can appear as the next element in ARGS,
7824or it can follow the option name, separated by an `=' character.
7825Thus, using the same grammar as above, the following argument lists
7826are equivalent:
7827 ("--apples" "Braeburn" "--blimps" "Goodyear")
7828 ("--apples=Braeburn" "--blimps" "Goodyear")
7829 ("--blimps" "Goodyear" "--apples=Braeburn")
7830
7831If the option "--" appears in ARGS, argument parsing stops there;
7832subsequent arguments are returned as ordinary arguments, even if
7833they resemble options. So, in the argument list:
7834 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
7835`getopt-long' will recognize the `apples' option as having the
7836value "Granny Smith", but it will not recognize the `blimp'
7837option; it will return the strings "--blimp" and "Goodyear" as
7838ordinary argument strings.
7839
7840The `getopt-long' function returns the parsed argument list as an
7841assocation list, mapping option names --- the symbols from GRAMMAR
7842--- onto their values, or #t if the option does not accept a value.
7843Unused options do not appear in the alist.
7844
7845All arguments that are not the value of any option are returned
7846as a list, associated with the empty list.
7847
7848`getopt-long' throws an exception if:
7849- it finds an unrecognized option in ARGS
7850- a required option is omitted
7851- an option that requires an argument doesn't get one
7852- an option that doesn't accept an argument does get one (this can
7853 only happen using the long option `--opt=value' syntax)
7854- an option predicate fails
7855
7856So, for example:
7857
7858(define grammar
7859 `((lockfile-dir (required? #t)
7860 (value #t)
7861 (single-char #\k)
7862 (predicate ,file-is-directory?))
7863 (verbose (required? #f)
7864 (single-char #\v)
7865 (value #f))
7866 (x-includes (single-char #\x))
6c0201ad 7867 (rnet-server (single-char #\y)
deaceb4e
JB
7868 (predicate ,string?))))
7869
6c0201ad 7870(getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
deaceb4e
JB
7871 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
7872 grammar)
7873=> ((() "foo1" "-fred" "foo2" "foo3")
7874 (rnet-server . "lamprod")
7875 (x-includes . "/usr/include")
7876 (lockfile-dir . "/tmp")
7877 (verbose . #t))
7878
7879** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
7880
7881It will be removed in a few releases.
7882
08394899
MS
7883** New syntax: lambda*
7884** New syntax: define*
6c0201ad 7885** New syntax: define*-public
08394899
MS
7886** New syntax: defmacro*
7887** New syntax: defmacro*-public
6c0201ad 7888Guile now supports optional arguments.
08394899
MS
7889
7890`lambda*', `define*', `define*-public', `defmacro*' and
7891`defmacro*-public' are identical to the non-* versions except that
7892they use an extended type of parameter list that has the following BNF
7893syntax (parentheses are literal, square brackets indicate grouping,
7894and `*', `+' and `?' have the usual meaning):
7895
7896 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
6c0201ad 7897 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
08394899
MS
7898 [[#&rest identifier]|[. identifier]]? ) | [identifier]
7899
6c0201ad 7900 ext-var-decl ::= identifier | ( identifier expression )
08394899
MS
7901
7902The semantics are best illustrated with the following documentation
7903and examples for `lambda*':
7904
7905 lambda* args . body
7906 lambda extended for optional and keyword arguments
6c0201ad 7907
08394899
MS
7908 lambda* creates a procedure that takes optional arguments. These
7909 are specified by putting them inside brackets at the end of the
7910 paramater list, but before any dotted rest argument. For example,
7911 (lambda* (a b #&optional c d . e) '())
7912 creates a procedure with fixed arguments a and b, optional arguments c
7913 and d, and rest argument e. If the optional arguments are omitted
7914 in a call, the variables for them are unbound in the procedure. This
7915 can be checked with the bound? macro.
7916
7917 lambda* can also take keyword arguments. For example, a procedure
7918 defined like this:
7919 (lambda* (#&key xyzzy larch) '())
7920 can be called with any of the argument lists (#:xyzzy 11)
7921 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
7922 are given as keywords are bound to values.
7923
7924 Optional and keyword arguments can also be given default values
7925 which they take on when they are not present in a call, by giving a
7926 two-item list in place of an optional argument, for example in:
6c0201ad 7927 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
08394899
MS
7928 foo is a fixed argument, bar is an optional argument with default
7929 value 42, and baz is a keyword argument with default value 73.
7930 Default value expressions are not evaluated unless they are needed
6c0201ad 7931 and until the procedure is called.
08394899
MS
7932
7933 lambda* now supports two more special parameter list keywords.
7934
7935 lambda*-defined procedures now throw an error by default if a
7936 keyword other than one of those specified is found in the actual
7937 passed arguments. However, specifying #&allow-other-keys
7938 immediately after the kyword argument declarations restores the
7939 previous behavior of ignoring unknown keywords. lambda* also now
7940 guarantees that if the same keyword is passed more than once, the
7941 last one passed is the one that takes effect. For example,
7942 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
7943 #:heads 37 #:tails 42 #:heads 99)
7944 would result in (99 47) being displayed.
7945
7946 #&rest is also now provided as a synonym for the dotted syntax rest
7947 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
7948 all respects to lambda*. This is provided for more similarity to DSSSL,
7949 MIT-Scheme and Kawa among others, as well as for refugees from other
7950 Lisp dialects.
7951
7952Further documentation may be found in the optargs.scm file itself.
7953
7954The optional argument module also exports the macros `let-optional',
7955`let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
7956are not documented here because they may be removed in the future, but
7957full documentation is still available in optargs.scm.
7958
2e132553
JB
7959** New syntax: and-let*
7960Guile now supports the `and-let*' form, described in the draft SRFI-2.
7961
7962Syntax: (land* (<clause> ...) <body> ...)
7963Each <clause> should have one of the following forms:
7964 (<variable> <expression>)
7965 (<expression>)
7966 <bound-variable>
7967Each <variable> or <bound-variable> should be an identifier. Each
7968<expression> should be a valid expression. The <body> should be a
7969possibly empty sequence of expressions, like the <body> of a
7970lambda form.
7971
7972Semantics: A LAND* expression is evaluated by evaluating the
7973<expression> or <bound-variable> of each of the <clause>s from
7974left to right. The value of the first <expression> or
7975<bound-variable> that evaluates to a false value is returned; the
7976remaining <expression>s and <bound-variable>s are not evaluated.
7977The <body> forms are evaluated iff all the <expression>s and
7978<bound-variable>s evaluate to true values.
7979
7980The <expression>s and the <body> are evaluated in an environment
7981binding each <variable> of the preceding (<variable> <expression>)
7982clauses to the value of the <expression>. Later bindings
7983shadow earlier bindings.
7984
7985Guile's and-let* macro was contributed by Michael Livshin.
7986
36d3d540
MD
7987** New sorting functions
7988
7989*** New function: sorted? SEQUENCE LESS?
ed8c8636
MD
7990Returns `#t' when the sequence argument is in non-decreasing order
7991according to LESS? (that is, there is no adjacent pair `... x y
7992...' for which `(less? y x)').
7993
7994Returns `#f' when the sequence contains at least one out-of-order
7995pair. It is an error if the sequence is neither a list nor a
7996vector.
7997
36d3d540 7998*** New function: merge LIST1 LIST2 LESS?
ed8c8636
MD
7999LIST1 and LIST2 are sorted lists.
8000Returns the sorted list of all elements in LIST1 and LIST2.
8001
8002Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
8003in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
8004and that a < b1 in LIST1. Then a < b1 < b2 in the result.
8005(Here "<" should read "comes before".)
8006
36d3d540 8007*** New procedure: merge! LIST1 LIST2 LESS?
ed8c8636
MD
8008Merges two lists, re-using the pairs of LIST1 and LIST2 to build
8009the result. If the code is compiled, and LESS? constructs no new
8010pairs, no pairs at all will be allocated. The first pair of the
8011result will be either the first pair of LIST1 or the first pair of
8012LIST2.
8013
36d3d540 8014*** New function: sort SEQUENCE LESS?
ed8c8636
MD
8015Accepts either a list or a vector, and returns a new sequence
8016which is sorted. The new sequence is the same type as the input.
8017Always `(sorted? (sort sequence less?) less?)'. The original
8018sequence is not altered in any way. The new sequence shares its
8019elements with the old one; no elements are copied.
8020
36d3d540 8021*** New procedure: sort! SEQUENCE LESS
ed8c8636
MD
8022Returns its sorted result in the original boxes. No new storage is
8023allocated at all. Proper usage: (set! slist (sort! slist <))
8024
36d3d540 8025*** New function: stable-sort SEQUENCE LESS?
ed8c8636
MD
8026Similar to `sort' but stable. That is, if "equal" elements are
8027ordered a < b in the original sequence, they will have the same order
8028in the result.
8029
36d3d540 8030*** New function: stable-sort! SEQUENCE LESS?
ed8c8636
MD
8031Similar to `sort!' but stable.
8032Uses temporary storage when sorting vectors.
8033
36d3d540 8034*** New functions: sort-list, sort-list!
ed8c8636
MD
8035Added for compatibility with scsh.
8036
36d3d540
MD
8037** New built-in random number support
8038
8039*** New function: random N [STATE]
3e8370c3
MD
8040Accepts a positive integer or real N and returns a number of the
8041same type between zero (inclusive) and N (exclusive). The values
8042returned have a uniform distribution.
8043
8044The optional argument STATE must be of the type produced by
416075f1
MD
8045`copy-random-state' or `seed->random-state'. It defaults to the value
8046of the variable `*random-state*'. This object is used to maintain the
8047state of the pseudo-random-number generator and is altered as a side
8048effect of the `random' operation.
3e8370c3 8049
36d3d540 8050*** New variable: *random-state*
3e8370c3
MD
8051Holds a data structure that encodes the internal state of the
8052random-number generator that `random' uses by default. The nature
8053of this data structure is implementation-dependent. It may be
8054printed out and successfully read back in, but may or may not
8055function correctly as a random-number state object in another
8056implementation.
8057
36d3d540 8058*** New function: copy-random-state [STATE]
3e8370c3
MD
8059Returns a new object of type suitable for use as the value of the
8060variable `*random-state*' and as a second argument to `random'.
8061If argument STATE is given, a copy of it is returned. Otherwise a
8062copy of `*random-state*' is returned.
416075f1 8063
36d3d540 8064*** New function: seed->random-state SEED
416075f1
MD
8065Returns a new object of type suitable for use as the value of the
8066variable `*random-state*' and as a second argument to `random'.
8067SEED is a string or a number. A new state is generated and
8068initialized using SEED.
3e8370c3 8069
36d3d540 8070*** New function: random:uniform [STATE]
3e8370c3
MD
8071Returns an uniformly distributed inexact real random number in the
8072range between 0 and 1.
8073
36d3d540 8074*** New procedure: random:solid-sphere! VECT [STATE]
3e8370c3
MD
8075Fills VECT with inexact real random numbers the sum of whose
8076squares is less than 1.0. Thinking of VECT as coordinates in
8077space of dimension N = `(vector-length VECT)', the coordinates are
8078uniformly distributed within the unit N-shere. The sum of the
8079squares of the numbers is returned. VECT can be either a vector
8080or a uniform vector of doubles.
8081
36d3d540 8082*** New procedure: random:hollow-sphere! VECT [STATE]
3e8370c3
MD
8083Fills VECT with inexact real random numbers the sum of whose squares
8084is equal to 1.0. Thinking of VECT as coordinates in space of
8085dimension n = `(vector-length VECT)', the coordinates are uniformly
8086distributed over the surface of the unit n-shere. VECT can be either
8087a vector or a uniform vector of doubles.
8088
36d3d540 8089*** New function: random:normal [STATE]
3e8370c3
MD
8090Returns an inexact real in a normal distribution with mean 0 and
8091standard deviation 1. For a normal distribution with mean M and
8092standard deviation D use `(+ M (* D (random:normal)))'.
8093
36d3d540 8094*** New procedure: random:normal-vector! VECT [STATE]
3e8370c3
MD
8095Fills VECT with inexact real random numbers which are independent and
8096standard normally distributed (i.e., with mean 0 and variance 1).
8097VECT can be either a vector or a uniform vector of doubles.
8098
36d3d540 8099*** New function: random:exp STATE
3e8370c3
MD
8100Returns an inexact real in an exponential distribution with mean 1.
8101For an exponential distribution with mean U use (* U (random:exp)).
8102
69c6acbb
JB
8103** The range of logand, logior, logxor, logtest, and logbit? have changed.
8104
8105These functions now operate on numbers in the range of a C unsigned
8106long.
8107
8108These functions used to operate on numbers in the range of a C signed
8109long; however, this seems inappropriate, because Guile integers don't
8110overflow.
8111
ba4ee0d6
MD
8112** New function: make-guardian
8113This is an implementation of guardians as described in
8114R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
8115Generation-Based Garbage Collector" ACM SIGPLAN Conference on
8116Programming Language Design and Implementation, June 1993
8117ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
8118
88ceea5c
MD
8119** New functions: delq1!, delv1!, delete1!
8120These procedures behave similar to delq! and friends but delete only
8121one object if at all.
8122
55254a6a
MD
8123** New function: unread-string STRING PORT
8124Unread STRING to PORT, that is, push it back onto the port so that
8125next read operation will work on the pushed back characters.
8126
8127** unread-char can now be called multiple times
8128If unread-char is called multiple times, the unread characters will be
8129read again in last-in first-out order.
8130
9e97c52d
GH
8131** the procedures uniform-array-read! and uniform-array-write! now
8132work on any kind of port, not just ports which are open on a file.
8133
b074884f 8134** Now 'l' in a port mode requests line buffering.
9e97c52d 8135
69bc9ff3
GH
8136** The procedure truncate-file now works on string ports as well
8137as file ports. If the size argument is omitted, the current
1b9c3dae 8138file position is used.
9e97c52d 8139
c94577b4 8140** new procedure: seek PORT/FDES OFFSET WHENCE
9e97c52d
GH
8141The arguments are the same as for the old fseek procedure, but it
8142works on string ports as well as random-access file ports.
8143
8144** the fseek procedure now works on string ports, since it has been
c94577b4 8145redefined using seek.
9e97c52d
GH
8146
8147** the setvbuf procedure now uses a default size if mode is _IOFBF and
8148size is not supplied.
8149
8150** the newline procedure no longer flushes the port if it's not
8151line-buffered: previously it did if it was the current output port.
8152
8153** open-pipe and close-pipe are no longer primitive procedures, but
8154an emulation can be obtained using `(use-modules (ice-9 popen))'.
8155
8156** the freopen procedure has been removed.
8157
8158** new procedure: drain-input PORT
8159Drains PORT's read buffers (including any pushed-back characters)
8160and returns the contents as a single string.
8161
67ad463a 8162** New function: map-in-order PROC LIST1 LIST2 ...
d41b3904
MD
8163Version of `map' which guarantees that the procedure is applied to the
8164lists in serial order.
8165
67ad463a
MD
8166** Renamed `serial-array-copy!' and `serial-array-map!' to
8167`array-copy-in-order!' and `array-map-in-order!'. The old names are
8168now obsolete and will go away in release 1.5.
8169
cf7132b3 8170** New syntax: collect BODY1 ...
d41b3904
MD
8171Version of `begin' which returns a list of the results of the body
8172forms instead of the result of the last body form. In contrast to
cf7132b3 8173`begin', `collect' allows an empty body.
d41b3904 8174
e4eae9b1
MD
8175** New functions: read-history FILENAME, write-history FILENAME
8176Read/write command line history from/to file. Returns #t on success
8177and #f if an error occured.
8178
d21ffe26
JB
8179** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
8180
8181These procedures return a list of definitions available in the specified
8182argument, a relative module reference. In the case of no argument,
8183`(current-module)' is now consulted for definitions to return, instead
8184of simply returning #f, the former behavior.
8185
f8c9d497
JB
8186** The #/ syntax for lists is no longer supported.
8187
8188Earlier versions of Scheme accepted this syntax, but printed a
8189warning.
8190
8191** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
8192
8193Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
8194modules.
8195
3ffc7a36
MD
8196* Changes to the gh_ interface
8197
8198** gh_scm2doubles
8199
8200Now takes a second argument which is the result array. If this
8201pointer is NULL, a new array is malloced (the old behaviour).
8202
8203** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
8204 gh_scm2shorts, gh_scm2longs, gh_scm2floats
8205
8206New functions.
8207
3e8370c3
MD
8208* Changes to the scm_ interface
8209
ad91d6c3
MD
8210** Function: scm_make_named_hook (char* name, int n_args)
8211
8212Creates a hook in the same way as make-hook above but also
8213binds a variable named NAME to it.
8214
8215This is the typical way of creating a hook from C code.
8216
ece41168
MD
8217Currently, the variable is created in the "current" module. This
8218might change when we get the new module system.
ad91d6c3 8219
16a5a9a4
MD
8220** The smob interface
8221
8222The interface for creating smobs has changed. For documentation, see
8223data-rep.info (made from guile-core/doc/data-rep.texi).
8224
8225*** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
8226
8227>>> This function will be removed in 1.3.4. <<<
8228
8229It is replaced by:
8230
8231*** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
8232This function adds a new smob type, named NAME, with instance size
8233SIZE to the system. The return value is a tag that is used in
8234creating instances of the type. If SIZE is 0, then no memory will
8235be allocated when instances of the smob are created, and nothing
8236will be freed by the default free function.
6c0201ad 8237
16a5a9a4
MD
8238*** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
8239This function sets the smob marking procedure for the smob type
8240specified by the tag TC. TC is the tag returned by
8241`scm_make_smob_type'.
8242
8243*** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
8244This function sets the smob freeing procedure for the smob type
8245specified by the tag TC. TC is the tag returned by
8246`scm_make_smob_type'.
8247
8248*** Function: void scm_set_smob_print (tc, print)
8249
8250 - Function: void scm_set_smob_print (long tc,
8251 scm_sizet (*print) (SCM,
8252 SCM,
8253 scm_print_state *))
8254
8255This function sets the smob printing procedure for the smob type
8256specified by the tag TC. TC is the tag returned by
8257`scm_make_smob_type'.
8258
8259*** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
8260This function sets the smob equality-testing predicate for the
8261smob type specified by the tag TC. TC is the tag returned by
8262`scm_make_smob_type'.
8263
8264*** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
8265Make VALUE contain a smob instance of the type with type code TC and
8266smob data DATA. VALUE must be previously declared as C type `SCM'.
8267
8268*** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
8269This macro expands to a block of code that creates a smob instance
8270of the type with type code TC and smob data DATA, and returns that
8271`SCM' value. It should be the last piece of code in a block.
8272
9e97c52d
GH
8273** The interfaces for using I/O ports and implementing port types
8274(ptobs) have changed significantly. The new interface is based on
8275shared access to buffers and a new set of ptob procedures.
8276
16a5a9a4
MD
8277*** scm_newptob has been removed
8278
8279It is replaced by:
8280
8281*** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
8282
8283- Function: SCM scm_make_port_type (char *type_name,
8284 int (*fill_buffer) (SCM port),
8285 void (*write_flush) (SCM port));
8286
8287Similarly to the new smob interface, there is a set of function
8288setters by which the user can customize the behaviour of his port
544e9093 8289type. See ports.h (scm_set_port_XXX).
16a5a9a4 8290
9e97c52d
GH
8291** scm_strport_to_string: New function: creates a new string from
8292a string port's buffer.
8293
3e8370c3
MD
8294** Plug in interface for random number generators
8295The variable `scm_the_rng' in random.c contains a value and three
8296function pointers which together define the current random number
8297generator being used by the Scheme level interface and the random
8298number library functions.
8299
8300The user is free to replace the default generator with the generator
8301of his own choice.
8302
8303*** Variable: size_t scm_the_rng.rstate_size
8304The size of the random state type used by the current RNG
8305measured in chars.
8306
8307*** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
8308Given the random STATE, return 32 random bits.
8309
8310*** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
8311Seed random state STATE using string S of length N.
8312
8313*** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
8314Given random state STATE, return a malloced copy.
8315
8316** Default RNG
8317The default RNG is the MWC (Multiply With Carry) random number
8318generator described by George Marsaglia at the Department of
8319Statistics and Supercomputer Computations Research Institute, The
8320Florida State University (http://stat.fsu.edu/~geo).
8321
8322It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
8323passes all tests in the DIEHARD test suite
8324(http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
8325costs one multiply and one add on platforms which either supports long
8326longs (gcc does this on most systems) or have 64 bit longs. The cost
8327is four multiply on other systems but this can be optimized by writing
8328scm_i_uniform32 in assembler.
8329
8330These functions are provided through the scm_the_rng interface for use
8331by libguile and the application.
8332
8333*** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
8334Given the random STATE, return 32 random bits.
8335Don't use this function directly. Instead go through the plugin
8336interface (see "Plug in interface" above).
8337
8338*** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
8339Initialize STATE using SEED of length N.
8340
8341*** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
8342Return a malloc:ed copy of STATE. This function can easily be re-used
8343in the interfaces to other RNGs.
8344
8345** Random number library functions
8346These functions use the current RNG through the scm_the_rng interface.
8347It might be a good idea to use these functions from your C code so
8348that only one random generator is used by all code in your program.
8349
259529f2 8350The default random state is stored in:
3e8370c3
MD
8351
8352*** Variable: SCM scm_var_random_state
8353Contains the vcell of the Scheme variable "*random-state*" which is
8354used as default state by all random number functions in the Scheme
8355level interface.
8356
8357Example:
8358
259529f2 8359 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
3e8370c3 8360
259529f2
MD
8361*** Function: scm_rstate *scm_c_default_rstate (void)
8362This is a convenience function which returns the value of
8363scm_var_random_state. An error message is generated if this value
8364isn't a random state.
8365
8366*** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
8367Make a new random state from the string SEED of length LENGTH.
8368
8369It is generally not a good idea to use multiple random states in a
8370program. While subsequent random numbers generated from one random
8371state are guaranteed to be reasonably independent, there is no such
8372guarantee for numbers generated from different random states.
8373
8374*** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
8375Return 32 random bits.
8376
8377*** Function: double scm_c_uniform01 (scm_rstate *STATE)
3e8370c3
MD
8378Return a sample from the uniform(0,1) distribution.
8379
259529f2 8380*** Function: double scm_c_normal01 (scm_rstate *STATE)
3e8370c3
MD
8381Return a sample from the normal(0,1) distribution.
8382
259529f2 8383*** Function: double scm_c_exp1 (scm_rstate *STATE)
3e8370c3
MD
8384Return a sample from the exp(1) distribution.
8385
259529f2
MD
8386*** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
8387Return a sample from the discrete uniform(0,M) distribution.
8388
8389*** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
3e8370c3 8390Return a sample from the discrete uniform(0,M) distribution.
259529f2 8391M must be a bignum object. The returned value may be an INUM.
3e8370c3 8392
9e97c52d 8393
f3227c7a 8394\f
d23bbf3e 8395Changes in Guile 1.3 (released Monday, October 19, 1998):
c484bf7f
JB
8396
8397* Changes to the distribution
8398
e2d6569c
JB
8399** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
8400To avoid conflicts, programs should name environment variables after
8401themselves, except when there's a common practice establishing some
8402other convention.
8403
8404For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
8405giving the former precedence, and printing a warning message if the
8406latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
8407
8408** The header files related to multi-byte characters have been removed.
8409They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
8410which referred to these explicitly will probably need to be rewritten,
8411since the support for the variant string types has been removed; see
8412below.
8413
8414** The header files append.h and sequences.h have been removed. These
8415files implemented non-R4RS operations which would encourage
8416non-portable programming style and less easy-to-read code.
3a97e020 8417
c484bf7f
JB
8418* Changes to the stand-alone interpreter
8419
2e368582 8420** New procedures have been added to implement a "batch mode":
ec4ab4fd 8421
2e368582 8422*** Function: batch-mode?
ec4ab4fd
GH
8423
8424 Returns a boolean indicating whether the interpreter is in batch
8425 mode.
8426
2e368582 8427*** Function: set-batch-mode?! ARG
ec4ab4fd
GH
8428
8429 If ARG is true, switches the interpreter to batch mode. The `#f'
8430 case has not been implemented.
8431
2e368582
JB
8432** Guile now provides full command-line editing, when run interactively.
8433To use this feature, you must have the readline library installed.
8434The Guile build process will notice it, and automatically include
8435support for it.
8436
8437The readline library is available via anonymous FTP from any GNU
8438mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
8439
a5d6d578
MD
8440** the-last-stack is now a fluid.
8441
c484bf7f
JB
8442* Changes to the procedure for linking libguile with your programs
8443
71f20534 8444** You can now use the `guile-config' utility to build programs that use Guile.
2e368582 8445
2adfe1c0 8446Guile now includes a command-line utility called `guile-config', which
71f20534
JB
8447can provide information about how to compile and link programs that
8448use Guile.
8449
8450*** `guile-config compile' prints any C compiler flags needed to use Guile.
8451You should include this command's output on the command line you use
8452to compile C or C++ code that #includes the Guile header files. It's
8453usually just a `-I' flag to help the compiler find the Guile headers.
8454
8455
8456*** `guile-config link' prints any linker flags necessary to link with Guile.
8aa5c148 8457
71f20534 8458This command writes to its standard output a list of flags which you
8aa5c148
JB
8459must pass to the linker to link your code against the Guile library.
8460The flags include '-lguile' itself, any other libraries the Guile
8461library depends upon, and any `-L' flags needed to help the linker
8462find those libraries.
2e368582
JB
8463
8464For example, here is a Makefile rule that builds a program named 'foo'
8465from the object files ${FOO_OBJECTS}, and links them against Guile:
8466
8467 foo: ${FOO_OBJECTS}
2adfe1c0 8468 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
2e368582 8469
e2d6569c
JB
8470Previous Guile releases recommended that you use autoconf to detect
8471which of a predefined set of libraries were present on your system.
2adfe1c0 8472It is more robust to use `guile-config', since it records exactly which
e2d6569c
JB
8473libraries the installed Guile library requires.
8474
2adfe1c0
JB
8475This was originally called `build-guile', but was renamed to
8476`guile-config' before Guile 1.3 was released, to be consistent with
8477the analogous script for the GTK+ GUI toolkit, which is called
8478`gtk-config'.
8479
2e368582 8480
8aa5c148
JB
8481** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
8482
8483If you are using the GNU autoconf package to configure your program,
8484you can use the GUILE_FLAGS autoconf macro to call `guile-config'
8485(described above) and gather the necessary values for use in your
8486Makefiles.
8487
8488The GUILE_FLAGS macro expands to configure script code which runs the
8489`guile-config' script, to find out where Guile's header files and
8490libraries are installed. It sets two variables, marked for
8491substitution, as by AC_SUBST.
8492
8493 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
8494 code that uses Guile header files. This is almost always just a
8495 -I flag.
8496
8497 GUILE_LDFLAGS --- flags to pass to the linker to link a
8498 program against Guile. This includes `-lguile' for the Guile
8499 library itself, any libraries that Guile itself requires (like
8500 -lqthreads), and so on. It may also include a -L flag to tell the
8501 compiler where to find the libraries.
8502
8503GUILE_FLAGS is defined in the file guile.m4, in the top-level
8504directory of the Guile distribution. You can copy it into your
8505package's aclocal.m4 file, and then use it in your configure.in file.
8506
8507If you are using the `aclocal' program, distributed with GNU automake,
8508to maintain your aclocal.m4 file, the Guile installation process
8509installs guile.m4 where aclocal will find it. All you need to do is
8510use GUILE_FLAGS in your configure.in file, and then run `aclocal';
8511this will copy the definition of GUILE_FLAGS into your aclocal.m4
8512file.
8513
8514
c484bf7f 8515* Changes to Scheme functions and syntax
7ad3c1e7 8516
02755d59 8517** Multi-byte strings have been removed, as have multi-byte and wide
e2d6569c
JB
8518ports. We felt that these were the wrong approach to
8519internationalization support.
02755d59 8520
2e368582
JB
8521** New function: readline [PROMPT]
8522Read a line from the terminal, and allow the user to edit it,
8523prompting with PROMPT. READLINE provides a large set of Emacs-like
8524editing commands, lets the user recall previously typed lines, and
8525works on almost every kind of terminal, including dumb terminals.
8526
8527READLINE assumes that the cursor is at the beginning of the line when
8528it is invoked. Thus, you can't print a prompt yourself, and then call
8529READLINE; you need to package up your prompt as a string, pass it to
8530the function, and let READLINE print the prompt itself. This is
8531because READLINE needs to know the prompt's screen width.
8532
8cd57bd0
JB
8533For Guile to provide this function, you must have the readline
8534library, version 2.1 or later, installed on your system. Readline is
8535available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
8536any GNU mirror site.
2e368582
JB
8537
8538See also ADD-HISTORY function.
8539
8540** New function: add-history STRING
8541Add STRING as the most recent line in the history used by the READLINE
8542command. READLINE does not add lines to the history itself; you must
8543call ADD-HISTORY to make previous input available to the user.
8544
8cd57bd0
JB
8545** The behavior of the read-line function has changed.
8546
8547This function now uses standard C library functions to read the line,
8548for speed. This means that it doesn not respect the value of
8549scm-line-incrementors; it assumes that lines are delimited with
8550#\newline.
8551
8552(Note that this is read-line, the function that reads a line of text
8553from a port, not readline, the function that reads a line from a
8554terminal, providing full editing capabilities.)
8555
1a0106ef
JB
8556** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
8557
8558This module provides some simple argument parsing. It exports one
8559function:
8560
8561Function: getopt-gnu-style ARG-LS
8562 Parse a list of program arguments into an alist of option
8563 descriptions.
8564
8565 Each item in the list of program arguments is examined to see if
8566 it meets the syntax of a GNU long-named option. An argument like
8567 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
8568 returned alist, where MUMBLE is a keyword object with the same
8569 name as the argument. An argument like `--MUMBLE=FROB' produces
8570 an element of the form (MUMBLE . FROB), where FROB is a string.
8571
8572 As a special case, the returned alist also contains a pair whose
8573 car is the symbol `rest'. The cdr of this pair is a list
8574 containing all the items in the argument list that are not options
8575 of the form mentioned above.
8576
8577 The argument `--' is treated specially: all items in the argument
8578 list appearing after such an argument are not examined, and are
8579 returned in the special `rest' list.
8580
8581 This function does not parse normal single-character switches.
8582 You will need to parse them out of the `rest' list yourself.
8583
8cd57bd0
JB
8584** The read syntax for byte vectors and short vectors has changed.
8585
8586Instead of #bytes(...), write #y(...).
8587
8588Instead of #short(...), write #h(...).
8589
8590This may seem nutty, but, like the other uniform vectors, byte vectors
8591and short vectors want to have the same print and read syntax (and,
8592more basic, want to have read syntax!). Changing the read syntax to
8593use multiple characters after the hash sign breaks with the
8594conventions used in R5RS and the conventions used for the other
8595uniform vectors. It also introduces complexity in the current reader,
8596both on the C and Scheme levels. (The Right solution is probably to
8597change the syntax and prototypes for uniform vectors entirely.)
8598
8599
8600** The new module (ice-9 session) provides useful interactive functions.
8601
8602*** New procedure: (apropos REGEXP OPTION ...)
8603
8604Display a list of top-level variables whose names match REGEXP, and
8605the modules they are imported from. Each OPTION should be one of the
8606following symbols:
8607
8608 value --- Show the value of each matching variable.
8609 shadow --- Show bindings shadowed by subsequently imported modules.
8610 full --- Same as both `shadow' and `value'.
8611
8612For example:
8613
8614 guile> (apropos "trace" 'full)
8615 debug: trace #<procedure trace args>
8616 debug: untrace #<procedure untrace args>
8617 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
8618 the-scm-module: before-backtrace-hook ()
8619 the-scm-module: backtrace #<primitive-procedure backtrace>
8620 the-scm-module: after-backtrace-hook ()
8621 the-scm-module: has-shown-backtrace-hint? #f
6c0201ad 8622 guile>
8cd57bd0
JB
8623
8624** There are new functions and syntax for working with macros.
8625
8626Guile implements macros as a special object type. Any variable whose
8627top-level binding is a macro object acts as a macro. The macro object
8628specifies how the expression should be transformed before evaluation.
8629
8630*** Macro objects now print in a reasonable way, resembling procedures.
8631
8632*** New function: (macro? OBJ)
8633True iff OBJ is a macro object.
8634
8635*** New function: (primitive-macro? OBJ)
8636Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
8637macro transformers, implemented in eval.c rather than Scheme code.
8638
dbdd0c16
JB
8639Why do we have this function?
8640- For symmetry with procedure? and primitive-procedure?,
8641- to allow custom print procedures to tell whether a macro is
8642 primitive, and display it differently, and
8643- to allow compilers and user-written evaluators to distinguish
8644 builtin special forms from user-defined ones, which could be
8645 compiled.
8646
8cd57bd0
JB
8647*** New function: (macro-type OBJ)
8648Return a value indicating what kind of macro OBJ is. Possible return
8649values are:
8650
8651 The symbol `syntax' --- a macro created by procedure->syntax.
8652 The symbol `macro' --- a macro created by procedure->macro.
8653 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
6c0201ad 8654 The boolean #f --- if OBJ is not a macro object.
8cd57bd0
JB
8655
8656*** New function: (macro-name MACRO)
8657Return the name of the macro object MACRO's procedure, as returned by
8658procedure-name.
8659
8660*** New function: (macro-transformer MACRO)
8661Return the transformer procedure for MACRO.
8662
8663*** New syntax: (use-syntax MODULE ... TRANSFORMER)
8664
8665Specify a new macro expander to use in the current module. Each
8666MODULE is a module name, with the same meaning as in the `use-modules'
8667form; each named module's exported bindings are added to the current
8668top-level environment. TRANSFORMER is an expression evaluated in the
8669resulting environment which must yield a procedure to use as the
8670module's eval transformer: every expression evaluated in this module
8671is passed to this function, and the result passed to the Guile
6c0201ad 8672interpreter.
8cd57bd0
JB
8673
8674*** macro-eval! is removed. Use local-eval instead.
29521173 8675
8d9dcb3c
MV
8676** Some magic has been added to the printer to better handle user
8677written printing routines (like record printers, closure printers).
8678
8679The problem is that these user written routines must have access to
7fbd77df 8680the current `print-state' to be able to handle fancy things like
8d9dcb3c
MV
8681detection of circular references. These print-states have to be
8682passed to the builtin printing routines (display, write, etc) to
8683properly continue the print chain.
8684
8685We didn't want to change all existing print code so that it
8cd57bd0 8686explicitly passes thru a print state in addition to a port. Instead,
8d9dcb3c
MV
8687we extented the possible values that the builtin printing routines
8688accept as a `port'. In addition to a normal port, they now also take
8689a pair of a normal port and a print-state. Printing will go to the
8690port and the print-state will be used to control the detection of
8691circular references, etc. If the builtin function does not care for a
8692print-state, it is simply ignored.
8693
8694User written callbacks are now called with such a pair as their
8695`port', but because every function now accepts this pair as a PORT
8696argument, you don't have to worry about that. In fact, it is probably
8697safest to not check for these pairs.
8698
8699However, it is sometimes necessary to continue a print chain on a
8700different port, for example to get a intermediate string
8701representation of the printed value, mangle that string somehow, and
8702then to finally print the mangled string. Use the new function
8703
8704 inherit-print-state OLD-PORT NEW-PORT
8705
8706for this. It constructs a new `port' that prints to NEW-PORT but
8707inherits the print-state of OLD-PORT.
8708
ef1ea498
MD
8709** struct-vtable-offset renamed to vtable-offset-user
8710
8711** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
8712
e478dffa
MD
8713** There is now a third optional argument to make-vtable-vtable
8714 (and fourth to make-struct) when constructing new types (vtables).
8715 This argument initializes field vtable-index-printer of the vtable.
ef1ea498 8716
4851dc57
MV
8717** The detection of circular references has been extended to structs.
8718That is, a structure that -- in the process of being printed -- prints
8719itself does not lead to infinite recursion.
8720
8721** There is now some basic support for fluids. Please read
8722"libguile/fluid.h" to find out more. It is accessible from Scheme with
8723the following functions and macros:
8724
9c3fb66f
MV
8725Function: make-fluid
8726
8727 Create a new fluid object. Fluids are not special variables or
8728 some other extension to the semantics of Scheme, but rather
8729 ordinary Scheme objects. You can store them into variables (that
8730 are still lexically scoped, of course) or into any other place you
8731 like. Every fluid has a initial value of `#f'.
04c76b58 8732
9c3fb66f 8733Function: fluid? OBJ
04c76b58 8734
9c3fb66f 8735 Test whether OBJ is a fluid.
04c76b58 8736
9c3fb66f
MV
8737Function: fluid-ref FLUID
8738Function: fluid-set! FLUID VAL
04c76b58
MV
8739
8740 Access/modify the fluid FLUID. Modifications are only visible
8741 within the current dynamic root (that includes threads).
8742
9c3fb66f
MV
8743Function: with-fluids* FLUIDS VALUES THUNK
8744
8745 FLUIDS is a list of fluids and VALUES a corresponding list of
8746 values for these fluids. Before THUNK gets called the values are
6c0201ad 8747 installed in the fluids and the old values of the fluids are
9c3fb66f
MV
8748 saved in the VALUES list. When the flow of control leaves THUNK
8749 or reenters it, the values get swapped again. You might think of
8750 this as a `safe-fluid-excursion'. Note that the VALUES list is
8751 modified by `with-fluids*'.
8752
8753Macro: with-fluids ((FLUID VALUE) ...) FORM ...
8754
8755 The same as `with-fluids*' but with a different syntax. It looks
8756 just like `let', but both FLUID and VALUE are evaluated. Remember,
8757 fluids are not special variables but ordinary objects. FLUID
8758 should evaluate to a fluid.
04c76b58 8759
e2d6569c 8760** Changes to system call interfaces:
64d01d13 8761
e2d6569c 8762*** close-port, close-input-port and close-output-port now return a
64d01d13
GH
8763boolean instead of an `unspecified' object. #t means that the port
8764was successfully closed, while #f means it was already closed. It is
8765also now possible for these procedures to raise an exception if an
8766error occurs (some errors from write can be delayed until close.)
8767
e2d6569c 8768*** the first argument to chmod, fcntl, ftell and fseek can now be a
6afcd3b2
GH
8769file descriptor.
8770
e2d6569c 8771*** the third argument to fcntl is now optional.
6afcd3b2 8772
e2d6569c 8773*** the first argument to chown can now be a file descriptor or a port.
6afcd3b2 8774
e2d6569c 8775*** the argument to stat can now be a port.
6afcd3b2 8776
e2d6569c 8777*** The following new procedures have been added (most use scsh
64d01d13
GH
8778interfaces):
8779
e2d6569c 8780*** procedure: close PORT/FD
ec4ab4fd
GH
8781 Similar to close-port (*note close-port: Closing Ports.), but also
8782 works on file descriptors. A side effect of closing a file
8783 descriptor is that any ports using that file descriptor are moved
8784 to a different file descriptor and have their revealed counts set
8785 to zero.
8786
e2d6569c 8787*** procedure: port->fdes PORT
ec4ab4fd
GH
8788 Returns the integer file descriptor underlying PORT. As a side
8789 effect the revealed count of PORT is incremented.
8790
e2d6569c 8791*** procedure: fdes->ports FDES
ec4ab4fd
GH
8792 Returns a list of existing ports which have FDES as an underlying
8793 file descriptor, without changing their revealed counts.
8794
e2d6569c 8795*** procedure: fdes->inport FDES
ec4ab4fd
GH
8796 Returns an existing input port which has FDES as its underlying
8797 file descriptor, if one exists, and increments its revealed count.
8798 Otherwise, returns a new input port with a revealed count of 1.
8799
e2d6569c 8800*** procedure: fdes->outport FDES
ec4ab4fd
GH
8801 Returns an existing output port which has FDES as its underlying
8802 file descriptor, if one exists, and increments its revealed count.
8803 Otherwise, returns a new output port with a revealed count of 1.
8804
8805 The next group of procedures perform a `dup2' system call, if NEWFD
8806(an integer) is supplied, otherwise a `dup'. The file descriptor to be
8807duplicated can be supplied as an integer or contained in a port. The
64d01d13
GH
8808type of value returned varies depending on which procedure is used.
8809
ec4ab4fd
GH
8810 All procedures also have the side effect when performing `dup2' that
8811any ports using NEWFD are moved to a different file descriptor and have
64d01d13
GH
8812their revealed counts set to zero.
8813
e2d6569c 8814*** procedure: dup->fdes PORT/FD [NEWFD]
ec4ab4fd 8815 Returns an integer file descriptor.
64d01d13 8816
e2d6569c 8817*** procedure: dup->inport PORT/FD [NEWFD]
ec4ab4fd 8818 Returns a new input port using the new file descriptor.
64d01d13 8819
e2d6569c 8820*** procedure: dup->outport PORT/FD [NEWFD]
ec4ab4fd 8821 Returns a new output port using the new file descriptor.
64d01d13 8822
e2d6569c 8823*** procedure: dup PORT/FD [NEWFD]
ec4ab4fd
GH
8824 Returns a new port if PORT/FD is a port, with the same mode as the
8825 supplied port, otherwise returns an integer file descriptor.
64d01d13 8826
e2d6569c 8827*** procedure: dup->port PORT/FD MODE [NEWFD]
ec4ab4fd
GH
8828 Returns a new port using the new file descriptor. MODE supplies a
8829 mode string for the port (*note open-file: File Ports.).
64d01d13 8830
e2d6569c 8831*** procedure: setenv NAME VALUE
ec4ab4fd
GH
8832 Modifies the environment of the current process, which is also the
8833 default environment inherited by child processes.
64d01d13 8834
ec4ab4fd
GH
8835 If VALUE is `#f', then NAME is removed from the environment.
8836 Otherwise, the string NAME=VALUE is added to the environment,
8837 replacing any existing string with name matching NAME.
64d01d13 8838
ec4ab4fd 8839 The return value is unspecified.
956055a9 8840
e2d6569c 8841*** procedure: truncate-file OBJ SIZE
6afcd3b2
GH
8842 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
8843 can be a string containing a file name or an integer file
8844 descriptor or port open for output on the file. The underlying
8845 system calls are `truncate' and `ftruncate'.
8846
8847 The return value is unspecified.
8848
e2d6569c 8849*** procedure: setvbuf PORT MODE [SIZE]
7a6f1ffa
GH
8850 Set the buffering mode for PORT. MODE can be:
8851 `_IONBF'
8852 non-buffered
8853
8854 `_IOLBF'
8855 line buffered
8856
8857 `_IOFBF'
8858 block buffered, using a newly allocated buffer of SIZE bytes.
8859 However if SIZE is zero or unspecified, the port will be made
8860 non-buffered.
8861
8862 This procedure should not be used after I/O has been performed with
8863 the port.
8864
8865 Ports are usually block buffered by default, with a default buffer
8866 size. Procedures e.g., *Note open-file: File Ports, which accept a
8867 mode string allow `0' to be added to request an unbuffered port.
8868
e2d6569c 8869*** procedure: fsync PORT/FD
6afcd3b2
GH
8870 Copies any unwritten data for the specified output file descriptor
8871 to disk. If PORT/FD is a port, its buffer is flushed before the
8872 underlying file descriptor is fsync'd. The return value is
8873 unspecified.
8874
e2d6569c 8875*** procedure: open-fdes PATH FLAGS [MODES]
6afcd3b2
GH
8876 Similar to `open' but returns a file descriptor instead of a port.
8877
e2d6569c 8878*** procedure: execle PATH ENV [ARG] ...
6afcd3b2
GH
8879 Similar to `execl', but the environment of the new process is
8880 specified by ENV, which must be a list of strings as returned by
8881 the `environ' procedure.
8882
8883 This procedure is currently implemented using the `execve' system
8884 call, but we call it `execle' because of its Scheme calling
8885 interface.
8886
e2d6569c 8887*** procedure: strerror ERRNO
ec4ab4fd
GH
8888 Returns the Unix error message corresponding to ERRNO, an integer.
8889
e2d6569c 8890*** procedure: primitive-exit [STATUS]
6afcd3b2
GH
8891 Terminate the current process without unwinding the Scheme stack.
8892 This is would typically be useful after a fork. The exit status
8893 is STATUS if supplied, otherwise zero.
8894
e2d6569c 8895*** procedure: times
6afcd3b2
GH
8896 Returns an object with information about real and processor time.
8897 The following procedures accept such an object as an argument and
8898 return a selected component:
8899
8900 `tms:clock'
8901 The current real time, expressed as time units relative to an
8902 arbitrary base.
8903
8904 `tms:utime'
8905 The CPU time units used by the calling process.
8906
8907 `tms:stime'
8908 The CPU time units used by the system on behalf of the
8909 calling process.
8910
8911 `tms:cutime'
8912 The CPU time units used by terminated child processes of the
8913 calling process, whose status has been collected (e.g., using
8914 `waitpid').
8915
8916 `tms:cstime'
8917 Similarly, the CPU times units used by the system on behalf of
8918 terminated child processes.
7ad3c1e7 8919
e2d6569c
JB
8920** Removed: list-length
8921** Removed: list-append, list-append!
8922** Removed: list-reverse, list-reverse!
8923
8924** array-map renamed to array-map!
8925
8926** serial-array-map renamed to serial-array-map!
8927
660f41fa
MD
8928** catch doesn't take #f as first argument any longer
8929
8930Previously, it was possible to pass #f instead of a key to `catch'.
8931That would cause `catch' to pass a jump buffer object to the procedure
8932passed as second argument. The procedure could then use this jump
8933buffer objekt as an argument to throw.
8934
8935This mechanism has been removed since its utility doesn't motivate the
8936extra complexity it introduces.
8937
332d00f6
JB
8938** The `#/' notation for lists now provokes a warning message from Guile.
8939This syntax will be removed from Guile in the near future.
8940
8941To disable the warning message, set the GUILE_HUSH environment
8942variable to any non-empty value.
8943
8cd57bd0
JB
8944** The newline character now prints as `#\newline', following the
8945normal Scheme notation, not `#\nl'.
8946
c484bf7f
JB
8947* Changes to the gh_ interface
8948
8986901b
JB
8949** The gh_enter function now takes care of loading the Guile startup files.
8950gh_enter works by calling scm_boot_guile; see the remarks below.
8951
5424b4f7
MD
8952** Function: void gh_write (SCM x)
8953
8954Write the printed representation of the scheme object x to the current
8955output port. Corresponds to the scheme level `write'.
8956
3a97e020
MD
8957** gh_list_length renamed to gh_length.
8958
8d6787b6
MG
8959** vector handling routines
8960
8961Several major changes. In particular, gh_vector() now resembles
8962(vector ...) (with a caveat -- see manual), and gh_make_vector() now
956328d2
MG
8963exists and behaves like (make-vector ...). gh_vset() and gh_vref()
8964have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
8d6787b6
MG
8965vector-related gh_ functions have been implemented.
8966
7fee59bd
MG
8967** pair and list routines
8968
8969Implemented several of the R4RS pair and list functions that were
8970missing.
8971
171422a9
MD
8972** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
8973
8974New function. Converts double arrays back and forth between Scheme
8975and C.
8976
c484bf7f
JB
8977* Changes to the scm_ interface
8978
8986901b
JB
8979** The function scm_boot_guile now takes care of loading the startup files.
8980
8981Guile's primary initialization function, scm_boot_guile, now takes
8982care of loading `boot-9.scm', in the `ice-9' module, to initialize
8983Guile, define the module system, and put together some standard
8984bindings. It also loads `init.scm', which is intended to hold
8985site-specific initialization code.
8986
8987Since Guile cannot operate properly until boot-9.scm is loaded, there
8988is no reason to separate loading boot-9.scm from Guile's other
8989initialization processes.
8990
8991This job used to be done by scm_compile_shell_switches, which didn't
8992make much sense; in particular, it meant that people using Guile for
8993non-shell-like applications had to jump through hoops to get Guile
8994initialized properly.
8995
8996** The function scm_compile_shell_switches no longer loads the startup files.
8997Now, Guile always loads the startup files, whenever it is initialized;
8998see the notes above for scm_boot_guile and scm_load_startup_files.
8999
9000** Function: scm_load_startup_files
9001This new function takes care of loading Guile's initialization file
9002(`boot-9.scm'), and the site initialization file, `init.scm'. Since
9003this is always called by the Guile initialization process, it's
9004probably not too useful to call this yourself, but it's there anyway.
9005
87148d9e
JB
9006** The semantics of smob marking have changed slightly.
9007
9008The smob marking function (the `mark' member of the scm_smobfuns
9009structure) is no longer responsible for setting the mark bit on the
9010smob. The generic smob handling code in the garbage collector will
9011set this bit. The mark function need only ensure that any other
9012objects the smob refers to get marked.
9013
9014Note that this change means that the smob's GC8MARK bit is typically
9015already set upon entry to the mark function. Thus, marking functions
9016which look like this:
9017
9018 {
9019 if (SCM_GC8MARKP (ptr))
9020 return SCM_BOOL_F;
9021 SCM_SETGC8MARK (ptr);
9022 ... mark objects to which the smob refers ...
9023 }
9024
9025are now incorrect, since they will return early, and fail to mark any
9026other objects the smob refers to. Some code in the Guile library used
9027to work this way.
9028
1cf84ea5
JB
9029** The semantics of the I/O port functions in scm_ptobfuns have changed.
9030
9031If you have implemented your own I/O port type, by writing the
9032functions required by the scm_ptobfuns and then calling scm_newptob,
9033you will need to change your functions slightly.
9034
9035The functions in a scm_ptobfuns structure now expect the port itself
9036as their argument; they used to expect the `stream' member of the
9037port's scm_port_table structure. This allows functions in an
9038scm_ptobfuns structure to easily access the port's cell (and any flags
9039it its CAR), and the port's scm_port_table structure.
9040
9041Guile now passes the I/O port itself as the `port' argument in the
9042following scm_ptobfuns functions:
9043
9044 int (*free) (SCM port);
9045 int (*fputc) (int, SCM port);
9046 int (*fputs) (char *, SCM port);
9047 scm_sizet (*fwrite) SCM_P ((char *ptr,
9048 scm_sizet size,
9049 scm_sizet nitems,
9050 SCM port));
9051 int (*fflush) (SCM port);
9052 int (*fgetc) (SCM port);
9053 int (*fclose) (SCM port);
9054
9055The interfaces to the `mark', `print', `equalp', and `fgets' methods
9056are unchanged.
9057
9058If you have existing code which defines its own port types, it is easy
9059to convert your code to the new interface; simply apply SCM_STREAM to
9060the port argument to yield the value you code used to expect.
9061
9062Note that since both the port and the stream have the same type in the
9063C code --- they are both SCM values --- the C compiler will not remind
9064you if you forget to update your scm_ptobfuns functions.
9065
9066
933a7411
MD
9067** Function: int scm_internal_select (int fds,
9068 SELECT_TYPE *rfds,
9069 SELECT_TYPE *wfds,
9070 SELECT_TYPE *efds,
9071 struct timeval *timeout);
9072
9073This is a replacement for the `select' function provided by the OS.
9074It enables I/O blocking and sleeping to happen for one cooperative
9075thread without blocking other threads. It also avoids busy-loops in
9076these situations. It is intended that all I/O blocking and sleeping
9077will finally go through this function. Currently, this function is
9078only available on systems providing `gettimeofday' and `select'.
9079
5424b4f7
MD
9080** Function: SCM scm_internal_stack_catch (SCM tag,
9081 scm_catch_body_t body,
9082 void *body_data,
9083 scm_catch_handler_t handler,
9084 void *handler_data)
9085
9086A new sibling to the other two C level `catch' functions
9087scm_internal_catch and scm_internal_lazy_catch. Use it if you want
9088the stack to be saved automatically into the variable `the-last-stack'
9089(scm_the_last_stack_var) on error. This is necessary if you want to
9090use advanced error reporting, such as calling scm_display_error and
9091scm_display_backtrace. (They both take a stack object as argument.)
9092
df366c26
MD
9093** Function: SCM scm_spawn_thread (scm_catch_body_t body,
9094 void *body_data,
9095 scm_catch_handler_t handler,
9096 void *handler_data)
9097
9098Spawns a new thread. It does a job similar to
9099scm_call_with_new_thread but takes arguments more suitable when
9100spawning threads from application C code.
9101
88482b31
MD
9102** The hook scm_error_callback has been removed. It was originally
9103intended as a way for the user to install his own error handler. But
9104that method works badly since it intervenes between throw and catch,
9105thereby changing the semantics of expressions like (catch #t ...).
9106The correct way to do it is to use one of the C level catch functions
9107in throw.c: scm_internal_catch/lazy_catch/stack_catch.
9108
3a97e020
MD
9109** Removed functions:
9110
9111scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
9112scm_list_reverse, scm_list_reverse_x
9113
9114** New macros: SCM_LISTn where n is one of the integers 0-9.
9115
9116These can be used for pretty list creation from C. The idea is taken
9117from Erick Gallesio's STk.
9118
298aa6e3
MD
9119** scm_array_map renamed to scm_array_map_x
9120
527da704
MD
9121** mbstrings are now removed
9122
9123This means that the type codes scm_tc7_mb_string and
9124scm_tc7_mb_substring has been removed.
9125
8cd57bd0
JB
9126** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
9127
9128Since we no longer support multi-byte strings, these I/O functions
9129have been simplified, and renamed. Here are their old names, and
9130their new names and arguments:
9131
9132scm_gen_putc -> void scm_putc (int c, SCM port);
9133scm_gen_puts -> void scm_puts (char *s, SCM port);
9134scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
9135scm_gen_getc -> void scm_getc (SCM port);
9136
9137
527da704
MD
9138** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
9139
9140** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
9141
9142SCM_TYP7S now masks away the bit which distinguishes substrings from
9143strings.
9144
660f41fa
MD
9145** scm_catch_body_t: Backward incompatible change!
9146
9147Body functions to scm_internal_catch and friends do not any longer
9148take a second argument. This is because it is no longer possible to
9149pass a #f arg to catch.
9150
a8e05009
JB
9151** Calls to scm_protect_object and scm_unprotect now nest properly.
9152
9153The function scm_protect_object protects its argument from being freed
9154by the garbage collector. scm_unprotect_object removes that
9155protection.
9156
9157These functions now nest properly. That is, for every object O, there
9158is a counter which scm_protect_object(O) increments and
9159scm_unprotect_object(O) decrements, if the counter is greater than
9160zero. Every object's counter is zero when it is first created. If an
9161object's counter is greater than zero, the garbage collector will not
9162reclaim its storage.
9163
9164This allows you to use scm_protect_object in your code without
9165worrying that some other function you call will call
9166scm_unprotect_object, and allow it to be freed. Assuming that the
9167functions you call are well-behaved, and unprotect only those objects
9168they protect, you can follow the same rule and have confidence that
9169objects will be freed only at appropriate times.
9170
c484bf7f
JB
9171\f
9172Changes in Guile 1.2 (released Tuesday, June 24 1997):
cf78e9e8 9173
737c9113
JB
9174* Changes to the distribution
9175
832b09ed
JB
9176** Nightly snapshots are now available from ftp.red-bean.com.
9177The old server, ftp.cyclic.com, has been relinquished to its rightful
9178owner.
9179
9180Nightly snapshots of the Guile development sources are now available via
9181anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
9182
9183Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
9184For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
9185
0fcab5ed
JB
9186** To run Guile without installing it, the procedure has changed a bit.
9187
9188If you used a separate build directory to compile Guile, you'll need
9189to include the build directory in SCHEME_LOAD_PATH, as well as the
9190source directory. See the `INSTALL' file for examples.
9191
737c9113
JB
9192* Changes to the procedure for linking libguile with your programs
9193
94982a4e
JB
9194** The standard Guile load path for Scheme code now includes
9195$(datadir)/guile (usually /usr/local/share/guile). This means that
9196you can install your own Scheme files there, and Guile will find them.
9197(Previous versions of Guile only checked a directory whose name
9198contained the Guile version number, so you had to re-install or move
9199your Scheme sources each time you installed a fresh version of Guile.)
9200
9201The load path also includes $(datadir)/guile/site; we recommend
9202putting individual Scheme files there. If you want to install a
9203package with multiple source files, create a directory for them under
9204$(datadir)/guile.
9205
9206** Guile 1.2 will now use the Rx regular expression library, if it is
9207installed on your system. When you are linking libguile into your own
9208programs, this means you will have to link against -lguile, -lqt (if
9209you configured Guile with thread support), and -lrx.
27590f82
JB
9210
9211If you are using autoconf to generate configuration scripts for your
9212application, the following lines should suffice to add the appropriate
9213libraries to your link command:
9214
9215### Find Rx, quickthreads and libguile.
9216AC_CHECK_LIB(rx, main)
9217AC_CHECK_LIB(qt, main)
9218AC_CHECK_LIB(guile, scm_shell)
9219
94982a4e
JB
9220The Guile 1.2 distribution does not contain sources for the Rx
9221library, as Guile 1.0 did. If you want to use Rx, you'll need to
9222retrieve it from a GNU FTP site and install it separately.
9223
b83b8bee
JB
9224* Changes to Scheme functions and syntax
9225
e035e7e6
MV
9226** The dynamic linking features of Guile are now enabled by default.
9227You can disable them by giving the `--disable-dynamic-linking' option
9228to configure.
9229
e035e7e6
MV
9230 (dynamic-link FILENAME)
9231
9232 Find the object file denoted by FILENAME (a string) and link it
9233 into the running Guile application. When everything works out,
9234 return a Scheme object suitable for representing the linked object
9235 file. Otherwise an error is thrown. How object files are
9236 searched is system dependent.
9237
9238 (dynamic-object? VAL)
9239
9240 Determine whether VAL represents a dynamically linked object file.
9241
9242 (dynamic-unlink DYNOBJ)
9243
9244 Unlink the indicated object file from the application. DYNOBJ
9245 should be one of the values returned by `dynamic-link'.
9246
9247 (dynamic-func FUNCTION DYNOBJ)
9248
9249 Search the C function indicated by FUNCTION (a string or symbol)
9250 in DYNOBJ and return some Scheme object that can later be used
9251 with `dynamic-call' to actually call this function. Right now,
9252 these Scheme objects are formed by casting the address of the
9253 function to `long' and converting this number to its Scheme
9254 representation.
9255
9256 (dynamic-call FUNCTION DYNOBJ)
9257
9258 Call the C function indicated by FUNCTION and DYNOBJ. The
9259 function is passed no arguments and its return value is ignored.
9260 When FUNCTION is something returned by `dynamic-func', call that
9261 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
9262 etc.), look it up in DYNOBJ; this is equivalent to
9263
9264 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
9265
9266 Interrupts are deferred while the C function is executing (with
9267 SCM_DEFER_INTS/SCM_ALLOW_INTS).
9268
9269 (dynamic-args-call FUNCTION DYNOBJ ARGS)
9270
9271 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
9272 some arguments and return its return value. The C function is
9273 expected to take two arguments and return an `int', just like
9274 `main':
9275
9276 int c_func (int argc, char **argv);
9277
9278 ARGS must be a list of strings and is converted into an array of
9279 `char *'. The array is passed in ARGV and its size in ARGC. The
9280 return value is converted to a Scheme number and returned from the
9281 call to `dynamic-args-call'.
9282
0fcab5ed
JB
9283When dynamic linking is disabled or not supported on your system,
9284the above functions throw errors, but they are still available.
9285
e035e7e6
MV
9286Here is a small example that works on GNU/Linux:
9287
9288 (define libc-obj (dynamic-link "libc.so"))
9289 (dynamic-args-call 'rand libc-obj '())
9290
9291See the file `libguile/DYNAMIC-LINKING' for additional comments.
9292
27590f82 9293** The #/ syntax for module names is depreciated, and will be removed
6c0201ad 9294in a future version of Guile. Instead of
27590f82
JB
9295
9296 #/foo/bar/baz
9297
9298instead write
9299
9300 (foo bar baz)
9301
9302The latter syntax is more consistent with existing Lisp practice.
9303
5dade857
MV
9304** Guile now does fancier printing of structures. Structures are the
9305underlying implementation for records, which in turn are used to
9306implement modules, so all of these object now print differently and in
9307a more informative way.
9308
161029df
JB
9309The Scheme printer will examine the builtin variable *struct-printer*
9310whenever it needs to print a structure object. When this variable is
9311not `#f' it is deemed to be a procedure and will be applied to the
9312structure object and the output port. When *struct-printer* is `#f'
9313or the procedure return `#f' the structure object will be printed in
9314the boring #<struct 80458270> form.
5dade857
MV
9315
9316This hook is used by some routines in ice-9/boot-9.scm to implement
9317type specific printing routines. Please read the comments there about
9318"printing structs".
9319
9320One of the more specific uses of structs are records. The printing
9321procedure that could be passed to MAKE-RECORD-TYPE is now actually
9322called. It should behave like a *struct-printer* procedure (described
9323above).
9324
b83b8bee
JB
9325** Guile now supports a new R4RS-compliant syntax for keywords. A
9326token of the form #:NAME, where NAME has the same syntax as a Scheme
9327symbol, is the external representation of the keyword named NAME.
9328Keyword objects print using this syntax as well, so values containing
1e5afba0
JB
9329keyword objects can be read back into Guile. When used in an
9330expression, keywords are self-quoting objects.
b83b8bee
JB
9331
9332Guile suports this read syntax, and uses this print syntax, regardless
9333of the current setting of the `keyword' read option. The `keyword'
9334read option only controls whether Guile recognizes the `:NAME' syntax,
9335which is incompatible with R4RS. (R4RS says such token represent
9336symbols.)
737c9113
JB
9337
9338** Guile has regular expression support again. Guile 1.0 included
9339functions for matching regular expressions, based on the Rx library.
9340In Guile 1.1, the Guile/Rx interface was removed to simplify the
9341distribution, and thus Guile had no regular expression support. Guile
94982a4e
JB
93421.2 again supports the most commonly used functions, and supports all
9343of SCSH's regular expression functions.
2409cdfa 9344
94982a4e
JB
9345If your system does not include a POSIX regular expression library,
9346and you have not linked Guile with a third-party regexp library such as
9347Rx, these functions will not be available. You can tell whether your
9348Guile installation includes regular expression support by checking
9349whether the `*features*' list includes the `regex' symbol.
737c9113 9350
94982a4e 9351*** regexp functions
161029df 9352
94982a4e
JB
9353By default, Guile supports POSIX extended regular expressions. That
9354means that the characters `(', `)', `+' and `?' are special, and must
9355be escaped if you wish to match the literal characters.
e1a191a8 9356
94982a4e
JB
9357This regular expression interface was modeled after that implemented
9358by SCSH, the Scheme Shell. It is intended to be upwardly compatible
9359with SCSH regular expressions.
9360
9361**** Function: string-match PATTERN STR [START]
9362 Compile the string PATTERN into a regular expression and compare
9363 it with STR. The optional numeric argument START specifies the
9364 position of STR at which to begin matching.
9365
9366 `string-match' returns a "match structure" which describes what,
9367 if anything, was matched by the regular expression. *Note Match
9368 Structures::. If STR does not match PATTERN at all,
9369 `string-match' returns `#f'.
9370
9371 Each time `string-match' is called, it must compile its PATTERN
9372argument into a regular expression structure. This operation is
9373expensive, which makes `string-match' inefficient if the same regular
9374expression is used several times (for example, in a loop). For better
9375performance, you can compile a regular expression in advance and then
9376match strings against the compiled regexp.
9377
9378**** Function: make-regexp STR [FLAGS]
9379 Compile the regular expression described by STR, and return the
9380 compiled regexp structure. If STR does not describe a legal
9381 regular expression, `make-regexp' throws a
9382 `regular-expression-syntax' error.
9383
9384 FLAGS may be the bitwise-or of one or more of the following:
9385
9386**** Constant: regexp/extended
9387 Use POSIX Extended Regular Expression syntax when interpreting
9388 STR. If not set, POSIX Basic Regular Expression syntax is used.
9389 If the FLAGS argument is omitted, we assume regexp/extended.
9390
9391**** Constant: regexp/icase
9392 Do not differentiate case. Subsequent searches using the
9393 returned regular expression will be case insensitive.
9394
9395**** Constant: regexp/newline
9396 Match-any-character operators don't match a newline.
9397
9398 A non-matching list ([^...]) not containing a newline matches a
9399 newline.
9400
9401 Match-beginning-of-line operator (^) matches the empty string
9402 immediately after a newline, regardless of whether the FLAGS
9403 passed to regexp-exec contain regexp/notbol.
9404
9405 Match-end-of-line operator ($) matches the empty string
9406 immediately before a newline, regardless of whether the FLAGS
9407 passed to regexp-exec contain regexp/noteol.
9408
9409**** Function: regexp-exec REGEXP STR [START [FLAGS]]
9410 Match the compiled regular expression REGEXP against `str'. If
9411 the optional integer START argument is provided, begin matching
9412 from that position in the string. Return a match structure
9413 describing the results of the match, or `#f' if no match could be
9414 found.
9415
9416 FLAGS may be the bitwise-or of one or more of the following:
9417
9418**** Constant: regexp/notbol
9419 The match-beginning-of-line operator always fails to match (but
9420 see the compilation flag regexp/newline above) This flag may be
9421 used when different portions of a string are passed to
9422 regexp-exec and the beginning of the string should not be
9423 interpreted as the beginning of the line.
9424
9425**** Constant: regexp/noteol
9426 The match-end-of-line operator always fails to match (but see the
9427 compilation flag regexp/newline above)
9428
9429**** Function: regexp? OBJ
9430 Return `#t' if OBJ is a compiled regular expression, or `#f'
9431 otherwise.
9432
9433 Regular expressions are commonly used to find patterns in one string
9434and replace them with the contents of another string.
9435
9436**** Function: regexp-substitute PORT MATCH [ITEM...]
9437 Write to the output port PORT selected contents of the match
9438 structure MATCH. Each ITEM specifies what should be written, and
9439 may be one of the following arguments:
9440
9441 * A string. String arguments are written out verbatim.
9442
9443 * An integer. The submatch with that number is written.
9444
9445 * The symbol `pre'. The portion of the matched string preceding
9446 the regexp match is written.
9447
9448 * The symbol `post'. The portion of the matched string
9449 following the regexp match is written.
9450
9451 PORT may be `#f', in which case nothing is written; instead,
9452 `regexp-substitute' constructs a string from the specified ITEMs
9453 and returns that.
9454
9455**** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
9456 Similar to `regexp-substitute', but can be used to perform global
9457 substitutions on STR. Instead of taking a match structure as an
9458 argument, `regexp-substitute/global' takes two string arguments: a
9459 REGEXP string describing a regular expression, and a TARGET string
9460 which should be matched against this regular expression.
9461
9462 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
9463 exceptions:
9464
9465 * A function may be supplied. When this function is called, it
9466 will be passed one argument: a match structure for a given
9467 regular expression match. It should return a string to be
9468 written out to PORT.
9469
9470 * The `post' symbol causes `regexp-substitute/global' to recurse
9471 on the unmatched portion of STR. This *must* be supplied in
9472 order to perform global search-and-replace on STR; if it is
9473 not present among the ITEMs, then `regexp-substitute/global'
9474 will return after processing a single match.
9475
9476*** Match Structures
9477
9478 A "match structure" is the object returned by `string-match' and
9479`regexp-exec'. It describes which portion of a string, if any, matched
9480the given regular expression. Match structures include: a reference to
9481the string that was checked for matches; the starting and ending
9482positions of the regexp match; and, if the regexp included any
9483parenthesized subexpressions, the starting and ending positions of each
9484submatch.
9485
9486 In each of the regexp match functions described below, the `match'
9487argument must be a match structure returned by a previous call to
9488`string-match' or `regexp-exec'. Most of these functions return some
9489information about the original target string that was matched against a
9490regular expression; we will call that string TARGET for easy reference.
9491
9492**** Function: regexp-match? OBJ
9493 Return `#t' if OBJ is a match structure returned by a previous
9494 call to `regexp-exec', or `#f' otherwise.
9495
9496**** Function: match:substring MATCH [N]
9497 Return the portion of TARGET matched by subexpression number N.
9498 Submatch 0 (the default) represents the entire regexp match. If
9499 the regular expression as a whole matched, but the subexpression
9500 number N did not match, return `#f'.
9501
9502**** Function: match:start MATCH [N]
9503 Return the starting position of submatch number N.
9504
9505**** Function: match:end MATCH [N]
9506 Return the ending position of submatch number N.
9507
9508**** Function: match:prefix MATCH
9509 Return the unmatched portion of TARGET preceding the regexp match.
9510
9511**** Function: match:suffix MATCH
9512 Return the unmatched portion of TARGET following the regexp match.
9513
9514**** Function: match:count MATCH
9515 Return the number of parenthesized subexpressions from MATCH.
9516 Note that the entire regular expression match itself counts as a
9517 subexpression, and failed submatches are included in the count.
9518
9519**** Function: match:string MATCH
9520 Return the original TARGET string.
9521
9522*** Backslash Escapes
9523
9524 Sometimes you will want a regexp to match characters like `*' or `$'
9525exactly. For example, to check whether a particular string represents
9526a menu entry from an Info node, it would be useful to match it against
9527a regexp like `^* [^:]*::'. However, this won't work; because the
9528asterisk is a metacharacter, it won't match the `*' at the beginning of
9529the string. In this case, we want to make the first asterisk un-magic.
9530
9531 You can do this by preceding the metacharacter with a backslash
9532character `\'. (This is also called "quoting" the metacharacter, and
9533is known as a "backslash escape".) When Guile sees a backslash in a
9534regular expression, it considers the following glyph to be an ordinary
9535character, no matter what special meaning it would ordinarily have.
9536Therefore, we can make the above example work by changing the regexp to
9537`^\* [^:]*::'. The `\*' sequence tells the regular expression engine
9538to match only a single asterisk in the target string.
9539
9540 Since the backslash is itself a metacharacter, you may force a
9541regexp to match a backslash in the target string by preceding the
9542backslash with itself. For example, to find variable references in a
9543TeX program, you might want to find occurrences of the string `\let\'
9544followed by any number of alphabetic characters. The regular expression
9545`\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
9546each match a single backslash in the target string.
9547
9548**** Function: regexp-quote STR
9549 Quote each special character found in STR with a backslash, and
9550 return the resulting string.
9551
9552 *Very important:* Using backslash escapes in Guile source code (as
9553in Emacs Lisp or C) can be tricky, because the backslash character has
9554special meaning for the Guile reader. For example, if Guile encounters
9555the character sequence `\n' in the middle of a string while processing
9556Scheme code, it replaces those characters with a newline character.
9557Similarly, the character sequence `\t' is replaced by a horizontal tab.
9558Several of these "escape sequences" are processed by the Guile reader
9559before your code is executed. Unrecognized escape sequences are
9560ignored: if the characters `\*' appear in a string, they will be
9561translated to the single character `*'.
9562
9563 This translation is obviously undesirable for regular expressions,
9564since we want to be able to include backslashes in a string in order to
9565escape regexp metacharacters. Therefore, to make sure that a backslash
9566is preserved in a string in your Guile program, you must use *two*
9567consecutive backslashes:
9568
9569 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
9570
9571 The string in this example is preprocessed by the Guile reader before
9572any code is executed. The resulting argument to `make-regexp' is the
9573string `^\* [^:]*', which is what we really want.
9574
9575 This also means that in order to write a regular expression that
9576matches a single backslash character, the regular expression string in
9577the source code must include *four* backslashes. Each consecutive pair
9578of backslashes gets translated by the Guile reader to a single
9579backslash, and the resulting double-backslash is interpreted by the
9580regexp engine as matching a single backslash character. Hence:
9581
9582 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
9583
9584 The reason for the unwieldiness of this syntax is historical. Both
9585regular expression pattern matchers and Unix string processing systems
9586have traditionally used backslashes with the special meanings described
9587above. The POSIX regular expression specification and ANSI C standard
9588both require these semantics. Attempting to abandon either convention
9589would cause other kinds of compatibility problems, possibly more severe
9590ones. Therefore, without extending the Scheme reader to support
9591strings with different quoting conventions (an ungainly and confusing
9592extension when implemented in other languages), we must adhere to this
9593cumbersome escape syntax.
9594
7ad3c1e7
GH
9595* Changes to the gh_ interface
9596
9597* Changes to the scm_ interface
9598
9599* Changes to system call interfaces:
94982a4e 9600
7ad3c1e7 9601** The value returned by `raise' is now unspecified. It throws an exception
e1a191a8
GH
9602if an error occurs.
9603
94982a4e 9604*** A new procedure `sigaction' can be used to install signal handlers
115b09a5
GH
9605
9606(sigaction signum [action] [flags])
9607
9608signum is the signal number, which can be specified using the value
9609of SIGINT etc.
9610
9611If action is omitted, sigaction returns a pair: the CAR is the current
9612signal hander, which will be either an integer with the value SIG_DFL
9613(default action) or SIG_IGN (ignore), or the Scheme procedure which
9614handles the signal, or #f if a non-Scheme procedure handles the
9615signal. The CDR contains the current sigaction flags for the handler.
9616
9617If action is provided, it is installed as the new handler for signum.
9618action can be a Scheme procedure taking one argument, or the value of
9619SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
9620whatever signal handler was installed before sigaction was first used.
9621Flags can optionally be specified for the new handler (SA_RESTART is
9622always used if the system provides it, so need not be specified.) The
9623return value is a pair with information about the old handler as
9624described above.
9625
9626This interface does not provide access to the "signal blocking"
9627facility. Maybe this is not needed, since the thread support may
9628provide solutions to the problem of consistent access to data
9629structures.
e1a191a8 9630
94982a4e 9631*** A new procedure `flush-all-ports' is equivalent to running
89ea5b7c
GH
9632`force-output' on every port open for output.
9633
94982a4e
JB
9634** Guile now provides information on how it was built, via the new
9635global variable, %guile-build-info. This variable records the values
9636of the standard GNU makefile directory variables as an assocation
9637list, mapping variable names (symbols) onto directory paths (strings).
9638For example, to find out where the Guile link libraries were
9639installed, you can say:
9640
9641guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
9642
9643
9644* Changes to the scm_ interface
9645
9646** The new function scm_handle_by_message_noexit is just like the
9647existing scm_handle_by_message function, except that it doesn't call
9648exit to terminate the process. Instead, it prints a message and just
9649returns #f. This might be a more appropriate catch-all handler for
9650new dynamic roots and threads.
9651
cf78e9e8 9652\f
c484bf7f 9653Changes in Guile 1.1 (released Friday, May 16 1997):
f3b1485f
JB
9654
9655* Changes to the distribution.
9656
9657The Guile 1.0 distribution has been split up into several smaller
9658pieces:
9659guile-core --- the Guile interpreter itself.
9660guile-tcltk --- the interface between the Guile interpreter and
9661 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
9662 is a toolkit for building graphical user interfaces.
9663guile-rgx-ctax --- the interface between Guile and the Rx regular
9664 expression matcher, and the translator for the Ctax
9665 programming language. These are packaged together because the
9666 Ctax translator uses Rx to parse Ctax source code.
9667
095936d2
JB
9668This NEWS file describes the changes made to guile-core since the 1.0
9669release.
9670
48d224d7
JB
9671We no longer distribute the documentation, since it was either out of
9672date, or incomplete. As soon as we have current documentation, we
9673will distribute it.
9674
0fcab5ed
JB
9675
9676
f3b1485f
JB
9677* Changes to the stand-alone interpreter
9678
48d224d7
JB
9679** guile now accepts command-line arguments compatible with SCSH, Olin
9680Shivers' Scheme Shell.
9681
9682In general, arguments are evaluated from left to right, but there are
9683exceptions. The following switches stop argument processing, and
9684stash all remaining command-line arguments as the value returned by
9685the (command-line) function.
9686 -s SCRIPT load Scheme source code from FILE, and exit
9687 -c EXPR evalute Scheme expression EXPR, and exit
9688 -- stop scanning arguments; run interactively
9689
9690The switches below are processed as they are encountered.
9691 -l FILE load Scheme source code from FILE
9692 -e FUNCTION after reading script, apply FUNCTION to
9693 command line arguments
9694 -ds do -s script at this point
9695 --emacs enable Emacs protocol (experimental)
9696 -h, --help display this help and exit
9697 -v, --version display version information and exit
9698 \ read arguments from following script lines
9699
9700So, for example, here is a Guile script named `ekko' (thanks, Olin)
9701which re-implements the traditional "echo" command:
9702
9703#!/usr/local/bin/guile -s
9704!#
9705(define (main args)
9706 (map (lambda (arg) (display arg) (display " "))
9707 (cdr args))
9708 (newline))
9709
9710(main (command-line))
9711
9712Suppose we invoke this script as follows:
9713
9714 ekko a speckled gecko
9715
9716Through the magic of Unix script processing (triggered by the `#!'
9717token at the top of the file), /usr/local/bin/guile receives the
9718following list of command-line arguments:
9719
9720 ("-s" "./ekko" "a" "speckled" "gecko")
9721
9722Unix inserts the name of the script after the argument specified on
9723the first line of the file (in this case, "-s"), and then follows that
9724with the arguments given to the script. Guile loads the script, which
9725defines the `main' function, and then applies it to the list of
9726remaining command-line arguments, ("a" "speckled" "gecko").
9727
095936d2
JB
9728In Unix, the first line of a script file must take the following form:
9729
9730#!INTERPRETER ARGUMENT
9731
9732where INTERPRETER is the absolute filename of the interpreter
9733executable, and ARGUMENT is a single command-line argument to pass to
9734the interpreter.
9735
9736You may only pass one argument to the interpreter, and its length is
9737limited. These restrictions can be annoying to work around, so Guile
9738provides a general mechanism (borrowed from, and compatible with,
9739SCSH) for circumventing them.
9740
9741If the ARGUMENT in a Guile script is a single backslash character,
9742`\', Guile will open the script file, parse arguments from its second
9743and subsequent lines, and replace the `\' with them. So, for example,
9744here is another implementation of the `ekko' script:
9745
9746#!/usr/local/bin/guile \
9747-e main -s
9748!#
9749(define (main args)
9750 (for-each (lambda (arg) (display arg) (display " "))
9751 (cdr args))
9752 (newline))
9753
9754If the user invokes this script as follows:
9755
9756 ekko a speckled gecko
9757
9758Unix expands this into
9759
9760 /usr/local/bin/guile \ ekko a speckled gecko
9761
9762When Guile sees the `\' argument, it replaces it with the arguments
9763read from the second line of the script, producing:
9764
9765 /usr/local/bin/guile -e main -s ekko a speckled gecko
9766
9767This tells Guile to load the `ekko' script, and apply the function
9768`main' to the argument list ("a" "speckled" "gecko").
9769
9770Here is how Guile parses the command-line arguments:
9771- Each space character terminates an argument. This means that two
9772 spaces in a row introduce an empty-string argument.
9773- The tab character is not permitted (unless you quote it with the
9774 backslash character, as described below), to avoid confusion.
9775- The newline character terminates the sequence of arguments, and will
9776 also terminate a final non-empty argument. (However, a newline
9777 following a space will not introduce a final empty-string argument;
9778 it only terminates the argument list.)
9779- The backslash character is the escape character. It escapes
9780 backslash, space, tab, and newline. The ANSI C escape sequences
9781 like \n and \t are also supported. These produce argument
9782 constituents; the two-character combination \n doesn't act like a
9783 terminating newline. The escape sequence \NNN for exactly three
9784 octal digits reads as the character whose ASCII code is NNN. As
9785 above, characters produced this way are argument constituents.
9786 Backslash followed by other characters is not allowed.
9787
48d224d7
JB
9788* Changes to the procedure for linking libguile with your programs
9789
9790** Guile now builds and installs a shared guile library, if your
9791system support shared libraries. (It still builds a static library on
9792all systems.) Guile automatically detects whether your system
9793supports shared libraries. To prevent Guile from buildisg shared
9794libraries, pass the `--disable-shared' flag to the configure script.
9795
9796Guile takes longer to compile when it builds shared libraries, because
9797it must compile every file twice --- once to produce position-
9798independent object code, and once to produce normal object code.
9799
9800** The libthreads library has been merged into libguile.
9801
9802To link a program against Guile, you now need only link against
9803-lguile and -lqt; -lthreads is no longer needed. If you are using
9804autoconf to generate configuration scripts for your application, the
9805following lines should suffice to add the appropriate libraries to
9806your link command:
9807
9808### Find quickthreads and libguile.
9809AC_CHECK_LIB(qt, main)
9810AC_CHECK_LIB(guile, scm_shell)
f3b1485f
JB
9811
9812* Changes to Scheme functions
9813
095936d2
JB
9814** Guile Scheme's special syntax for keyword objects is now optional,
9815and disabled by default.
9816
9817The syntax variation from R4RS made it difficult to port some
9818interesting packages to Guile. The routines which accepted keyword
9819arguments (mostly in the module system) have been modified to also
9820accept symbols whose names begin with `:'.
9821
9822To change the keyword syntax, you must first import the (ice-9 debug)
9823module:
9824 (use-modules (ice-9 debug))
9825
9826Then you can enable the keyword syntax as follows:
9827 (read-set! keywords 'prefix)
9828
9829To disable keyword syntax, do this:
9830 (read-set! keywords #f)
9831
9832** Many more primitive functions accept shared substrings as
9833arguments. In the past, these functions required normal, mutable
9834strings as arguments, although they never made use of this
9835restriction.
9836
9837** The uniform array functions now operate on byte vectors. These
9838functions are `array-fill!', `serial-array-copy!', `array-copy!',
9839`serial-array-map', `array-map', `array-for-each', and
9840`array-index-map!'.
9841
9842** The new functions `trace' and `untrace' implement simple debugging
9843support for Scheme functions.
9844
9845The `trace' function accepts any number of procedures as arguments,
9846and tells the Guile interpreter to display each procedure's name and
9847arguments each time the procedure is invoked. When invoked with no
9848arguments, `trace' returns the list of procedures currently being
9849traced.
9850
9851The `untrace' function accepts any number of procedures as arguments,
9852and tells the Guile interpreter not to trace them any more. When
9853invoked with no arguments, `untrace' untraces all curretly traced
9854procedures.
9855
9856The tracing in Guile has an advantage over most other systems: we
9857don't create new procedure objects, but mark the procedure objects
9858themselves. This means that anonymous and internal procedures can be
9859traced.
9860
9861** The function `assert-repl-prompt' has been renamed to
9862`set-repl-prompt!'. It takes one argument, PROMPT.
9863- If PROMPT is #f, the Guile read-eval-print loop will not prompt.
9864- If PROMPT is a string, we use it as a prompt.
9865- If PROMPT is a procedure accepting no arguments, we call it, and
9866 display the result as a prompt.
9867- Otherwise, we display "> ".
9868
9869** The new function `eval-string' reads Scheme expressions from a
9870string and evaluates them, returning the value of the last expression
9871in the string. If the string contains no expressions, it returns an
9872unspecified value.
9873
9874** The new function `thunk?' returns true iff its argument is a
9875procedure of zero arguments.
9876
9877** `defined?' is now a builtin function, instead of syntax. This
9878means that its argument should be quoted. It returns #t iff its
9879argument is bound in the current module.
9880
9881** The new syntax `use-modules' allows you to add new modules to your
9882environment without re-typing a complete `define-module' form. It
9883accepts any number of module names as arguments, and imports their
9884public bindings into the current module.
9885
9886** The new function (module-defined? NAME MODULE) returns true iff
9887NAME, a symbol, is defined in MODULE, a module object.
9888
9889** The new function `builtin-bindings' creates and returns a hash
9890table containing copies of all the root module's bindings.
9891
9892** The new function `builtin-weak-bindings' does the same as
9893`builtin-bindings', but creates a doubly-weak hash table.
9894
9895** The `equal?' function now considers variable objects to be
9896equivalent if they have the same name and the same value.
9897
9898** The new function `command-line' returns the command-line arguments
9899given to Guile, as a list of strings.
9900
9901When using guile as a script interpreter, `command-line' returns the
9902script's arguments; those processed by the interpreter (like `-s' or
9903`-c') are omitted. (In other words, you get the normal, expected
9904behavior.) Any application that uses scm_shell to process its
9905command-line arguments gets this behavior as well.
9906
9907** The new function `load-user-init' looks for a file called `.guile'
9908in the user's home directory, and loads it if it exists. This is
9909mostly for use by the code generated by scm_compile_shell_switches,
9910but we thought it might also be useful in other circumstances.
9911
9912** The new function `log10' returns the base-10 logarithm of its
9913argument.
9914
9915** Changes to I/O functions
9916
6c0201ad 9917*** The functions `read', `primitive-load', `read-and-eval!', and
095936d2
JB
9918`primitive-load-path' no longer take optional arguments controlling
9919case insensitivity and a `#' parser.
9920
9921Case sensitivity is now controlled by a read option called
9922`case-insensitive'. The user can add new `#' syntaxes with the
9923`read-hash-extend' function (see below).
9924
9925*** The new function `read-hash-extend' allows the user to change the
9926syntax of Guile Scheme in a somewhat controlled way.
9927
9928(read-hash-extend CHAR PROC)
9929 When parsing S-expressions, if we read a `#' character followed by
9930 the character CHAR, use PROC to parse an object from the stream.
9931 If PROC is #f, remove any parsing procedure registered for CHAR.
9932
9933 The reader applies PROC to two arguments: CHAR and an input port.
9934
6c0201ad 9935*** The new functions read-delimited and read-delimited! provide a
095936d2
JB
9936general mechanism for doing delimited input on streams.
9937
9938(read-delimited DELIMS [PORT HANDLE-DELIM])
9939 Read until we encounter one of the characters in DELIMS (a string),
9940 or end-of-file. PORT is the input port to read from; it defaults to
9941 the current input port. The HANDLE-DELIM parameter determines how
9942 the terminating character is handled; it should be one of the
9943 following symbols:
9944
9945 'trim omit delimiter from result
9946 'peek leave delimiter character in input stream
9947 'concat append delimiter character to returned value
9948 'split return a pair: (RESULT . TERMINATOR)
9949
9950 HANDLE-DELIM defaults to 'peek.
9951
9952(read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
9953 A side-effecting variant of `read-delimited'.
9954
9955 The data is written into the string BUF at the indices in the
9956 half-open interval [START, END); the default interval is the whole
9957 string: START = 0 and END = (string-length BUF). The values of
9958 START and END must specify a well-defined interval in BUF, i.e.
9959 0 <= START <= END <= (string-length BUF).
9960
9961 It returns NBYTES, the number of bytes read. If the buffer filled
9962 up without a delimiter character being found, it returns #f. If the
9963 port is at EOF when the read starts, it returns the EOF object.
9964
9965 If an integer is returned (i.e., the read is successfully terminated
9966 by reading a delimiter character), then the HANDLE-DELIM parameter
9967 determines how to handle the terminating character. It is described
9968 above, and defaults to 'peek.
9969
9970(The descriptions of these functions were borrowed from the SCSH
9971manual, by Olin Shivers and Brian Carlstrom.)
9972
9973*** The `%read-delimited!' function is the primitive used to implement
9974`read-delimited' and `read-delimited!'.
9975
9976(%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
9977
9978This returns a pair of values: (TERMINATOR . NUM-READ).
9979- TERMINATOR describes why the read was terminated. If it is a
9980 character or the eof object, then that is the value that terminated
9981 the read. If it is #f, the function filled the buffer without finding
9982 a delimiting character.
9983- NUM-READ is the number of characters read into BUF.
9984
9985If the read is successfully terminated by reading a delimiter
9986character, then the gobble? parameter determines what to do with the
9987terminating character. If true, the character is removed from the
9988input stream; if false, the character is left in the input stream
9989where a subsequent read operation will retrieve it. In either case,
9990the character is also the first value returned by the procedure call.
9991
9992(The descriptions of this function was borrowed from the SCSH manual,
9993by Olin Shivers and Brian Carlstrom.)
9994
9995*** The `read-line' and `read-line!' functions have changed; they now
9996trim the terminator by default; previously they appended it to the
9997returned string. For the old behavior, use (read-line PORT 'concat).
9998
9999*** The functions `uniform-array-read!' and `uniform-array-write!' now
10000take new optional START and END arguments, specifying the region of
10001the array to read and write.
10002
f348c807
JB
10003*** The `ungetc-char-ready?' function has been removed. We feel it's
10004inappropriate for an interface to expose implementation details this
10005way.
095936d2
JB
10006
10007** Changes to the Unix library and system call interface
10008
10009*** The new fcntl function provides access to the Unix `fcntl' system
10010call.
10011
10012(fcntl PORT COMMAND VALUE)
10013 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
10014 Values for COMMAND are:
10015
10016 F_DUPFD duplicate a file descriptor
10017 F_GETFD read the descriptor's close-on-exec flag
10018 F_SETFD set the descriptor's close-on-exec flag to VALUE
10019 F_GETFL read the descriptor's flags, as set on open
10020 F_SETFL set the descriptor's flags, as set on open to VALUE
10021 F_GETOWN return the process ID of a socket's owner, for SIGIO
10022 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
10023 FD_CLOEXEC not sure what this is
10024
10025For details, see the documentation for the fcntl system call.
10026
10027*** The arguments to `select' have changed, for compatibility with
10028SCSH. The TIMEOUT parameter may now be non-integral, yielding the
10029expected behavior. The MILLISECONDS parameter has been changed to
10030MICROSECONDS, to more closely resemble the underlying system call.
10031The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
10032corresponding return set will be the same.
10033
10034*** The arguments to the `mknod' system call have changed. They are
10035now:
10036
10037(mknod PATH TYPE PERMS DEV)
10038 Create a new file (`node') in the file system. PATH is the name of
10039 the file to create. TYPE is the kind of file to create; it should
10040 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
10041 permission bits to give the newly created file. If TYPE is
10042 'block-special or 'char-special, DEV specifies which device the
10043 special file refers to; its interpretation depends on the kind of
10044 special file being created.
10045
10046*** The `fork' function has been renamed to `primitive-fork', to avoid
10047clashing with various SCSH forks.
10048
10049*** The `recv' and `recvfrom' functions have been renamed to `recv!'
10050and `recvfrom!'. They no longer accept a size for a second argument;
10051you must pass a string to hold the received value. They no longer
10052return the buffer. Instead, `recv' returns the length of the message
10053received, and `recvfrom' returns a pair containing the packet's length
6c0201ad 10054and originating address.
095936d2
JB
10055
10056*** The file descriptor datatype has been removed, as have the
10057`read-fd', `write-fd', `close', `lseek', and `dup' functions.
10058We plan to replace these functions with a SCSH-compatible interface.
10059
10060*** The `create' function has been removed; it's just a special case
10061of `open'.
10062
10063*** There are new functions to break down process termination status
10064values. In the descriptions below, STATUS is a value returned by
10065`waitpid'.
10066
10067(status:exit-val STATUS)
10068 If the child process exited normally, this function returns the exit
10069 code for the child process (i.e., the value passed to exit, or
10070 returned from main). If the child process did not exit normally,
10071 this function returns #f.
10072
10073(status:stop-sig STATUS)
10074 If the child process was suspended by a signal, this function
10075 returns the signal that suspended the child. Otherwise, it returns
10076 #f.
10077
10078(status:term-sig STATUS)
10079 If the child process terminated abnormally, this function returns
10080 the signal that terminated the child. Otherwise, this function
10081 returns false.
10082
10083POSIX promises that exactly one of these functions will return true on
10084a valid STATUS value.
10085
10086These functions are compatible with SCSH.
10087
10088*** There are new accessors and setters for the broken-out time vectors
48d224d7
JB
10089returned by `localtime', `gmtime', and that ilk. They are:
10090
10091 Component Accessor Setter
10092 ========================= ============ ============
10093 seconds tm:sec set-tm:sec
10094 minutes tm:min set-tm:min
10095 hours tm:hour set-tm:hour
10096 day of the month tm:mday set-tm:mday
10097 month tm:mon set-tm:mon
10098 year tm:year set-tm:year
10099 day of the week tm:wday set-tm:wday
10100 day in the year tm:yday set-tm:yday
10101 daylight saving time tm:isdst set-tm:isdst
10102 GMT offset, seconds tm:gmtoff set-tm:gmtoff
10103 name of time zone tm:zone set-tm:zone
10104
095936d2
JB
10105*** There are new accessors for the vectors returned by `uname',
10106describing the host system:
48d224d7
JB
10107
10108 Component Accessor
10109 ============================================== ================
10110 name of the operating system implementation utsname:sysname
10111 network name of this machine utsname:nodename
10112 release level of the operating system utsname:release
10113 version level of the operating system utsname:version
10114 machine hardware platform utsname:machine
10115
095936d2
JB
10116*** There are new accessors for the vectors returned by `getpw',
10117`getpwnam', `getpwuid', and `getpwent', describing entries from the
10118system's user database:
10119
10120 Component Accessor
10121 ====================== =================
10122 user name passwd:name
10123 user password passwd:passwd
10124 user id passwd:uid
10125 group id passwd:gid
10126 real name passwd:gecos
10127 home directory passwd:dir
10128 shell program passwd:shell
10129
10130*** There are new accessors for the vectors returned by `getgr',
10131`getgrnam', `getgrgid', and `getgrent', describing entries from the
10132system's group database:
10133
10134 Component Accessor
10135 ======================= ============
10136 group name group:name
10137 group password group:passwd
10138 group id group:gid
10139 group members group:mem
10140
10141*** There are new accessors for the vectors returned by `gethost',
10142`gethostbyaddr', `gethostbyname', and `gethostent', describing
10143internet hosts:
10144
10145 Component Accessor
10146 ========================= ===============
10147 official name of host hostent:name
10148 alias list hostent:aliases
10149 host address type hostent:addrtype
10150 length of address hostent:length
10151 list of addresses hostent:addr-list
10152
10153*** There are new accessors for the vectors returned by `getnet',
10154`getnetbyaddr', `getnetbyname', and `getnetent', describing internet
10155networks:
10156
10157 Component Accessor
10158 ========================= ===============
10159 official name of net netent:name
10160 alias list netent:aliases
10161 net number type netent:addrtype
10162 net number netent:net
10163
10164*** There are new accessors for the vectors returned by `getproto',
10165`getprotobyname', `getprotobynumber', and `getprotoent', describing
10166internet protocols:
10167
10168 Component Accessor
10169 ========================= ===============
10170 official protocol name protoent:name
10171 alias list protoent:aliases
10172 protocol number protoent:proto
10173
10174*** There are new accessors for the vectors returned by `getserv',
10175`getservbyname', `getservbyport', and `getservent', describing
10176internet protocols:
10177
10178 Component Accessor
10179 ========================= ===============
6c0201ad 10180 official service name servent:name
095936d2 10181 alias list servent:aliases
6c0201ad
TTN
10182 port number servent:port
10183 protocol to use servent:proto
095936d2
JB
10184
10185*** There are new accessors for the sockaddr structures returned by
10186`accept', `getsockname', `getpeername', `recvfrom!':
10187
10188 Component Accessor
10189 ======================================== ===============
6c0201ad 10190 address format (`family') sockaddr:fam
095936d2
JB
10191 path, for file domain addresses sockaddr:path
10192 address, for internet domain addresses sockaddr:addr
10193 TCP or UDP port, for internet sockaddr:port
10194
10195*** The `getpwent', `getgrent', `gethostent', `getnetent',
10196`getprotoent', and `getservent' functions now return #f at the end of
10197the user database. (They used to throw an exception.)
10198
10199Note that calling MUMBLEent function is equivalent to calling the
10200corresponding MUMBLE function with no arguments.
10201
10202*** The `setpwent', `setgrent', `sethostent', `setnetent',
10203`setprotoent', and `setservent' routines now take no arguments.
10204
10205*** The `gethost', `getproto', `getnet', and `getserv' functions now
10206provide more useful information when they throw an exception.
10207
10208*** The `lnaof' function has been renamed to `inet-lnaof'.
10209
10210*** Guile now claims to have the `current-time' feature.
10211
10212*** The `mktime' function now takes an optional second argument ZONE,
10213giving the time zone to use for the conversion. ZONE should be a
10214string, in the same format as expected for the "TZ" environment variable.
10215
10216*** The `strptime' function now returns a pair (TIME . COUNT), where
10217TIME is the parsed time as a vector, and COUNT is the number of
10218characters from the string left unparsed. This function used to
10219return the remaining characters as a string.
10220
10221*** The `gettimeofday' function has replaced the old `time+ticks' function.
10222The return value is now (SECONDS . MICROSECONDS); the fractional
10223component is no longer expressed in "ticks".
10224
10225*** The `ticks/sec' constant has been removed, in light of the above change.
6685dc83 10226
ea00ecba
MG
10227* Changes to the gh_ interface
10228
10229** gh_eval_str() now returns an SCM object which is the result of the
10230evaluation
10231
aaef0d2a
MG
10232** gh_scm2str() now copies the Scheme data to a caller-provided C
10233array
10234
10235** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
10236and returns the array
10237
10238** gh_scm2str0() is gone: there is no need to distinguish
10239null-terminated from non-null-terminated, since gh_scm2newstr() allows
10240the user to interpret the data both ways.
10241
f3b1485f
JB
10242* Changes to the scm_ interface
10243
095936d2
JB
10244** The new function scm_symbol_value0 provides an easy way to get a
10245symbol's value from C code:
10246
10247SCM scm_symbol_value0 (char *NAME)
10248 Return the value of the symbol named by the null-terminated string
10249 NAME in the current module. If the symbol named NAME is unbound in
10250 the current module, return SCM_UNDEFINED.
10251
10252** The new function scm_sysintern0 creates new top-level variables,
10253without assigning them a value.
10254
10255SCM scm_sysintern0 (char *NAME)
10256 Create a new Scheme top-level variable named NAME. NAME is a
10257 null-terminated string. Return the variable's value cell.
10258
10259** The function scm_internal_catch is the guts of catch. It handles
10260all the mechanics of setting up a catch target, invoking the catch
10261body, and perhaps invoking the handler if the body does a throw.
10262
10263The function is designed to be usable from C code, but is general
10264enough to implement all the semantics Guile Scheme expects from throw.
10265
10266TAG is the catch tag. Typically, this is a symbol, but this function
10267doesn't actually care about that.
10268
10269BODY is a pointer to a C function which runs the body of the catch;
10270this is the code you can throw from. We call it like this:
10271 BODY (BODY_DATA, JMPBUF)
10272where:
10273 BODY_DATA is just the BODY_DATA argument we received; we pass it
10274 through to BODY as its first argument. The caller can make
10275 BODY_DATA point to anything useful that BODY might need.
10276 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
10277 which we have just created and initialized.
10278
10279HANDLER is a pointer to a C function to deal with a throw to TAG,
10280should one occur. We call it like this:
10281 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
10282where
10283 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
10284 same idea as BODY_DATA above.
10285 THROWN_TAG is the tag that the user threw to; usually this is
10286 TAG, but it could be something else if TAG was #t (i.e., a
10287 catch-all), or the user threw to a jmpbuf.
10288 THROW_ARGS is the list of arguments the user passed to the THROW
10289 function.
10290
10291BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
10292is just a pointer we pass through to HANDLER. We don't actually
10293use either of those pointers otherwise ourselves. The idea is
10294that, if our caller wants to communicate something to BODY or
10295HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
10296HANDLER can then use. Think of it as a way to make BODY and
10297HANDLER closures, not just functions; MUMBLE_DATA points to the
10298enclosed variables.
10299
10300Of course, it's up to the caller to make sure that any data a
10301MUMBLE_DATA needs is protected from GC. A common way to do this is
10302to make MUMBLE_DATA a pointer to data stored in an automatic
10303structure variable; since the collector must scan the stack for
10304references anyway, this assures that any references in MUMBLE_DATA
10305will be found.
10306
10307** The new function scm_internal_lazy_catch is exactly like
10308scm_internal_catch, except:
10309
10310- It does not unwind the stack (this is the major difference).
10311- If handler returns, its value is returned from the throw.
10312- BODY always receives #f as its JMPBUF argument (since there's no
10313 jmpbuf associated with a lazy catch, because we don't unwind the
10314 stack.)
10315
10316** scm_body_thunk is a new body function you can pass to
10317scm_internal_catch if you want the body to be like Scheme's `catch'
10318--- a thunk, or a function of one argument if the tag is #f.
10319
10320BODY_DATA is a pointer to a scm_body_thunk_data structure, which
10321contains the Scheme procedure to invoke as the body, and the tag
10322we're catching. If the tag is #f, then we pass JMPBUF (created by
10323scm_internal_catch) to the body procedure; otherwise, the body gets
10324no arguments.
10325
10326** scm_handle_by_proc is a new handler function you can pass to
10327scm_internal_catch if you want the handler to act like Scheme's catch
10328--- call a procedure with the tag and the throw arguments.
10329
10330If the user does a throw to this catch, this function runs a handler
10331procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
10332variable holding the Scheme procedure object to invoke. It ought to
10333be a pointer to an automatic variable (i.e., one living on the stack),
10334or the procedure object should be otherwise protected from GC.
10335
10336** scm_handle_by_message is a new handler function to use with
10337`scm_internal_catch' if you want Guile to print a message and die.
10338It's useful for dealing with throws to uncaught keys at the top level.
10339
10340HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
10341message header to print; if zero, we use "guile" instead. That
10342text is followed by a colon, then the message described by ARGS.
10343
10344** The return type of scm_boot_guile is now void; the function does
10345not return a value, and indeed, never returns at all.
10346
f3b1485f
JB
10347** The new function scm_shell makes it easy for user applications to
10348process command-line arguments in a way that is compatible with the
10349stand-alone guile interpreter (which is in turn compatible with SCSH,
10350the Scheme shell).
10351
10352To use the scm_shell function, first initialize any guile modules
10353linked into your application, and then call scm_shell with the values
7ed46dc8 10354of ARGC and ARGV your `main' function received. scm_shell will add
f3b1485f
JB
10355any SCSH-style meta-arguments from the top of the script file to the
10356argument vector, and then process the command-line arguments. This
10357generally means loading a script file or starting up an interactive
10358command interpreter. For details, see "Changes to the stand-alone
10359interpreter" above.
10360
095936d2 10361** The new functions scm_get_meta_args and scm_count_argv help you
6c0201ad 10362implement the SCSH-style meta-argument, `\'.
095936d2
JB
10363
10364char **scm_get_meta_args (int ARGC, char **ARGV)
10365 If the second element of ARGV is a string consisting of a single
10366 backslash character (i.e. "\\" in Scheme notation), open the file
10367 named by the following argument, parse arguments from it, and return
10368 the spliced command line. The returned array is terminated by a
10369 null pointer.
6c0201ad 10370
095936d2
JB
10371 For details of argument parsing, see above, under "guile now accepts
10372 command-line arguments compatible with SCSH..."
10373
10374int scm_count_argv (char **ARGV)
10375 Count the arguments in ARGV, assuming it is terminated by a null
10376 pointer.
10377
10378For an example of how these functions might be used, see the source
10379code for the function scm_shell in libguile/script.c.
10380
10381You will usually want to use scm_shell instead of calling this
10382function yourself.
10383
10384** The new function scm_compile_shell_switches turns an array of
10385command-line arguments into Scheme code to carry out the actions they
10386describe. Given ARGC and ARGV, it returns a Scheme expression to
10387evaluate, and calls scm_set_program_arguments to make any remaining
10388command-line arguments available to the Scheme code. For example,
10389given the following arguments:
10390
10391 -e main -s ekko a speckled gecko
10392
10393scm_set_program_arguments will return the following expression:
10394
10395 (begin (load "ekko") (main (command-line)) (quit))
10396
10397You will usually want to use scm_shell instead of calling this
10398function yourself.
10399
10400** The function scm_shell_usage prints a usage message appropriate for
10401an interpreter that uses scm_compile_shell_switches to handle its
10402command-line arguments.
10403
10404void scm_shell_usage (int FATAL, char *MESSAGE)
10405 Print a usage message to the standard error output. If MESSAGE is
10406 non-zero, write it before the usage message, followed by a newline.
10407 If FATAL is non-zero, exit the process, using FATAL as the
10408 termination status. (If you want to be compatible with Guile,
10409 always use 1 as the exit status when terminating due to command-line
10410 usage problems.)
10411
10412You will usually want to use scm_shell instead of calling this
10413function yourself.
48d224d7
JB
10414
10415** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
095936d2
JB
10416expressions. It used to return SCM_EOL. Earth-shattering.
10417
10418** The macros for declaring scheme objects in C code have been
10419rearranged slightly. They are now:
10420
10421SCM_SYMBOL (C_NAME, SCHEME_NAME)
10422 Declare a static SCM variable named C_NAME, and initialize it to
10423 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
10424 be a C identifier, and SCHEME_NAME should be a C string.
10425
10426SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
10427 Just like SCM_SYMBOL, but make C_NAME globally visible.
10428
10429SCM_VCELL (C_NAME, SCHEME_NAME)
10430 Create a global variable at the Scheme level named SCHEME_NAME.
10431 Declare a static SCM variable named C_NAME, and initialize it to
10432 point to the Scheme variable's value cell.
10433
10434SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
10435 Just like SCM_VCELL, but make C_NAME globally visible.
10436
10437The `guile-snarf' script writes initialization code for these macros
10438to its standard output, given C source code as input.
10439
10440The SCM_GLOBAL macro is gone.
10441
10442** The scm_read_line and scm_read_line_x functions have been replaced
10443by Scheme code based on the %read-delimited! procedure (known to C
10444code as scm_read_delimited_x). See its description above for more
10445information.
48d224d7 10446
095936d2
JB
10447** The function scm_sys_open has been renamed to scm_open. It now
10448returns a port instead of an FD object.
ea00ecba 10449
095936d2
JB
10450* The dynamic linking support has changed. For more information, see
10451libguile/DYNAMIC-LINKING.
ea00ecba 10452
f7b47737
JB
10453\f
10454Guile 1.0b3
3065a62a 10455
f3b1485f
JB
10456User-visible changes from Thursday, September 5, 1996 until Guile 1.0
10457(Sun 5 Jan 1997):
3065a62a 10458
4b521edb 10459* Changes to the 'guile' program:
3065a62a 10460
4b521edb
JB
10461** Guile now loads some new files when it starts up. Guile first
10462searches the load path for init.scm, and loads it if found. Then, if
10463Guile is not being used to execute a script, and the user's home
10464directory contains a file named `.guile', Guile loads that.
c6486f8a 10465
4b521edb 10466** You can now use Guile as a shell script interpreter.
3065a62a
JB
10467
10468To paraphrase the SCSH manual:
10469
10470 When Unix tries to execute an executable file whose first two
10471 characters are the `#!', it treats the file not as machine code to
10472 be directly executed by the native processor, but as source code
10473 to be executed by some interpreter. The interpreter to use is
10474 specified immediately after the #! sequence on the first line of
10475 the source file. The kernel reads in the name of the interpreter,
10476 and executes that instead. It passes the interpreter the source
10477 filename as its first argument, with the original arguments
10478 following. Consult the Unix man page for the `exec' system call
10479 for more information.
10480
1a1945be
JB
10481Now you can use Guile as an interpreter, using a mechanism which is a
10482compatible subset of that provided by SCSH.
10483
3065a62a
JB
10484Guile now recognizes a '-s' command line switch, whose argument is the
10485name of a file of Scheme code to load. It also treats the two
10486characters `#!' as the start of a comment, terminated by `!#'. Thus,
10487to make a file of Scheme code directly executable by Unix, insert the
10488following two lines at the top of the file:
10489
10490#!/usr/local/bin/guile -s
10491!#
10492
10493Guile treats the argument of the `-s' command-line switch as the name
10494of a file of Scheme code to load, and treats the sequence `#!' as the
10495start of a block comment, terminated by `!#'.
10496
10497For example, here's a version of 'echo' written in Scheme:
10498
10499#!/usr/local/bin/guile -s
10500!#
10501(let loop ((args (cdr (program-arguments))))
10502 (if (pair? args)
10503 (begin
10504 (display (car args))
10505 (if (pair? (cdr args))
10506 (display " "))
10507 (loop (cdr args)))))
10508(newline)
10509
10510Why does `#!' start a block comment terminated by `!#', instead of the
10511end of the line? That is the notation SCSH uses, and although we
10512don't yet support the other SCSH features that motivate that choice,
10513we would like to be backward-compatible with any existing Guile
3763761c
JB
10514scripts once we do. Furthermore, if the path to Guile on your system
10515is too long for your kernel, you can start the script with this
10516horrible hack:
10517
10518#!/bin/sh
10519exec /really/long/path/to/guile -s "$0" ${1+"$@"}
10520!#
3065a62a
JB
10521
10522Note that some very old Unix systems don't support the `#!' syntax.
10523
c6486f8a 10524
4b521edb 10525** You can now run Guile without installing it.
6685dc83
JB
10526
10527Previous versions of the interactive Guile interpreter (`guile')
10528couldn't start up unless Guile's Scheme library had been installed;
10529they used the value of the environment variable `SCHEME_LOAD_PATH'
10530later on in the startup process, but not to find the startup code
10531itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
10532code.
10533
10534To run Guile without installing it, build it in the normal way, and
10535then set the environment variable `SCHEME_LOAD_PATH' to a
10536colon-separated list of directories, including the top-level directory
10537of the Guile sources. For example, if you unpacked Guile so that the
10538full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
10539you might say
10540
10541 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
10542
c6486f8a 10543
4b521edb
JB
10544** Guile's read-eval-print loop no longer prints #<unspecified>
10545results. If the user wants to see this, she can evaluate the
10546expression (assert-repl-print-unspecified #t), perhaps in her startup
48d224d7 10547file.
6685dc83 10548
4b521edb
JB
10549** Guile no longer shows backtraces by default when an error occurs;
10550however, it does display a message saying how to get one, and how to
10551request that they be displayed by default. After an error, evaluate
10552 (backtrace)
10553to see a backtrace, and
10554 (debug-enable 'backtrace)
10555to see them by default.
6685dc83 10556
6685dc83 10557
d9fb83d9 10558
4b521edb
JB
10559* Changes to Guile Scheme:
10560
10561** Guile now distinguishes between #f and the empty list.
10562
10563This is for compatibility with the IEEE standard, the (possibly)
10564upcoming Revised^5 Report on Scheme, and many extant Scheme
10565implementations.
10566
10567Guile used to have #f and '() denote the same object, to make Scheme's
10568type system more compatible with Emacs Lisp's. However, the change
10569caused too much trouble for Scheme programmers, and we found another
10570way to reconcile Emacs Lisp with Scheme that didn't require this.
10571
10572
10573** Guile's delq, delv, delete functions, and their destructive
c6486f8a
JB
10574counterparts, delq!, delv!, and delete!, now remove all matching
10575elements from the list, not just the first. This matches the behavior
10576of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
10577functions which inspired them.
10578
10579I recognize that this change may break code in subtle ways, but it
10580seems best to make the change before the FSF's first Guile release,
10581rather than after.
10582
10583
4b521edb 10584** The compiled-library-path function has been deleted from libguile.
6685dc83 10585
4b521edb 10586** The facilities for loading Scheme source files have changed.
c6486f8a 10587
4b521edb 10588*** The variable %load-path now tells Guile which directories to search
6685dc83
JB
10589for Scheme code. Its value is a list of strings, each of which names
10590a directory.
10591
4b521edb
JB
10592*** The variable %load-extensions now tells Guile which extensions to
10593try appending to a filename when searching the load path. Its value
10594is a list of strings. Its default value is ("" ".scm").
10595
10596*** (%search-load-path FILENAME) searches the directories listed in the
10597value of the %load-path variable for a Scheme file named FILENAME,
10598with all the extensions listed in %load-extensions. If it finds a
10599match, then it returns its full filename. If FILENAME is absolute, it
10600returns it unchanged. Otherwise, it returns #f.
6685dc83 10601
4b521edb
JB
10602%search-load-path will not return matches that refer to directories.
10603
10604*** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
10605uses %seach-load-path to find a file named FILENAME, and loads it if
10606it finds it. If it can't read FILENAME for any reason, it throws an
10607error.
6685dc83
JB
10608
10609The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4b521edb
JB
10610`read' function.
10611
10612*** load uses the same searching semantics as primitive-load.
10613
10614*** The functions %try-load, try-load-with-path, %load, load-with-path,
10615basic-try-load-with-path, basic-load-with-path, try-load-module-with-
10616path, and load-module-with-path have been deleted. The functions
10617above should serve their purposes.
10618
10619*** If the value of the variable %load-hook is a procedure,
10620`primitive-load' applies its value to the name of the file being
10621loaded (without the load path directory name prepended). If its value
10622is #f, it is ignored. Otherwise, an error occurs.
10623
10624This is mostly useful for printing load notification messages.
10625
10626
10627** The function `eval!' is no longer accessible from the scheme level.
10628We can't allow operations which introduce glocs into the scheme level,
10629because Guile's type system can't handle these as data. Use `eval' or
10630`read-and-eval!' (see below) as replacement.
10631
10632** The new function read-and-eval! reads an expression from PORT,
10633evaluates it, and returns the result. This is more efficient than
10634simply calling `read' and `eval', since it is not necessary to make a
10635copy of the expression for the evaluator to munge.
10636
10637Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
10638for the `read' function.
10639
10640
10641** The function `int?' has been removed; its definition was identical
10642to that of `integer?'.
10643
10644** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
10645use the R4RS names for these functions.
10646
10647** The function object-properties no longer returns the hash handle;
10648it simply returns the object's property list.
10649
10650** Many functions have been changed to throw errors, instead of
10651returning #f on failure. The point of providing exception handling in
10652the language is to simplify the logic of user code, but this is less
10653useful if Guile's primitives don't throw exceptions.
10654
10655** The function `fileno' has been renamed from `%fileno'.
10656
10657** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
10658
10659
10660* Changes to Guile's C interface:
10661
10662** The library's initialization procedure has been simplified.
10663scm_boot_guile now has the prototype:
10664
10665void scm_boot_guile (int ARGC,
10666 char **ARGV,
10667 void (*main_func) (),
10668 void *closure);
10669
10670scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
10671MAIN_FUNC should do all the work of the program (initializing other
10672packages, reading user input, etc.) before returning. When MAIN_FUNC
10673returns, call exit (0); this function never returns. If you want some
10674other exit value, MAIN_FUNC may call exit itself.
10675
10676scm_boot_guile arranges for program-arguments to return the strings
10677given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
10678scm_set_program_arguments with the final list, so Scheme code will
10679know which arguments have been processed.
10680
10681scm_boot_guile establishes a catch-all catch handler which prints an
10682error message and exits the process. This means that Guile exits in a
10683coherent way when system errors occur and the user isn't prepared to
10684handle it. If the user doesn't like this behavior, they can establish
10685their own universal catcher in MAIN_FUNC to shadow this one.
10686
10687Why must the caller do all the real work from MAIN_FUNC? The garbage
10688collector assumes that all local variables of type SCM will be above
10689scm_boot_guile's stack frame on the stack. If you try to manipulate
10690SCM values after this function returns, it's the luck of the draw
10691whether the GC will be able to find the objects you allocate. So,
10692scm_boot_guile function exits, rather than returning, to discourage
10693people from making that mistake.
10694
10695The IN, OUT, and ERR arguments were removed; there are other
10696convenient ways to override these when desired.
10697
10698The RESULT argument was deleted; this function should never return.
10699
10700The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
10701general.
10702
10703
10704** Guile's header files should no longer conflict with your system's
10705header files.
10706
10707In order to compile code which #included <libguile.h>, previous
10708versions of Guile required you to add a directory containing all the
10709Guile header files to your #include path. This was a problem, since
10710Guile's header files have names which conflict with many systems'
10711header files.
10712
10713Now only <libguile.h> need appear in your #include path; you must
10714refer to all Guile's other header files as <libguile/mumble.h>.
10715Guile's installation procedure puts libguile.h in $(includedir), and
10716the rest in $(includedir)/libguile.
10717
10718
10719** Two new C functions, scm_protect_object and scm_unprotect_object,
10720have been added to the Guile library.
10721
10722scm_protect_object (OBJ) protects OBJ from the garbage collector.
10723OBJ will not be freed, even if all other references are dropped,
10724until someone does scm_unprotect_object (OBJ). Both functions
10725return OBJ.
10726
10727Note that calls to scm_protect_object do not nest. You can call
10728scm_protect_object any number of times on a given object, and the
10729next call to scm_unprotect_object will unprotect it completely.
10730
10731Basically, scm_protect_object and scm_unprotect_object just
10732maintain a list of references to things. Since the GC knows about
10733this list, all objects it mentions stay alive. scm_protect_object
10734adds its argument to the list; scm_unprotect_object remove its
10735argument from the list.
10736
10737
10738** scm_eval_0str now returns the value of the last expression
10739evaluated.
10740
10741** The new function scm_read_0str reads an s-expression from a
10742null-terminated string, and returns it.
10743
10744** The new function `scm_stdio_to_port' converts a STDIO file pointer
10745to a Scheme port object.
10746
10747** The new function `scm_set_program_arguments' allows C code to set
e80c8fea 10748the value returned by the Scheme `program-arguments' function.
6685dc83 10749
6685dc83 10750\f
1a1945be
JB
10751Older changes:
10752
10753* Guile no longer includes sophisticated Tcl/Tk support.
10754
10755The old Tcl/Tk support was unsatisfying to us, because it required the
10756user to link against the Tcl library, as well as Tk and Guile. The
10757interface was also un-lispy, in that it preserved Tcl/Tk's practice of
10758referring to widgets by names, rather than exporting widgets to Scheme
10759code as a special datatype.
10760
10761In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
10762maintainers described some very interesting changes in progress to the
10763Tcl/Tk internals, which would facilitate clean interfaces between lone
10764Tk and other interpreters --- even for garbage-collected languages
10765like Scheme. They expected the new Tk to be publicly available in the
10766fall of 1996.
10767
10768Since it seems that Guile might soon have a new, cleaner interface to
10769lone Tk, and that the old Guile/Tk glue code would probably need to be
10770completely rewritten, we (Jim Blandy and Richard Stallman) have
10771decided not to support the old code. We'll spend the time instead on
10772a good interface to the newer Tk, as soon as it is available.
5c54da76 10773
8512dea6 10774Until then, gtcltk-lib provides trivial, low-maintenance functionality.
deb95d71 10775
5c54da76
JB
10776\f
10777Copyright information:
10778
4f416616 10779Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
5c54da76
JB
10780
10781 Permission is granted to anyone to make or distribute verbatim copies
10782 of this document as received, in any medium, provided that the
10783 copyright notice and this permission notice are preserved,
10784 thus giving the recipient permission to redistribute in turn.
10785
10786 Permission is granted to distribute modified versions
10787 of this document, or of portions of it,
10788 under the above conditions, provided also that they
10789 carry prominent notices stating who last changed them.
10790
48d224d7
JB
10791\f
10792Local variables:
10793mode: outline
10794paragraph-separate: "[ \f]*$"
10795end: