Update NEWS.
[bpt/guile.git] / NEWS
CommitLineData
b2cbe8d8 1Guile NEWS --- history of user-visible changes.
cdf1ae89 2Copyright (C) 1996-2014 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
cdf1ae89
MW
8Changes in 2.0.10 (since 2.0.9):
9
10[XXX This is a work-in-progress!! Search for "XXX" for things to fix.
11Reorganization would also be helpful.]
12
13* Notable changes
14
15** New GDB extension to support Guile
16
c68b9470
LC
17Guile now comes with an extension for GDB 7.8 or later (unreleased at
18the time of writing) that simplifies debugging of C code that uses
19Guile. See "GDB Support" in the manual.
cdf1ae89
MW
20
21** Improved integration between R6RS and native Guile exceptions
22
23R6RS exception handlers, established using 'with-exception-handler' or
24'guard', are now able to catch native Guile exceptions, which are
25automatically converted into appropriate R6RS condition objects.
26
27** Support for HTTP proxies
28
29Guile's built-in web client now honors the 'http_proxy' environment
30variable, as well as the new 'current-http-proxy' parameter. See
31"Web Client" in the manual for details.
32
33** Lexical syntax improvements
34
35*** Support |...| symbol notation.
36
37Guile's core reader and printer now support the R7RS |...| notation
38for writing symbols with arbitrary characters, as a more portable and
39attractive alternative to Guile's native #{...}# notation. To enable
40this notation by default, put one or both of the following in your
41~/.guile:
42
43 (read-enable 'r7rs-symbols)
44 (print-enable 'r7rs-symbols)
45
46*** Support '#true' and '#false' notation for booleans.
47
48The booleans '#t' and '#f' may now be written as '#true' and '#false'
49for improved readability, per R7RS.
50
51*** Recognize '#\escape' character name.
52
53The escape character '#\esc' may now be written as '#\escape', per R7RS.
54
55*** Accept "\|" in string literals.
56
57The pipe character may now be preceded by a backslash, per R7RS.
58
59** Custom binary input ports now support 'setvbuf'.
60
c68b9470
LC
61Until now, ports returned by 'make-custom-binary-input-port' were always
62full-buffered. Now, their buffering mode can be changed using 'setvbuf'.
cdf1ae89
MW
63
64** SRFI-4 predicates and length accessors no longer accept arrays.
65
66Given that the SRFI-4 accessors don't work for arrays, the fact that the
67predicates and length accessors returned true for arrays was a bug.
68
69** GUILE_PROGS now supports specifying a minimum required version.
70
71The 'GUILE_PROGS' autoconf macro in guile.m4 now allows an optional
72argument to specify a minimum required Guile version. By default, it
73requires Guile >= 2.0. A micro version can also be specified, e.g.:
74GUILE_PROGS([2.0.10])
75
76** Error reporting improvements
77
78*** Improved run-time error reporting in (ice-9 match).
79
80If no pattern matches in a 'match' form, the datum that failed to match
81is printed along with the location of the failed 'match' invocation.
82
83*** Print the faulty object upon invalid-keyword errors.
84*** Improved error reporting of procedures defined by define-inlinable.
85*** Improved error reporting for misplaced ellipses in macro definitions.
86*** Improved error checking in 'define-public' and 'module-add!'.
87*** Improved error when 'include' form with relative path is not in a file.
88
89** Speed improvements
90
91*** 'scm_c_read' on ISO-8859-1 (e.g. binary) unbuffered ports is faster.
92*** New inline asm for VM fixnum multiply, for faster overflow checking.
93*** New inline asm for VM fixnum operations on ARM and 32-bit x86.
94*** 'positive?' and 'negative?' are now compiled to VM primitives.
95*** Numerical comparisons with more than 2 arguments are compiled to VM code.
96*** Several R6RS bitwise operators have been optimized.
97
98** Miscellaneous changes [XXX not sure where these belong, if anywhere]
99
100*** Web: 'content-disposition' headers are now supported.
101*** Web: 'uri-encode' hexadecimal percent-encoding is now uppercase.
102*** Size argument to 'make-doubly-weak-hash-table' is now optional.
103*** Timeout for 'unlock-mutex' and SRFI-18 'mutex-unlock!' may now be #f.
104
105** Gnulib update
106
107Guile's copy of Gnulib was updated to v0.1-92-g546ff82. The following
108modules were imported from Gnulib: copysign, fsync, isfinite, link,
109lstat, mkdir, mkstemp, readlink, rename, rmdir, and unistd.
110
cdf1ae89
MW
111* New interfaces
112
cdf1ae89
MW
113** Cooperative REPL servers
114
115This new facility supports REPLs that run at specified times within an
116existing thread, for example in programs utilizing an event loop or in
117single-threaded programs. This allows for safe access and mutation of
118a program's data structures from the REPL without concern for thread
119synchronization. See "Cooperative REPL Servers" in the manual for
120details.
121
122** SRFI-43 (Vector Library)
123
124Guile now includes SRFI-43, a comprehensive library of vector operations
125analogous to the SRFI-1 list library. See "SRFI-43" in the manual for
126details.
127
128** SRFI-64 (A Scheme API for test suites)
129
130Guile now includes SRFI-64, a flexible framework for creating test
131suites. The reference implementation of SRFI-64 has also been updated
132to fully support earlier versions of Guile.
133
134** SRFI-111 (Boxes)
135
136See "SRFI-111" in the manual.
137
138** 'define-values'
139
140See "Binding multiple return values" in the manual.
141
142** Custom ellipsis identifiers using 'with-ellipsis' or SRFI-46.
143
144Guile now allows macro definitions to use identifiers other than '...'
145as the ellipsis. This is convenient when writing macros that generate
679ffce8 146macro definitions. The desired ellipsis identifier can be given as the
cdf1ae89 147first operand to 'syntax-rules', as specified SRFI-46 and R7RS, or by
679ffce8
MW
148using the new 'with-ellipsis' special form in procedural macros. With
149this addition, Guile now fully supports SRFI-46.
cdf1ae89
MW
150
151See "Specifying a Custom Ellipsis Identifier" and "Custom Ellipsis
152Identifiers for syntax-case Macros" in the manual for details.
153
154** R7RS 'syntax-error'
155
156Guile now supports 'syntax-error', as specified by R7RS, allowing for
157improved compile-time error reporting from 'syntax-rules' macros. See
158"Reporting Syntax Errors in Macros" in the manual for details.
159
160** New procedures to convert association lists into hash tables
161
162Guile now includes the convenience procedures 'alist->hash-table',
163'alist->hashq-table', 'alist->hashv-table', and 'alist->hashx-table'.
164See "Hash Table Reference" in the manual.
165
166** New predicates: 'exact-integer?' and 'scm_is_exact_integer'
167
168See "Integers" in the manual.
169
170** 'weak-vector-length', 'weak-vector-ref', and 'weak-vector-set!'
171
172These should now be used to access weak vectors, instead of
173'vector-length', 'vector-ref', and 'vector-set!'.
174
c68b9470
LC
175* Manual updates
176
177** Improve docs for 'eval-when'.
178
179Each 'eval-when' condition is now explained in detail, including
180'expand' which was previously undocumented. (expand load eval) is now
181the recommended set of conditions, instead of (compile load eval).
182See "Eval When" in the manual, for details.
183
184** Update the section on SMOBs and memory management.
185
186See "Defining New Types (Smobs)" in the manual.
187
188** Fixes
189
190*** GOOPS: #:dsupers is the init keyword for the dsupers slot.
191*** 'unfold-right' takes a tail, not a tail generator.
192*** Clarify that 'append!' and 'reverse!' might not mutate.
193*** Fix doc that incorrectly claimed (integer? +inf.0) => #t.
194 (http://bugs.gnu.org/16356)
195*** Document that we support SRFI-62 (S-expression comments).
196*** Document that we support SRFI-87 (=> in case clauses).
197*** Document 'equal?' in the list of R6RS incompatibilities.
198*** Remove outdated documentation of LTDL_LIBRARY_PATH.
199*** Fix 'weak-vector?' doc: Weak hash tables are not weak vectors.
200*** Fix 'my-or' examples to use let-bound variable.
201 (http://bugs.gnu.org/14203)
202
203* New deprecations
204
205** General 'uniform-vector' interface
206
207This interface lacked both generality and specificity. The general
208replacements are 'array-length', 'array-ref', and friends on the scheme
209side, and the array handle interface on the C side. On the specific
210side of things, there are the specific bytevector, SRFI-4, and bitvector
211interfaces.
212
213** Use of the vector interface on arrays
214** 'vector-length', 'vector-ref', and 'vector-set!' on weak vectors
215** 'vector-length', 'vector-ref', and 'vector-set!' as primitive-generics
216
217Making the vector interface operate only on a single representation will
218allow future versions of Guile to compile loops involving vectors to
219more efficient native code.
220
221** 'htons', 'htonl', 'ntohs', 'ntohl'
222
223These procedures, like their C counterpart, were used to convert numbers
224to/from network byte order, typically in conjunction with the
225now-deprecated uniform vector API.
226
227This functionality is now covered by the bytevector and binary I/O APIs.
228See "Interpreting Bytevector Contents as Integers" in the manual.
229
230** 'gc-live-object-stats'
231
232It hasn't worked in the whole 2.0 series. There is no replacement,
233unfortunately.
234
235** 'scm_c_program_source'
236
237[XXX add justification]. Please use 'scm_program_source' instead.
238
cdf1ae89
MW
239* Build fixes
240
c68b9470 241** Fix build with Clang 3.4.
cdf1ae89
MW
242
243** MinGW build fixes
244*** Do not add $(EXEEXT) to guild or guile-tools.
245*** tests: Use double quotes around shell arguments, for Windows.
246*** tests: Don't rely on $TMPDIR and /tmp on Windows.
247*** tests: Skip FFI tests that use `qsort' when it's not accessible.
248*** tests: Remove symlink only when it exists.
249*** tests: Don't rely on `scm_call_2' being visible.
250
251** Fix computation of LIBLOBJS so dependencies work properly.
252 (http://bugs.gnu.org/14193)
253
cdf1ae89
MW
254* Bug fixes
255
256** Web: Fix web client with methods other than GET.
257 (http://bugs.gnu.org/15908)
258** Web: Add Content-Length header for empty bodies.
259** Web: Accept "UTC" as the zone offset in date headers.
260 (http://bugs.gnu.org/14128)
261** Web: Don't throw if a response is longer than its Content-Length says.
262** Web: Write out HTTP Basic auth headers correctly.
263 (http://bugs.gnu.org/14370)
264** Web: Always print a path component in 'write-request-line'.
265** Fix 'define-public' from (ice-9 curried-definitions).
266** psyntax: toplevel variable definitions discard previous syntactic binding.
267 (http://bugs.gnu.org/11988)
268** Fix thread-unsafe lazy initializations.
269** Make (ice-9 popen) thread-safe.
270 (http://bugs.gnu.org/15683)
271** Make guardians thread-safe.
272** Make regexp_exec thread-safe.
273 (http://bugs.gnu.org/14404)
274** vm: Gracefully handle stack overflows.
275 (http://bugs.gnu.org/15065)
276** Fix 'rationalize'.
277 (http://bugs.gnu.org/14905)
278** Fix inline asm for VM fixnum operations on x32.
279** Fix 'SCM_SYSCALL' to really swallow EINTR.
280** Hide EINTR returns from 'accept'.
281** SRFI-19: Update the table of leap seconds.
282** Add missing files to the test-suite Makefile.
283** Make sure 'ftw' allows directory traversal when running as root.
284** Fix 'hash-for-each' for weak hash tables.
285** SRFI-18: Export 'current-thread'.
286 (http://bugs.gnu.org/16890)
287** Fix inlining of tail list to apply.
288 (http://bugs.gnu.org/15533)
289** Fix bug in remqueue in threads.c when removing last element.
290** Fix build when '>>' on negative integers is not arithmetic.
291** Fix 'bitwise-bit-count' for negative arguments.
292 (http://bugs.gnu.org/14864)
293** Fix VM 'ash' for right shifts by large amounts.
294 (http://bugs.gnu.org/14864)
295** Fix rounding in scm_i_divide2double for negative arguments.
296** Avoid lossy conversion from inum to double in numerical comparisons.
297** Fix numerical comparison of fractions to infinities.
298** Allow fl+ and fl* to accept zero arguments.
299 (http://bugs.gnu.org/14869)
300** flonum? returns false for complex number objects.
301 (http://bugs.gnu.org/14866)
302** flfinite? applied to a NaN returns false.
303 (http://bugs.gnu.org/14868)
304** Flonum operations always return flonums.
305 (http://bugs.gnu.org/14871)
306** min and max: NaNs beat infinities, per R6RS errata.
307 (http://bugs.gnu.org/14865)
308** Fix 'fxbit-count' for negative arguments.
309** 'gcd' and 'lcm' support inexact integer arguments.
310 (http://bugs.gnu.org/14870)
311** Fix R6RS 'fixnum-width'.
312 (http://bugs.gnu.org/14879)
313** tests: Use shell constructs that /bin/sh on Solaris 10 can understand.
314 (http://bugs.gnu.org/14042)
315** Fix display of symbols containing backslashes.
316 (http://bugs.gnu.org/15033)
317** Fix truncated-print for uniform vectors.
318** Define `AF_UNIX' only when Unix-domain sockets are supported.
319** Decompiler: fix handling of empty 'case-lambda' expressions.
320** Fix handling of signed zeroes and infinities in 'numerator' and 'denominator'.
321** dereference-pointer: check for null pointer.
322** Optimizer: Numerical comparisons are not negatable, for correct NaN handling.
323** Compiler: Evaluate '-' and '/' in left-to-right order.
324 (for more robust floating-point arithmetic)
325** snarf.h: Declare static const function name vars as SCM_UNUSED.
326** chars.c: Remove duplicate 'const' specifiers.
327** Modify SCM_UNPACK type check to avoid warnings in clang.
328** Arrange so that 'file-encoding' does not truncate the encoding name.
329 (http://bugs.gnu.org/16463)
330** Improve error checking in bytevector->uint-list and bytevector->sint-list.
331 (http://bugs.gnu.org/15100)
332** Fix (ash -1 SCM_I_FIXNUM_BIT-1) to return a fixnum instead of a bignum.
333** i18n: Fix null pointer dereference when locale info is missing.
334** Fix 'string-copy!' to work properly with overlapping src/dest.
335** Fix hashing of vectors to run in bounded time.
336** 'port-position' works on CBIPs that do not support 'set-port-position!'.
337** Custom binary input ports sanity-check the return value of 'read!'.
338** bdw-gc.h: Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.
339** REPL Server: Don't establish a SIGINT handler.
340** REPL Server: Redirect warnings to client socket.
341** REPL Server: Improve robustness of 'stop-server-and-clients!'.
342** Add srfi-16, srfi-30, srfi-46, srfi-62, srfi-87 to %cond-expand-features.
343** Fix trap handlers to handle applicable structs.
344 (http://bugs.gnu.org/15691)
345** Fix optional end argument in `uniform-vector-read!'.
346 (http://bugs.gnu.org/15370)
347** Fix brainfuck->scheme compiler.
c68b9470 348** texinfo: Fix newline preservation in @example with lines beginning with @
cdf1ae89
MW
349
350** C standards conformance improvements
351
c68b9470
LC
352Improvements and bug fixes were made to the C part of Guile's run-time
353support (libguile).
cdf1ae89
MW
354
355*** Don't use the identifier 'noreturn'.
356 (http://bugs.gnu.org/15798)
357*** Rewrite SCM_I_INUM to avoid unspecified behavior when not using GNU C.
358*** Improve fallback implemention of SCM_SRS to avoid unspecified behavior.
359*** SRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable.
360*** Improve compliance with C standards regarding signed integer shifts.
361*** Avoid signed overflow in random.c.
362*** VM: Avoid signed overflows in 'add1' and 'sub1'.
363*** VM: Avoid overflow in ASM_ADD when the result is most-positive-fixnum.
364*** read: Avoid signed integer overflow in 'read_decimal_integer'.
365
366
367\f
cfeb9130
LC
368Changes in 2.0.9 (since 2.0.7):
369
370Note: 2.0.8 was a brown paper bag release that was never announced, but
371some mirrors may have picked it up. Please do not use it.
de2811cc 372
f361bb93 373* Notable changes
de2811cc 374
eed0d26c
MW
375** New keyword arguments for procedures that open files
376
14f2e470
AW
377The following procedures that open files now support keyword arguments
378to request binary I/O or to specify the character encoding for text
7f74dcb4
LC
379files: `open-file', `open-input-file', `open-output-file',
380`call-with-input-file', `call-with-output-file', `with-input-from-file',
381`with-output-to-file', and `with-error-to-file'.
eed0d26c
MW
382
383It is also now possible to specify whether Guile should scan files for
384Emacs-style coding declarations. This scan was done by default in
385versions 2.0.0 through 2.0.7, but now must be explicitly requested.
386
387See "File Ports" in the manual for details.
388
14f2e470 389** Rewritten guile.m4
de2811cc 390
f361bb93
AW
391The `guile.m4' autoconf macros have been rewritten to use `guild' and
392`pkg-config' instead of the deprecated `guile-config' (which itself
393calls pkg-config).
de2811cc 394
f361bb93
AW
395There is also a new macro, `GUILE_PKG', which allows packages to select
396the version of Guile that they want to compile against. See "Autoconf
397Macros" in the manual, for more information.
de2811cc 398
eed0d26c 399** Better Windows support
de2811cc 400
f361bb93
AW
401Guile now correctly identifies absolute paths on Windows (MinGW), and
402creates files on that platform according to its path conventions. See
14f2e470 403"File System" in the manual, for all details.
de2811cc 404
f361bb93
AW
405In addition, the new Gnulib imports provide `select' and `poll' on
406Windows builds.
de2811cc 407
f361bb93
AW
408As an incompatible change, systems that are missing <sys/select.h> were
409previously provided a public `scm_std_select' C function that defined a
410version of `select', but unhappily it also provided its own incompatible
14f2e470 411definitions for FD_SET, FD_ZERO, and other system interfaces. Guile
f361bb93
AW
412should not be setting these macros in public API, so this interface was
413removed on those plaforms (basically only MinGW).
de2811cc 414
eed0d26c 415** Numerics improvements
de2811cc 416
eed0d26c
MW
417`number->string' now reliably outputs enough digits to produce the same
418number when read back in. Previously, it mishandled subnormal numbers
419(printing them as "#.#"), and failed to distinguish between some
420distinct inexact numbers, e.g. 1.0 and (+ 1.0 (expt 2.0 -52)). These
421problems had far-reaching implications, since the compiler uses
422`number->string' to serialize numeric constants into .go files.
423
424`sqrt' now produces exact rational results when possible, and handles
425very large or very small numbers more robustly.
de2811cc 426
22c76fd8
MW
427A number (ahem) of operations involving exact rationals have been
428optimized, most notably `integer-expt' and `expt'.
eed0d26c 429
22c76fd8 430`exact->inexact' now performs correct IEEE rounding.
eed0d26c
MW
431
432** New optimizations
de2811cc 433
f361bb93 434There were a number of improvements to the partial evaluator, allowing
01b83dbd 435complete reduction of forms such as:
de2811cc 436
f361bb93 437 ((let ((_ 10)) (lambda () _)))
de2811cc 438
f361bb93 439 ((lambda _ _))
de2811cc 440
c608e1aa 441 (apply (lambda _ _) 1 2 3 '(4))
de2811cc 442
f361bb93 443 (call-with-values (lambda () (values 1 2)) (lambda _ _))
de2811cc 444
eed0d26c
MW
445`string-join' now handles huge lists efficiently.
446
14f2e470 447`get-bytevector-some' now uses buffered input, which is much faster.
de2811cc 448
a24cda1d
LC
449Finally, `array-ref', `array-set!' on arrays of rank 1 or 2 is now
450faster, because it avoids building a rest list. Similarly, the
451one-argument case of `array-for-each' and `array-map!' has been
452optimized, and `array-copy!' and `array-fill!' are faster.
de2811cc 453
7ca88a40
MW
454** `peek-char' no longer consumes EOF
455
456As required by the R5RS, if `peek-char' returns EOF, then the next read
457will also return EOF. Previously `peek-char' would consume the EOF.
458This makes a difference for terminal devices where it is possible to
459read past an EOF.
460
eed0d26c
MW
461** Gnulib update
462
463Guile's copy of Gnulib was updated to v0.0-7865-ga828bb2. The following
464modules were imported from Gnulib: select, times, pipe-posix, fstat,
465getlogin, poll, and c-strcase.
466
467** `include' resolves relative file names relative to including file
de2811cc 468
f361bb93
AW
469Given a relative file name, `include' will look for it relative to the
470directory of the including file. This harmonizes the behavior of
471`include' with that of `load'.
de2811cc 472
eed0d26c 473** SLIB compatibility restored
de2811cc 474
f361bb93
AW
475Guile 2.0.8 is now compatible with SLIB. You will have to use a
476development version of SLIB, however, until a new version of SLIB is
477released.
de2811cc 478
eed0d26c 479** Better ,trace REPL command
f361bb93
AW
480
481Sometimes the ,trace output for nested function calls could overflow the
482terminal width, which wasn't useful. Now there is a limit to the amount
483of space the prefix will take. See the documentation for ",trace" for
484more information.
de2811cc 485
eed0d26c
MW
486** Better docstring syntax supported for `case-lambda'
487
488Docstrings can now be placed immediately after the `case-lambda' or
489`case-lambda*' keyword. See "Case-lambda" in the manual.
490
eed0d26c
MW
491** Improved handling of Unicode byte order marks
492
493See "BOM Handling" in the manual for details.
494
495** Update predefined character sets to Unicode 6.2
de2811cc 496
465ff502
LC
497** GMP 4.2 or later required
498
499Guile used to require GMP at least version 4.1 (released in May 2002),
500and now requires at least version 4.2 (released in March 2006).
501
de2811cc
AW
502* Manual updates
503
eed0d26c 504** Better SXML documentation
de2811cc 505
f361bb93
AW
506The documentation for SXML modules was much improved, though there is
507still far to go. See "SXML" in manual.
de2811cc 508
eed0d26c 509** Style updates
de2811cc 510
f361bb93
AW
511Use of "iff" was replaced with standard English. Keyword arguments are
512now documented consistently, along with their default values.
de2811cc 513
eed0d26c 514** An end to the generated-documentation experiment
de2811cc 515
f361bb93
AW
516When Guile 2.0 imported some modules from Guile-Lib, they came with a
517system that generated documentation from docstrings and module
518commentaries. This produced terrible documentation. We finally bit the
519bullet and incorporated these modules into the main text, and will be
520improving them manually over time, as is the case with SXML. Help is
521appreciated.
de2811cc 522
eed0d26c 523** New documentation
de2811cc 524
f361bb93
AW
525There is now documentation for `scm_array_type', and `scm_array_ref', as
526well as for the new `array-length' / 'scm_c_array_length' /
527`scm_array_length' functions. `array-in-bounds?' has better
528documentation as well. The `program-arguments-alist' and
eed0d26c
MW
529`program-lambda-list' functions are now documented, as well as `and=>',
530`exit', and `quit'. The (system repl server) module is now documented
531(see REPL Servers). Finally, the GOOPS class hierarchy diagram has been
532regenerated for the web and print output formats.
de2811cc 533
f361bb93 534* New deprecations
de2811cc 535
eed0d26c 536** Deprecate generalized vector interface
de2811cc 537
f361bb93
AW
538The generalized vector interface, introduced in 1.8.0, is simply a
539redundant, verbose interface to arrays of rank 1. `array-ref' and
540similar functions are entirely sufficient. Thus,
541`scm_generalized_vector_p', `scm_generalized_vector_length',
542`scm_generalized_vector_ref', `scm_generalized_vector_set_x', and
543`scm_generalized_vector_to_list' are now deprecated.
de2811cc 544
eed0d26c 545** Deprecate SCM_CHAR_CODE_LIMIT and char-code-limit
de2811cc 546
f361bb93
AW
547These constants were defined to 256, which is not the highest codepoint
548supported by Guile. Given that they were useless and incorrect, they
549have been deprecated.
de2811cc 550
eed0d26c 551** Deprecate `http-get*'
de2811cc 552
f361bb93 553The new `#:streaming?' argument to `http-get' subsumes the functionality
ed4aa264
LC
554of `http-get*' (introduced in 2.0.7). Also, the `#:extra-headers'
555argument is deprecated in favor of `#:headers'.
de2811cc 556
eed0d26c 557** Deprecate (ice-9 mapping)
de2811cc 558
f361bb93
AW
559This module, present in Guile since 1996 but never used or documented,
560has never worked in Guile 2.0. It has now been deprecated and will be
561removed in Guile 2.2.
de2811cc 562
eed0d26c 563** Deprecate undocumented array-related C functions
a24cda1d
LC
564
565These are `scm_array_fill_int', `scm_ra_eqp', `scm_ra_lessp',
566`scm_ra_leqp', `scm_ra_grp', `scm_ra_greqp', `scm_ra_sum',
567`scm_ra_product', `scm_ra_difference', `scm_ra_divide', and
568`scm_array_identity'.
569
de2811cc
AW
570* New interfaces
571
eed0d26c 572** SRFI-41 Streams
de2811cc 573
eed0d26c 574See "SRFI-41" in the manual.
de2811cc 575
14f2e470
AW
576** SRFI-45 exports `promise?'
577
578SRFI-45 now exports a `promise?' procedure that works with its promises.
579Also, its promises now print more nicely.
580
eed0d26c 581** New HTTP client procedures
de2811cc 582
eed0d26c
MW
583See "Web Client" for documentation on the new `http-head', `http-post',
584`http-put', `http-delete', `http-trace', and `http-options' procedures,
585and also for more options to `http-get'.
de2811cc 586
eed0d26c 587** Much more capable `xml->sxml'
ed4aa264 588
eed0d26c
MW
589See "Reading and Writing XML" for information on how the `xml->sxml'
590parser deals with namespaces, processed entities, doctypes, and literal
591strings. Incidentally, `current-ssax-error-port' is now a parameter
592object.
ed4aa264 593
eed0d26c 594** New procedures for converting strings to and from bytevectors
de2811cc 595
eed0d26c
MW
596See "Representing Strings as Bytes" for documention on the new `(ice-9
597iconv)' module and its `bytevector->string' and `string->bytevector'
598procedures.
de2811cc 599
a24cda1d
LC
600** Escape continuations with `call/ec' and `let/ec'
601
602See "Prompt Primitives".
603
eed0d26c
MW
604** New procedures to read all characters from a port
605
606See "Line/Delimited" in the manual for documentation on `read-string'
607 and `read-string!'.
608
609** New procedure `sendfile'
610
611See "File System".
612
613** New procedure `unget-bytevector'
614
615See "R6RS Binary Input".
616
617** New C helper: `scm_c_bind_keyword_arguments'
618
619See "Keyword Procedures".
620
621** New command-line arguments: `--language' and `-C'
622
623See "Command-line Options" in the manual.
624
625** New environment variables: `GUILE_STACK_SIZE', `GUILE_INSTALL_LOCALE'
626
627See "Environment Variables".
628
629** New procedures for dealing with file names
630
631See "File System" for documentation on `system-file-name-convention',
632`file-name-separator?', `absolute-file-name?', and
633`file-name-separator-string'.
634
635** `array-length', an array's first dimension
de2811cc 636
01b83dbd 637See "Array Procedures".
de2811cc 638
eed0d26c 639** `hash-count', for hash tables
de2811cc 640
01b83dbd 641See "Hash Tables".
de2811cc 642
eed0d26c
MW
643** `round-ash', a bit-shifting operator that rounds on right-shift
644
645See "Bitwise Operations".
646
647** New foreign types: `ssize_t', `ptrdiff_t'
de2811cc 648
01b83dbd 649See "Foreign Types".
de2811cc 650
eed0d26c 651** New C helpers: `scm_from_ptrdiff_t', `scm_to_ptrdiff_t'
de2811cc 652
01b83dbd 653See "Integers".
de2811cc 654
eed0d26c 655** Socket option `SO_REUSEPORT' now available from Scheme
de2811cc 656
eed0d26c
MW
657If supported on the platform, `SO_REUSEPORT' is now available from
658Scheme as well. See "Network Sockets and Communication".
de2811cc 659
eed0d26c 660** `current-language' in default environment
de2811cc 661
01b83dbd
AW
662Previously defined only in `(system base language)', `current-language'
663is now defined in the default environment, and is used to determine the
664language for the REPL, and for `compile-and-load'.
de2811cc 665
01b83dbd 666** New procedure: `fluid->parameter'
de2811cc 667
01b83dbd
AW
668See "Parameters", for information on how to convert a fluid to a
669parameter.
de2811cc 670
eed0d26c 671** New `print' REPL option
de2811cc 672
01b83dbd
AW
673See "REPL Commands" in the manual for information on the new
674user-customizable REPL printer.
de2811cc 675
eed0d26c 676** New variable: %site-ccache-dir
de2811cc 677
01b83dbd
AW
678The "Installing Site Packages" and "Build Config" manual sections now
679refer to this variable to describe where users should install their
680`.go' files.
de2811cc
AW
681
682* Build fixes
683
f361bb93 684** Fix compilation against libgc 7.3.
de2811cc 685** Fix cross-compilation of `c-tokenize.o'.
f361bb93
AW
686** Fix warning when compiling against glibc 2.17.
687** Fix documentation build against Texinfo 5.0.
01b83dbd
AW
688** Fix building Guile from a directory with non-ASCII characters.
689** Fix native MinGW build.
690** Fix --disable-posix build.
691** Fix MinGW builds with networking, POSIX, and thread support.
de2811cc
AW
692
693* Bug fixes
694
eed0d26c
MW
695** Fix inexact number printer.
696 (http://bugs.gnu.org/13757)
697** Fix infinite loop when parsing optional-argument short options (SRFI-37).
ed4aa264 698 (http://bugs.gnu.org/13176)
eed0d26c 699** web: Support non-GMT date headers in the HTTP client.
ed4aa264 700 (http://bugs.gnu.org/13544)
eed0d26c
MW
701** web: support IP-literal (IPv6 address) in Host header.
702** Avoid stack overflows with `par-map' and nested futures in general.
ed4aa264 703 (http://bugs.gnu.org/13188)
eed0d26c
MW
704** Peek-char no longer consumes EOF.
705 (http://bugs.gnu.org/12216)
706** Avoid swallowing multiple EOFs in R6RS binary-input procedures.
01b83dbd
AW
707** A fork when multiple threads are running will now print a warning.
708** Allow for spurious wakeups from pthread_cond_wait.
de2811cc 709 (http://bugs.gnu.org/10641)
01b83dbd 710** Warn and ignore module autoload failures.
de2811cc 711 (http://bugs.gnu.org/12202)
01b83dbd
AW
712** Use chmod portably in (system base compile).
713 (http://bugs.gnu.org/10474)
c608e1aa 714** Fix response-body-port for HTTP responses without content-length.
01b83dbd
AW
715 (http://bugs.gnu.org/13857)
716** Allow case-lambda expressions with no clauses.
717 (http://bugs.gnu.org/9776)
de2811cc
AW
718** Improve standards conformance of string->number.
719 (http://bugs.gnu.org/11887)
01b83dbd
AW
720** Support calls and tail-calls with more than 255 formals.
721** ,option evaluates its right-hand-side.
de2811cc 722 (http://bugs.gnu.org/13076)
01b83dbd 723** Structs with tail arrays are not simple.
de2811cc
AW
724 (http://bugs.gnu.org/12808)
725** Make `SCM_LONG_BIT' usable in preprocessor conditionals.
726 (http://bugs.gnu.org/13848)
727** Fix thread-unsafe lazy initializations.
01b83dbd 728** Allow SMOB mark procedures to be called from parallel markers.
de2811cc
AW
729 (http://bugs.gnu.org/13611)
730** Fix later-bindings-win logic in with-fluids.
731 (http://bugs.gnu.org/13843)
732** Fix duplicate removal of with-fluids.
733 (http://bugs.gnu.org/13838)
734** Support calling foreign functions of 10 arguments or more.
01b83dbd
AW
735 (http://bugs.gnu.org/13809)
736** Let reverse! accept arbitrary types as second argument.
737 (http://bugs.gnu.org/13835)
de2811cc
AW
738** Recognize the `x86_64.*-gnux32' triplet.
739** Check whether a triplet's OS part specifies an ABI.
740** Recognize mips64* as having 32-bit pointers by default.
eed0d26c
MW
741** Use portable sed constructs.
742 (http://bugs.gnu.org/14042)
01b83dbd
AW
743** Remove language/glil/decompile-assembly.scm.
744 (http://bugs.gnu.org/10622)
745** Use O_BINARY in `copy-file', `load-objcode', `mkstemp'.
eed0d26c
MW
746** Use byte-oriented functions in `get-bytevector*'.
747** Fix abort when iconv swallows BOM from UTF-16 or UTF-32 stream.
01b83dbd 748** Fix compilation of functions with more than 255 local variables.
de2811cc 749** Fix `getgroups' for when zero supplementary group IDs exist.
01b83dbd
AW
750** Allow (define-macro name (lambda ...)).
751** Various fixes to the (texinfo) modules.
de2811cc 752** guild: Gracefully handle failures to install the locale.
01b83dbd
AW
753** Fix format string warnings for ~!, ~|, ~/, ~q, ~Q, and ~^.
754 (http://bugs.gnu.org/13485)
de2811cc 755** Fix source annotation bug in psyntax 'expand-body'.
01b83dbd 756** Ecmascript: Fix conversion to boolean for non-numbers.
eed0d26c
MW
757** Use case-insensitive comparisons for encoding names.
758** Add missing cond-expand feature identifiers.
01b83dbd
AW
759** A failure to find a module's file does not prevent future loading.
760** Many (oop goops save) fixes.
761** `http-get': don't shutdown write end of socket.
762 (http://bugs.gnu.org/13095)
763** Avoid signed integer overflow in scm_product.
c608e1aa 764** http: read-response-body always returns bytevector or #f, never EOF.
de2811cc 765** web: Correctly detect "No route to host" conditions.
eed0d26c 766** `system*': failure to execvp no longer leaks dangling processes.
de2811cc 767 (http://bugs.gnu.org/13166)
eed0d26c 768** More sensible case-lambda* dispatch.
01b83dbd 769 (http://bugs.gnu.org/12929)
de2811cc
AW
770** Do not defer expansion of internal define-syntax forms.
771 (http://bugs.gnu.org/13509)
772
773
774\f
13fac282
LC
775Changes in 2.0.7 (since 2.0.6):
776
777* Notable changes
778
779** SRFI-105 curly infix expressions are supported
780
781Curly infix expressions as described at
782http://srfi.schemers.org/srfi-105/srfi-105.html are now supported by
783Guile's reader. This allows users to write things like {a * {b + c}}
784instead of (* a (+ b c)). SRFI-105 support is enabled by using the
785`#!curly-infix' directive in source code, or the `curly-infix' reader
786option. See the manual for details.
787
788** Reader options may now be per-port
789
790Historically, `read-options' and related procedures would manipulate
791global options, affecting the `read' procedure for all threads, and all
792current uses of `read'.
793
794Guile can now associate `read' options with specific ports, allowing
795different ports to use different options. For instance, the
796`#!fold-case' and `#!no-fold-case' reader directives have been
797implemented, and their effect is to modify the current read options of
798the current port only; similarly for `#!curly-infix'. Thus, it is
799possible, for instance, to have one port reading case-sensitive code,
800while another port reads case-insensitive code.
801
802** Futures may now be nested
803
804Futures may now be nested: a future can itself spawn and then `touch'
805other futures. In addition, any thread that touches a future that has
806not completed now processes other futures while waiting for the touched
807future to completed. This allows all threads to be kept busy, and was
808made possible by the use of delimited continuations (see the manual for
809details.)
810
2813d725
MW
811Consequently, `par-map' and `par-for-each' have been rewritten and can
812now use all cores.
13fac282 813
3919585f
MW
814** `GUILE_LOAD_PATH' et al can now add directories to the end of the path
815
816`GUILE_LOAD_PATH' and `GUILE_LOAD_COMPILED_PATH' can now be used to add
817directories to both ends of the load path. If the special path
818component `...' (ellipsis) is present in these environment variables,
819then the default path is put in place of the ellipsis, otherwise the
820default path is placed at the end. See "Environment Variables" in the
821manual for details.
822
13fac282
LC
823** `load-in-vicinity' search for `.go' files in `%load-compiled-path'
824
825Previously, `load-in-vicinity' would look for compiled files in the
826auto-compilation cache, but not in `%load-compiled-path'. This is now
827fixed. This affects `load', and the `-l' command-line flag. See
828<http://bugs.gnu.org/12519> for details.
829
830** Extension search order fixed, and LD_LIBRARY_PATH preserved
831
832Up to 2.0.6, Guile would modify the `LD_LIBRARY_PATH' environment
833variable (or whichever is relevant for the host OS) to insert its own
834default extension directories in the search path (using GNU libltdl
835facilities was not possible here.) This approach was problematic in two
836ways.
837
838First, the `LD_LIBRARY_PATH' modification would be visible to
839sub-processes, and would also affect future calls to `dlopen', which
840could lead to subtle bugs in the application or sub-processes. Second,
a94e7d85
MW
841when the installation prefix is /usr, the `LD_LIBRARY_PATH' modification
842would typically end up inserting /usr/lib before /usr/local/lib in the
843search path, which is often the opposite of system-wide settings such as
844`ld.so.conf'.
13fac282
LC
845
846Both issues have now been fixed.
847
848** `make-vtable-vtable' is now deprecated
849
850Programs should instead use `make-vtable' and `<standard-vtable>'.
851
852** The `-Wduplicate-case-datum' and `-Wbad-case-datum' are enabled
853
854These recently introduced warnings have been documented and are now
855enabled by default when auto-compiling.
856
a94e7d85 857** Optimize calls to `equal?' or `eqv?' with a constant argument
13fac282 858
a94e7d85
MW
859The compiler simplifies calls to `equal?' or `eqv?' with a constant
860argument to use `eq?' instead, when applicable.
13fac282
LC
861
862* Manual updates
863
864** SRFI-9 records now documented under "Compound Data Types"
865
866The documentation of SRFI-9 record types has been moved in the "Compound
867Data Types", next to Guile's other record APIs. A new section
868introduces the various record APIs, and describes the trade-offs they
869make. These changes were made in an attempt to better guide users
870through the maze of records API, and to recommend SRFI-9 as the main
871API.
872
873The documentation of Guile's raw `struct' API has also been improved.
874
875** (ice-9 and-let-star) and (ice-9 curried-definitions) now documented
876
877These modules were missing from the manual.
878
879* New interfaces
880
881** New "functional record setters" as a GNU extension of SRFI-9
882
883The (srfi srfi-9 gnu) module now provides three new macros to deal with
884"updates" of immutable records: `define-immutable-record-type',
885`set-field', and `set-fields'.
886
887The first one allows record type "functional setters" to be defined;
888such setters keep the record unchanged, and instead return a new record
889with only one different field. The remaining macros provide the same
890functionality, and also optimize updates of multiple or nested fields.
891See the manual for details.
892
893** web: New `http-get*', `response-body-port', and `text-content-type?'
894 procedures
895
896These procedures return a port from which to read the response's body.
897Unlike `http-get' and `read-response-body', they allow the body to be
898processed incrementally instead of being stored entirely in memory.
899
900The `text-content-type?' predicate allows users to determine whether the
901content type of a response is textual.
902
903See the manual for details.
904
905** `string-split' accepts character sets and predicates
906
907The `string-split' procedure can now be given a SRFI-14 character set or
908a predicate, instead of just a character.
909
3b539098 910** R6RS SRFI support
13fac282 911
3b539098
LC
912Previously, in R6RS modules, Guile incorrectly ignored components of
913SRFI module names after the SRFI number, making it impossible to specify
914sub-libraries. This release corrects this, bringing us into accordance
915with SRFI 97.
13fac282
LC
916
917** `define-public' is no a longer curried definition by default
918
919The (ice-9 curried-definitions) should be used for such uses. See the
920manual for details.
921
922* Build fixes
923
924** Remove reference to `scm_init_popen' when `fork' is unavailable
925
926This fixes a MinGW build issue (http://bugs.gnu.org/12477).
927
928** Fix race between installing `guild' and the `guile-tools' symlink
929
930* Bug fixes
931
932** Procedures returned by `eval' now have docstrings
933 (http://bugs.gnu.org/12173)
934** web client: correctly handle uri-query, etc. in relative URI headers
935 (http://bugs.gnu.org/12827)
936** Fix docs for R6RS `hashtable-copy'
937** R6RS `string-for-each' now accepts multiple string arguments
938** Fix out-of-range error in the compiler's CSE pass
939 (http://bugs.gnu.org/12883)
940** Add missing R6RS `open-file-input/output-port' procedure
941** Futures: Avoid creating the worker pool more than once
942** Fix invalid assertion about mutex ownership in threads.c
943 (http://bugs.gnu.org/12719)
944** Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'
945** The `scandir' procedure now uses `lstat' instead of `stat'
946** Fix `generalized-vector->list' indexing bug with shared arrays
947 (http://bugs.gnu.org/12465)
948** web: Change `http-get' to try all the addresses for the given URI
949** Implement `hash' for structs
950 (http://lists.gnu.org/archive/html/guile-devel/2012-10/msg00031.html)
951** `read' now adds source properties for data types beyond pairs
952** Improve error reporting in `append!'
953** In fold-matches, set regexp/notbol unless matching string start
954** Don't stat(2) and access(2) the .go location before using it
955** SRFI-19: use zero padding for hours in ISO 8601 format, not blanks
956** web: Fix uri-encoding for strings with no unreserved chars, and octets 0-15
957** More robust texinfo alias handling
958** Optimize `format' and `simple-format'
959 (http://bugs.gnu.org/12033)
960** Angle of -0.0 is pi, not zero
961
962\f
d2e35793
AW
963Changes in 2.0.6 (since 2.0.5):
964
965* Notable changes
966
967** New optimization pass: common subexpression elimination (CSE)
968
969Guile's optimizer will now run a CSE pass after partial evaluation.
970This pass propagates static information about branches taken, bound
971lexicals, and effects from an expression's dominators. It can replace
972common subexpressions with their boolean values (potentially enabling
973dead code elimination), equivalent bound lexicals, or it can elide them
974entirely, depending on the context in which they are executed. This
975pass is especially useful in removing duplicate type checks, such as
d7a33b64 976those produced by SRFI-9 record accessors.
d2e35793
AW
977
978** Improvements to the partial evaluator
979
980Peval can now hoist tests that are common to both branches of a
981conditional into the test. This can help with long chains of
982conditionals, such as those generated by the `match' macro. Peval can
983now do simple beta-reductions of procedures with rest arguments. It
984also avoids residualizing degenerate lexical aliases, even when full
985inlining is not possible. Finally, peval now uses the effects analysis
986introduced for the CSE pass. More precise effects analysis allows peval
987to move more code.
988
989** Run finalizers asynchronously in asyncs
990
991Finalizers are now run asynchronously, via an async. See Asyncs in the
992manual. This allows Guile and user code to safely allocate memory while
993holding a mutex.
994
995** Update SRFI-14 character sets to Unicode 6.1
996
997Note that this update causes the Latin-1 characters `§' and `¶' to be
998reclassified as punctuation. They were previously considered to be part
999of `char-set:symbol'.
1000
1001** Better source information for datums
1002
1003When the `positions' reader option is on, as it is by default, Guile's
1004reader will record source information for more kinds of datums.
1005
1006** Improved error and warning messages
1007
d7a33b64
LC
1008`syntax-violation' errors now prefer `subform' for source info, with
1009`form' as fallback. Syntactic errors in `cond' and `case' now produce
d2e35793
AW
1010better errors. `case' can now warn on duplicate datums, or datums that
1011cannot be usefully compared with `eqv?'. `-Warity-mismatch' now handles
1012applicable structs. `-Wformat' is more robust in the presence of
1013`gettext'. Finally, various exceptions thrown by the Web modules now
1014define appropriate exception printers.
1015
1016** A few important bug fixes in the HTTP modules.
1017
1018Guile's web server framework now checks if an application returns a body
d7a33b64 1019where it is not permitted, for example in response to a HEAD request,
d2e35793
AW
1020and warn or truncate the response as appropriate. Bad requests now
1021cause a 400 Bad Request response to be printed before closing the port.
1022Finally, some date-printing and URL-parsing bugs were fixed.
1023
1024** Pretty-print improvements
1025
1026When Guile needs to pretty-print Tree-IL, it will try to reconstruct
1027`cond', `or`, and other derived syntax forms from the primitive tree-IL
1028forms. It also uses the original names instead of the fresh unique
1029names, when it is unambiguous to do so. This can be seen in the output
1030of REPL commands like `,optimize'.
1031
1032Also, the `pretty-print' procedure has a new keyword argument,
1033`#:max-expr-width'.
1034
1035** Fix memory leak involving applicable SMOBs
1036
1037At some point in the 1.9.x series, Guile began leaking any applicable
1038SMOB that was actually applied. (There was a weak-key map from SMOB to
1039trampoline functions, where the value had a strong reference on the
1040key.) This has been fixed. There was much rejoicing!
1041
32299e49
AW
1042** Support for HTTP/1.1 chunked transfer coding
1043
1044See "Transfer Codings" in the manual, for more.
1045
d2e35793
AW
1046** Micro-optimizations
1047
1048A pile of micro-optimizations: the `string-trim' function when called
1049with `char-set:whitespace'; the `(web http)' parsers; SMOB application;
1050conversion of raw UTF-8 and UTF-32 data to and from SCM strings; vlists
1051and vhashes; `read' when processing string literals.
1052
1053** Incompatible change to `scandir'
1054
1055As was the original intention, `scandir' now runs the `select?'
1056procedure on all items, including subdirectories and the `.' and `..'
1057entries. It receives the basename of the file in question instead of
1058the full name. We apologize for this incompatible change to this
1059function introduced in the 2.0.4 release.
1060
1061* Manual updates
1062
1063The manual has been made much more consistent in its naming conventions
1064with regards to formal parameters of functions. Thanks to Bake Timmons.
1065
1066* New interfaces
1067
1068** New C function: `scm_to_pointer'
32299e49 1069** New C inline functions: `scm_new_smob', `scm_new_double_smob'
d2e35793
AW
1070** (ice-9 format): Add ~h specifier for localized number output.
1071** (web response): New procedure: `response-must-not-include-body?'
1072** New predicate: 'supports-source-properties?'
8898f43c 1073** New C helpers: `scm_c_values', `scm_c_nvalues'
d2e35793
AW
1074** Newly public inline C function: `scm_unget_byte'
1075** (language tree-il): New functions: `tree-il=?', `tree-il-hash'
1076** New fluid: `%default-port-conversion-strategy'
1077** New syntax: `=>' within `case'
32299e49
AW
1078** (web http): `make-chunked-input-port', `make-chunked-output-port'
1079** (web http): `declare-opaque-header!'
d2e35793
AW
1080
1081Search the manual for these identifiers, for more information.
1082
1083* New deprecations
1084
1085** `close-io-port' deprecated
1086
1087Use `close-port'.
1088
1089** `scm_sym2var' deprecated
1090
1091In most cases, replace with `scm_lookup' or `scm_module_variable'. Use
1092`scm_define' or `scm_module_ensure_local_variable' if the second
1093argument is nonzero. See "Accessing Modules from C" in the manual, for
1094full details.
1095
1096** Lookup closures deprecated
1097
1098These were never documented. See "Module System Reflection" in the
1099manual for replacements.
1100
1101* Build fixes
1102
1103** Fix compilation against uninstalled Guile on non-GNU platforms.
1104** Fix `SCM_I_ERROR' definition for MinGW without networking.
1105** Fix compilation with the Sun C compiler.
1106** Fix check for `clock_gettime' on OpenBSD and some other systems.
1107** Fix build with --enable-debug-malloc.
1108** Honor $(program_transform_name) for the `guile-tools' symlink.
1109** Fix cross-compilation of GOOPS-using code.
1110
1111* Bug fixes
1112
1113** Fix use of unitialized stat buffer in search-path of absolute paths.
1114** Avoid calling `freelocale' with a NULL argument.
1115** Work around erroneous tr_TR locale in Darwin 8 in tests.
1116** Fix `getaddrinfo' test for Darwin 8.
1117** Use Gnulib's `regex' module for better regex portability.
1118** `source-properties' and friends work on any object
1119** Rewrite open-process in C, for robustness related to threads and fork
1120** Fix <TAG>vector-length when applied to other uniform vector types
1121** Fix escape-only prompt optimization (was disabled previously)
1122** Fix a segfault when /dev/urandom is not accessible
1123** Fix flush on soft ports, so that it actually runs.
1124** Better compatibility of SRFI-9 records with core records
1125** Fix and clarify documentation of `sorted?'.
1126** Fix IEEE-754 endianness conversion in bytevectors.
1127** Correct thunk check in the `wind' instruction.
1128** Add @acronym support to texinfo modules
1129** Fix docbook->texi for <ulink> without URL
1130** Fix `setvbuf' to leave the line/column number unchanged.
1131** Add missing public declaration for `scm_take_from_input_buffers'.
1132** Fix relative file name canonicalization with empty %LOAD-PATH entries.
1133** Import newer (ice-9 match) from Chibi-Scheme.
1134** Fix unbound variables and unbound values in ECMAScript runtime.
1135** Make SRFI-6 string ports Unicode-capable.
1136
1137\f
f7cf5898
LC
1138Changes in 2.0.5 (since 2.0.4):
1139
1140This release fixes the binary interface information (SONAME) of
1141libguile, which was incorrect in 2.0.4. It does not contain other
1142changes.
1143
1144\f
f43622a2
AW
1145Changes in 2.0.4 (since 2.0.3):
1146
f41ef416 1147* Notable changes
f43622a2 1148
f41ef416 1149** Better debuggability for interpreted procedures.
f43622a2
AW
1150
1151Guile 2.0 came with a great debugging experience for compiled
1152procedures, but the story for interpreted procedures was terrible. Now,
486bd70d
AW
1153at least, interpreted procedures have names, and the `arity' procedure
1154property is always correct (or, as correct as it can be, in the presence
1155of `case-lambda').
f43622a2
AW
1156
1157** Support for cross-compilation.
1158
1159One can now use a native Guile to cross-compile `.go' files for a
1160different architecture. See the documentation for `--target' in the
486bd70d
AW
1161"Compilation" section of the manual, for information on how to use the
1162cross-compiler. See the "Cross building Guile" section of the README,
1163for more on how to cross-compile Guile itself.
f43622a2 1164
d4b5c773
AW
1165** The return of `local-eval'.
1166
1167Back by popular demand, `the-environment' and `local-eval' allow the
1168user to capture a lexical environment, and then evaluate arbitrary
1169expressions in that context. There is also a new `local-compile'
1170command. See "Local Evaluation" in the manual, for more. Special
1171thanks to Mark Weaver for an initial implementation of this feature.
1172
f43622a2
AW
1173** Fluids can now have default values.
1174
1175Fluids are used for dynamic and thread-local binding. They have always
1176inherited their values from the context or thread that created them.
1177However, there was a case in which a new thread would enter Guile, and
1178the default values of all the fluids would be `#f' for that thread.
1179
1180This has now been fixed so that `make-fluid' has an optional default
486bd70d 1181value for fluids in unrelated dynamic roots, which defaults to `#f'.
f43622a2
AW
1182
1183** Garbage collector tuning.
1184
1185The garbage collector has now been tuned to run more often under some
1186circumstances.
1187
1188*** Unmanaged allocation
1189
1190The new `scm_gc_register_allocation' function will notify the collector
1191of unmanaged allocation. This will cause the collector to run sooner.
1192Guile's `scm_malloc', `scm_calloc', and `scm_realloc' unmanaged
1193allocators eventually call this function. This leads to better
1194performance under steady-state unmanaged allocation.
1195
1196*** Transient allocation
1197
1198When the collector runs, it will try to record the total memory
1199footprint of a process, if the platform supports this information. If
1200the memory footprint is growing, the collector will run more frequently.
1201This reduces the increase of the resident size of a process in response
1202to a transient increase in allocation.
1203
1204*** Management of threads, bignums
1205
1206Creating a thread will allocate a fair amount of memory. Guile now does
1207some GC work (using `GC_collect_a_little') when allocating a thread.
1208This leads to a better memory footprint when creating many short-lived
1209threads.
1210
1211Similarly, bignums can occupy a lot of memory. Guile now offers hooks
1212to enable custom GMP allocators that end up calling
486bd70d 1213`scm_gc_register_allocation'. These allocators are enabled by default
f43622a2
AW
1214when running Guile from the command-line. To enable them in libraries,
1215set the `scm_install_gmp_memory_functions' variable to a nonzero value
1216before loading Guile.
1217
f43622a2
AW
1218** SRFI-39 parameters are available by default.
1219
f41ef416
AW
1220Guile now includes support for parameters, as defined by SRFI-39, in the
1221default environment. See "Parameters" in the manual, for more
1222information. `current-input-port', `current-output-port', and
1223`current-error-port' are now parameters.
f43622a2 1224
d4b5c773 1225** Add `current-warning-port'.
f43622a2 1226
f41ef416
AW
1227Guile now outputs warnings on a separate port, `current-warning-port',
1228initialized to the value that `current-error-port' has on startup.
f43622a2 1229
f41ef416 1230** Syntax parameters.
f43622a2 1231
f41ef416
AW
1232Following Racket's lead, Guile now supports syntax parameters. See
1233"Syntax parameters" in the manual, for more.
f43622a2 1234
f41ef416
AW
1235Also see Barzilay, Culpepper, and Flatt's 2011 SFP workshop paper,
1236"Keeping it Clean with syntax-parameterize".
f43622a2 1237
f41ef416 1238** Parse command-line arguments from the locale encoding.
f43622a2 1239
f41ef416
AW
1240Guile now attempts to parse command-line arguments using the user's
1241locale. However for backwards compatibility with other 2.0.x releases,
1242it does so without actually calling `setlocale'. Please report any bugs
1243in this facility to bug-guile@gnu.org.
f43622a2 1244
d4b5c773
AW
1245** One-armed conditionals: `when' and `unless'
1246
1247Guile finally has `when' and `unless' in the default environment. Use
1248them whenever you would use an `if' with only one branch. See
1249"Conditionals" in the manual, for more.
1250
1251** `current-filename', `add-to-load-path'
1252
1253There is a new form, `(current-filename)', which expands out to the
1254source file in which it occurs. Combined with the new
1255`add-to-load-path', this allows simple scripts to easily add nearby
1256directories to the load path. See "Load Paths" in the manual, for more.
1257
1258** `random-state-from-platform'
1259
1260This procedure initializes a random seed using good random sources
1261available on your platform, such as /dev/urandom. See "Random Number
1262Generation" in the manual, for more.
1263
7cb11224
LC
1264** Warn about unsupported `simple-format' options.
1265
1266The `-Wformat' compilation option now reports unsupported format options
1267passed to `simple-format'.
1268
241247e8
AW
1269** Manual updates
1270
1271Besides the sections already mentioned, the following manual sections
1272are new in this release: "Modules and the File System", "Module System
1273Reflection", "Syntax Transformer Helpers", and "Local Inclusion".
1274
f41ef416
AW
1275* New interfaces
1276
1277** (ice-9 session): `apropos-hook'
1278** New print option: `escape-newlines', defaults to #t.
1279** (ice-9 ftw): `file-system-fold', `file-system-tree', `scandir'
d4b5c773 1280** `scm_c_value_ref': access to multiple returned values from C
07c2ca0f 1281** scm_call (a varargs version), scm_call_7, scm_call_8, scm_call_9
d4b5c773
AW
1282** Some new syntax helpers in (system syntax)
1283
1284Search the manual for these identifiers and modules, for more.
1285
1286* Build fixes
1287
1288** FreeBSD build fixes.
1289** OpenBSD compilation fixes.
1290** Solaris 2.10 test suite fixes.
1291** IA64 compilation fix.
1292** MinGW build fixes.
1293** Work around instruction reordering on SPARC and HPPA in the VM.
1294** Gnulib updates: added `dirfd', `setenv' modules.
f43622a2 1295
f43622a2
AW
1296* Bug fixes
1297
d4b5c773
AW
1298** Add a deprecated alias for $expt.
1299** Add an exception printer for `getaddrinfo-error'.
1300** Add deprecated shim for `scm_display_error' with stack as first argument.
1301** Add warnings for unsupported `simple-format' options.
1302** Allow overlapping regions to be passed to `bytevector-copy!'.
d4b5c773
AW
1303** Better function prologue disassembly
1304** Compiler: fix miscompilation of (values foo ...) in some contexts.
1305** Compiler: fix serialization of #nil-terminated lists.
1306** Compiler: allow values bound in non-tail let expressions to be collected.
1307** Deprecate SCM_ASRTGO.
1308** Document invalidity of (begin) as expression; add back-compat shim.
1309** Don't leak file descriptors when mmaping objcode.
1310** Empty substrings no longer reference the original stringbuf.
1311** FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged.
f43622a2 1312** FFI: Hold a weak reference to the CIF made by `procedure->pointer'.
f41ef416
AW
1313** FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
1314** FFI: Properly unpack small integer return values in closure call.
d4b5c773 1315** Fix R6RS `fold-left' so the accumulator is the first argument.
d4b5c773
AW
1316** Fix bit-set*! bug from 2005.
1317** Fix bug in `make-repl' when `lang' is actually a <language>.
1318** Fix bugs related to mutation, the null string, and shared substrings.
1319** Fix <dynwind> serialization.
1320** Fix erroneous check in `set-procedure-properties!'.
1321** Fix generalized-vector-{ref,set!} for slices.
40e92f09 1322** Fix error messages involving definition forms.
adb8054c 1323** Fix primitive-eval to return #<unspecified> for definitions.
f41ef416 1324** HTTP: Extend handling of "Cache-Control" header.
f43622a2 1325** HTTP: Fix qstring writing of cache-extension values
d4b5c773 1326** HTTP: Fix validators for various list-style headers.
f41ef416 1327** HTTP: Permit non-date values for Expires header.
d4b5c773
AW
1328** HTTP: `write-request-line' writes absolute paths, not absolute URIs.
1329** Hack the port-column of current-output-port after printing a prompt.
d4b5c773
AW
1330** Make sure `regexp-quote' tests use Unicode-capable string ports.
1331** Peval: Fix bugs in the new optimizer.
d4b5c773
AW
1332** Statistically unique marks and labels, for robust hygiene across sessions.
1333** Web: Allow URIs with empty authorities, like "file:///etc/hosts".
1334** `,language' at REPL sets the current-language fluid.
1335** `primitive-load' returns the value(s) of the last expression.
f41ef416 1336** `scm_from_stringn' always returns unique strings.
f41ef416 1337** `scm_i_substring_copy' tries to narrow the substring.
d4b5c773 1338** i18n: Fix gc_malloc/free mismatch on non-GNU systems.
f43622a2 1339
7cb11224 1340\f
02f91898
AW
1341Changes in 2.0.3 (since 2.0.2):
1342
1343* Speed improvements
1344
1345** Guile has a new optimizer, `peval'.
1346
1347`Peval' is a partial evaluator that performs constant folding, dead code
1348elimination, copy propagation, and inlining. By default it runs on
1349every piece of code that Guile compiles, to fold computations that can
1350happen at compile-time, so they don't have to happen at runtime.
1351
1352If we did our job right, the only impact you would see would be your
1353programs getting faster. But if you notice slowdowns or bloated code,
1354please send a mail to bug-guile@gnu.org with details.
1355
1356Thanks to William R. Cook, Oscar Waddell, and Kent Dybvig for inspiring
1357peval and its implementation.
1358
1359You can see what peval does on a given piece of code by running the new
1360`,optimize' REPL meta-command, and comparing it to the output of
1361`,expand'. See "Compile Commands" in the manual, for more.
1362
1363** Fewer calls to `stat'.
1364
1365Guile now stats only the .go file and the .scm file when loading a fresh
1366compiled file.
1367
1368* Notable changes
1369
1370** New module: `(web client)', a simple synchronous web client.
1371
1372See "Web Client" in the manual, for more.
1373
1374** Users can now install compiled `.go' files.
1375
1376See "Installing Site Packages" in the manual.
1377
1378** Remove Front-Cover and Back-Cover text from the manual.
1379
1380The manual is still under the GNU Free Documentation License, but no
1381longer has any invariant sections.
1382
1383** More helpful `guild help'.
1384
1385`guild' is Guile's multi-tool, for use in shell scripting. Now it has a
1386nicer interface for querying the set of existing commands, and getting
1387help on those commands. Try it out and see!
1388
1389** New macro: `define-syntax-rule'
1390
1391`define-syntax-rule' is a shorthand to make a `syntax-rules' macro with
1392one clause. See "Syntax Rules" in the manual, for more.
1393
1394** The `,time' REPL meta-command now has more precision.
1395
1396The output of this command now has microsecond precision, instead of
139710-millisecond precision.
1398
1399** `(ice-9 match)' can now match records.
1400
1401See "Pattern Matching" in the manual, for more on matching records.
1402
1403** New module: `(language tree-il debug)'.
1404
1405This module provides a tree-il verifier. This is useful for people that
1406generate tree-il, usually as part of a language compiler.
1407
1408** New functions: `scm_is_exact', `scm_is_inexact'.
1409
1410These provide a nice C interface for Scheme's `exact?' and `inexact?',
1411respectively.
1412
1413* Bugs fixed
1414
1415See the git log (or the ChangeLog) for more details on these bugs.
1416
1417** Fix order of importing modules and resolving duplicates handlers.
1418** Fix a number of bugs involving extended (merged) generics.
1419** Fix invocation of merge-generics duplicate handler.
1420** Fix write beyond array end in arrays.c.
1421** Fix read beyond end of hashtable size array in hashtab.c.
1422** (web http): Locale-independent parsing and serialization of dates.
1423** Ensure presence of Host header in HTTP/1.1 requests.
1424** Fix take-right and drop-right for improper lists.
1425** Fix leak in get_current_locale().
1426** Fix recursive define-inlinable expansions.
1427** Check that srfi-1 procedure arguments are procedures.
1428** Fix r6rs `map' for multiple returns.
1429** Fix scm_tmpfile leak on POSIX platforms.
1430** Fix a couple of leaks (objcode->bytecode, make-boot-program).
1431** Fix guile-lib back-compatibility for module-stexi-documentation.
1432** Fix --listen option to allow other ports.
1433** Fix scm_to_latin1_stringn for substrings.
1434** Fix compilation of untyped arrays of rank not 1.
1435** Fix unparse-tree-il of <dynset>.
1436** Fix reading of #||||#.
2be3feb1
LC
1437** Fix segfault in GOOPS when class fields are redefined.
1438** Prefer poll(2) over select(2) to allow file descriptors above FD_SETSIZE.
02f91898
AW
1439
1440\f
e4a2807e
AW
1441Changes in 2.0.2 (since 2.0.1):
1442
1443* Notable changes
1444
2dd49486
AW
1445** `guile-tools' renamed to `guild'
1446
1447The new name is shorter. Its intended future use is for a CPAN-like
1448system for Guile wizards and journeyfolk to band together to share code;
1449hence the name. `guile-tools' is provided as a backward-compatible
1450symbolic link. See "Using Guile Tools" in the manual, for more.
1451
e4a2807e
AW
1452** New control operators: `shift' and `reset'
1453
1454See "Shift and Reset" in the manual, for more information.
1455
1456** `while' as an expression
1457
1458Previously the return value of `while' was unspecified. Now its
1459values are specified both in the case of normal termination, and via
1460termination by invoking `break', possibly with arguments. See "while
1461do" in the manual for more.
1462
1463** Disallow access to handles of weak hash tables
1464
1465`hash-get-handle' and `hash-create-handle!' are no longer permitted to
1466be called on weak hash tables, because the fields in a weak handle could
1467be nulled out by the garbage collector at any time, but yet they are
1468otherwise indistinguishable from pairs. Use `hash-ref' and `hash-set!'
1469instead.
1470
1471** More precision for `get-internal-run-time', `get-internal-real-time'
1472
1473On 64-bit systems which support POSIX clocks, Guile's internal timing
1474procedures offer nanosecond resolution instead of the 10-millisecond
1475resolution previously available. 32-bit systems now use 1-millisecond
1476timers.
1477
1478** Guile now measures time spent in GC
1479
1480`gc-stats' now returns a meaningful value for `gc-time-taken'.
1481
1482** Add `gcprof'
1483
1484The statprof profiler now exports a `gcprof' procedure, driven by the
1485`after-gc-hook', to see which parts of your program are causing GC. Let
1486us know if you find it useful.
1487
1488** `map', `for-each' and some others now implemented in Scheme
1489
1490We would not mention this in NEWS, as it is not a user-visible change,
1491if it were not for one thing: `map' and `for-each' are no longer
1492primitive generics. Instead they are normal bindings, which can be
1493wrapped by normal generics. This fixes some modularity issues between
1494core `map', SRFI-1 `map', and GOOPS.
1495
1496Also it's pretty cool that we can do this without a performance impact.
1497
1498** Add `scm_peek_byte_or_eof'.
1499
1500This helper is like `scm_peek_char_or_eof', but for bytes instead of
1501full characters.
1502
1503** Implement #:stop-at-first-non-option option for getopt-long
1504
1505See "getopt-long Reference" in the manual, for more information.
1506
1507** Improve R6RS conformance for conditions in the I/O libraries
1508
1509The `(rnrs io simple)' module now raises the correct R6RS conditions in
1510error cases. `(rnrs io ports)' is also more correct now, though it is
1511still a work in progress.
1512
1513** All deprecated routines emit warnings
1514
1515A few deprecated routines were lacking deprecation warnings. This has
1516been fixed now.
1517
1518* Speed improvements
1519
1520** Constants in compiled code now share state better
1521
1522Constants with shared state, like `("foo")' and `"foo"', now share state
1523as much as possible, in the entire compilation unit. This cuts compiled
1524`.go' file sizes in half, generally, and speeds startup.
1525
1526** VLists: optimize `vlist-fold-right', and add `vhash-fold-right'
1527
1528These procedures are now twice as fast as they were.
1529
1530** UTF-8 ports to bypass `iconv' entirely
1531
1532This reduces memory usage in a very common case.
1533
1534** Compiler speedups
1535
1536The compiler is now about 40% faster. (Note that this is only the case
1537once the compiler is itself compiled, so the build still takes as long
1538as it did before.)
1539
1540** VM speed tuning
1541
1542Some assertions that were mostly useful for sanity-checks on the
1543bytecode compiler are now off for both "regular" and "debug" engines.
1544This together with a fix to cache a TLS access and some other tweaks
1545improve the VM's performance by about 20%.
1546
1547** SRFI-1 list-set optimizations
1548
1549lset-adjoin and lset-union now have fast paths for eq? sets.
1550
1551** `memq', `memv' optimizations
1552
1553These procedures are now at least twice as fast than in 2.0.1.
1554
1555* Deprecations
1556
1557** Deprecate scm_whash API
1558
1559`scm_whash_get_handle', `SCM_WHASHFOUNDP', `SCM_WHASHREF',
1560`SCM_WHASHSET', `scm_whash_create_handle', `scm_whash_lookup', and
1561`scm_whash_insert' are now deprecated. Use the normal hash table API
1562instead.
1563
1564** Deprecate scm_struct_table
1565
1566`SCM_STRUCT_TABLE_NAME', `SCM_SET_STRUCT_TABLE_NAME',
1567`SCM_STRUCT_TABLE_CLASS', `SCM_SET_STRUCT_TABLE_CLASS',
1568`scm_struct_table', and `scm_struct_create_handle' are now deprecated.
1569These routines formed part of the internals of the map between structs
1570and classes.
1571
1572** Deprecate scm_internal_dynamic_wind
1573
1574The `scm_t_inner' type and `scm_internal_dynamic_wind' are deprecated,
1575as the `scm_dynwind' API is better, and this API encourages users to
1576stuff SCM values into pointers.
1577
1578** Deprecate scm_immutable_cell, scm_immutable_double_cell
1579
1580These routines are deprecated, as the GC_STUBBORN API doesn't do
1581anything any more.
1582
1583* Manual updates
1584
1585Andreas Rottman kindly transcribed the missing parts of the `(rnrs io
1586ports)' documentation from the R6RS documentation. Thanks Andreas!
1587
1588* Bugs fixed
1589
1590** Fix double-loading of script in -ds case
1591** -x error message fix
1592** iconveh-related cross-compilation fixes
1593** Fix small integer return value packing on big endian machines.
1594** Fix hash-set! in weak-value table from non-immediate to immediate
1595** Fix call-with-input-file & relatives for multiple values
1596** Fix `hash' for inf and nan
1597** Fix libguile internal type errors caught by typing-strictness==2
f39779b1
LC
1598** Fix compile error in MinGW fstat socket detection
1599** Fix generation of auto-compiled file names on MinGW
e4a2807e
AW
1600** Fix multithreaded access to internal hash tables
1601** Emit a 1-based line number in error messages
1602** Fix define-module ordering
7505c6e0 1603** Fix several POSIX functions to use the locale encoding
f39779b1
LC
1604** Add type and range checks to the complex generalized vector accessors
1605** Fix unaligned accesses for bytevectors of complex numbers
1606** Fix '(a #{.} b)
1607** Fix erroneous VM stack overflow for canceled threads
e4a2807e
AW
1608
1609\f
882c8963
MW
1610Changes in 2.0.1 (since 2.0.0):
1611
7c81eba2 1612* Notable changes
9d6a151f 1613
7c81eba2 1614** guile.m4 supports linking with rpath
9d6a151f 1615
7c81eba2
AW
1616The GUILE_FLAGS macro now sets GUILE_LIBS and GUILE_LTLIBS, which
1617include appropriate directives to the linker to include libguile-2.0.so
1618in the runtime library lookup path.
9d6a151f 1619
7c81eba2 1620** `begin' expands macros in its body before other expressions
9d6a151f 1621
7c81eba2 1622This enables support for programs like the following:
9d6a151f 1623
7c81eba2
AW
1624 (begin
1625 (define even?
1626 (lambda (x)
1627 (or (= x 0) (odd? (- x 1)))))
1628 (define-syntax odd?
1629 (syntax-rules ()
1630 ((odd? x) (not (even? x)))))
1631 (even? 10))
9d6a151f 1632
7c81eba2 1633** REPL reader usability enhancements
9d6a151f 1634
7c81eba2
AW
1635The REPL now flushes input after a read error, which should prevent one
1636error from causing other errors. The REPL also now interprets comments
1637as whitespace.
9d6a151f 1638
7c81eba2 1639** REPL output has configurable width
9d6a151f 1640
7c81eba2
AW
1641The REPL now defaults to output with the current terminal's width, in
1642columns. See "Debug Commands" in the manual for more information on
1643the ,width command.
9d6a151f 1644
7c81eba2 1645** Better C access to the module system
9d6a151f 1646
7c81eba2
AW
1647Guile now has convenient C accessors to look up variables or values in
1648modules and their public interfaces. See `scm_c_public_ref' and friends
1649in "Accessing Modules from C" in the manual.
9d6a151f 1650
7c81eba2 1651** Added `scm_call_5', `scm_call_6'
9d6a151f 1652
7c81eba2 1653See "Fly Evaluation" in the manual.
9d6a151f 1654
7c81eba2 1655** Added `scm_from_latin1_keyword', `scm_from_utf8_keyword'
9d6a151f 1656
7c81eba2
AW
1657See "Keyword Procedures" in the manual, for more. Note that
1658`scm_from_locale_keyword' should not be used when the name is a C string
1659constant.
9d6a151f 1660
7c81eba2 1661** R6RS unicode and string I/O work
9d6a151f 1662
7c81eba2
AW
1663Added efficient implementations of `get-string-n' and `get-string-n!'
1664for binary ports. Exported `current-input-port', `current-output-port'
1665and `current-error-port' from `(rnrs io ports)', and enhanced support
1666for transcoders.
9d6a151f 1667
7c81eba2 1668** Added `pointer->scm', `scm->pointer' to `(system foreign)'
9d6a151f 1669
7c81eba2
AW
1670These procedure are useful if one needs to pass and receive SCM values
1671to and from foreign functions. See "Foreign Variables" in the manual,
1672for more.
9d6a151f 1673
7c81eba2 1674** Added `heap-allocated-since-gc' to `(gc-stats)'
9d6a151f 1675
7c81eba2 1676Also fixed the long-standing bug in the REPL `,stat' command.
9d6a151f 1677
7c81eba2 1678** Add `on-error' REPL option
9d6a151f 1679
7c81eba2
AW
1680This option controls what happens when an error occurs at the REPL, and
1681defaults to `debug', indicating that Guile should enter the debugger.
1682Other values include `report', which will simply print a backtrace
1683without entering the debugger. See "System Commands" in the manual.
9d6a151f 1684
7c81eba2 1685** Enforce immutability of string literals
9d6a151f 1686
7c81eba2 1687Attempting to mutate a string literal now causes a runtime error.
9d6a151f 1688
7c81eba2 1689** Fix pthread redirection
9d6a151f 1690
7c81eba2
AW
1691Guile 2.0.0 shipped with headers that, if configured with pthread
1692support, would re-define `pthread_create', `pthread_join', and other API
1693to redirect to the BDW-GC wrappers, `GC_pthread_create', etc. This was
1694unintended, and not necessary: because threads must enter Guile with
2e6829d2 1695`scm_with_guile', Guile can handle thread registration itself, without
7c81eba2
AW
1696needing to make the GC aware of all threads. This oversight has been
1697fixed.
9d6a151f 1698
7c81eba2 1699** `with-continuation-barrier' now unwinds on `quit'
9d6a151f 1700
7c81eba2
AW
1701A throw to `quit' in a continuation barrier will cause Guile to exit.
1702Before, it would do so before unwinding to the barrier, which would
1703prevent cleanup handlers from running. This has been fixed so that it
1704exits only after unwinding.
9d6a151f 1705
7c81eba2 1706** `string->pointer' and `pointer->string' have optional encoding arg
9d6a151f 1707
7c81eba2
AW
1708This allows users of the FFI to more easily deal in strings with
1709particular (non-locale) encodings, like "utf-8". See "Void Pointers and
1710Byte Access" in the manual, for more.
9d6a151f 1711
7c81eba2 1712** R6RS fixnum arithmetic optimizations
9d6a151f 1713
7c81eba2
AW
1714R6RS fixnum operations are are still slower than generic arithmetic,
1715however.
9d6a151f 1716
7c81eba2 1717** New procedure: `define-inlinable'
9d6a151f 1718
7c81eba2 1719See "Inlinable Procedures" in the manual, for more.
9d6a151f 1720
7c81eba2 1721** New procedure: `exact-integer-sqrt'
9d6a151f 1722
7c81eba2 1723See "Integer Operations" in the manual, for more.
9d6a151f 1724
7c81eba2 1725** "Extended read syntax" for symbols parses better
9d6a151f 1726
7c81eba2
AW
1727In #{foo}# symbols, backslashes are now treated as escapes, as the
1728symbol-printing code intended. Additionally, "\x" within #{foo}# is now
1729interpreted as starting an R6RS hex escape. This is backward compatible
1730because the symbol printer would never produce a "\x" before. The
1731printer also works better too.
9d6a151f 1732
6b480ced 1733** Added `--fresh-auto-compile' option
1e56cff2
AW
1734
1735This allows a user to invalidate the auto-compilation cache. It's
1736usually not needed. See "Compilation" in the manual, for a discussion.
1737
7c81eba2 1738* Manual updates
9d6a151f 1739
7c81eba2 1740** GOOPS documentation updates
9d6a151f 1741
7c81eba2 1742** New man page
9d6a151f 1743
7c81eba2 1744Thanks to Mark Harig for improvements to guile.1.
9d6a151f 1745
7c81eba2 1746** SRFI-23 documented
9d6a151f 1747
7c81eba2 1748The humble `error' SRFI now has an entry in the manual.
9d6a151f 1749
7c81eba2 1750* New modules
9d6a151f 1751
de424d95 1752** `(ice-9 binary-ports)': "R6RS I/O Ports", in the manual
7c81eba2 1753** `(ice-9 eval-string)': "Fly Evaluation", in the manual
2e6829d2 1754** `(ice-9 command-line)', not documented yet
9d6a151f 1755
882c8963
MW
1756* Bugs fixed
1757
2e6829d2 1758** Fixed `iconv_t' memory leak on close-port
7c81eba2
AW
1759** Fixed some leaks with weak hash tables
1760** Export `vhash-delq' and `vhash-delv' from `(ice-9 vlist)'
1761** `after-gc-hook' works again
1762** `define-record-type' now allowed in nested contexts
1763** `exact-integer-sqrt' now handles large integers correctly
1764** Fixed C extension examples in manual
1765** `vhash-delete' honors HASH argument
1766** Make `locale-digit-grouping' more robust
1767** Default exception printer robustness fixes
1768** Fix presence of non-I CPPFLAGS in `guile-2.0.pc'
1769** `read' updates line/column numbers when reading SCSH block comments
1770** Fix imports of multiple custom interfaces of same module
1771** Fix encoding scanning for non-seekable ports
1772** Fix `setter' when called with a non-setter generic
1773** Fix f32 and f64 bytevectors to not accept rationals
1774** Fix description of the R6RS `finite?' in manual
1775** Quotient, remainder and modulo accept inexact integers again
1776** Fix `continue' within `while' to take zero arguments
1777** Fix alignment for structures in FFI
1778** Fix port-filename of stdin, stdout, stderr to match the docs
1779** Fix weak hash table-related bug in `define-wrapped-pointer-type'
1780** Fix partial continuation application with pending procedure calls
1781** scm_{to,from}_locale_string use current locale, not current ports
1782** Fix thread cleanup, by using a pthread_key destructor
1783** Fix `quit' at the REPL
1784** Fix a failure to sync regs in vm bytevector ops
1785** Fix (texinfo reflection) to handle nested structures like syntax patterns
1786** Fix stexi->html double translation
1787** Fix tree-il->scheme fix for <prompt>
1788** Fix compilation of <prompt> in <fix> in single-value context
1789** Fix race condition in ensure-writable-dir
1790** Fix error message on ,disassemble "non-procedure"
1791** Fix prompt and abort with the boot evaluator
1792** Fix `procedure->pointer' for functions returning `void'
1793** Fix error reporting in dynamic-pointer
1794** Fix problems detecting coding: in block comments
1795** Fix duplicate load-path and load-compiled-path in compilation environment
1796** Add fallback read(2) suppport for .go files if mmap(2) unavailable
1797** Fix c32vector-set!, c64vector-set!
1798** Fix mistakenly deprecated read syntax for uniform complex vectors
1799** Fix parsing of exact numbers with negative exponents
1800** Ignore SIGPIPE in (system repl server)
1801** Fix optional second arg to R6RS log function
1802** Fix R6RS `assert' to return true value.
1803** Fix fencepost error when seeking in bytevector input ports
2e6829d2
LC
1804** Gracefully handle `setlocale' errors when starting the REPL
1805** Improve support of the `--disable-posix' configure option
1806** Make sure R6RS binary ports pass `binary-port?' regardless of the locale
1807** Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'
882c8963 1808
882c8963
MW
1809
1810\f
d9f46472 1811Changes in 2.0.0 (changes since the 1.8.x series):
96b73e84
AW
1812
1813* New modules (see the manual for details)
1814
1815** `(srfi srfi-18)', more sophisticated multithreading support
ef6b0e8d 1816** `(srfi srfi-27)', sources of random bits
7cd99cba 1817** `(srfi srfi-38)', External Representation for Data With Shared Structure
ef6b0e8d
AW
1818** `(srfi srfi-42)', eager comprehensions
1819** `(srfi srfi-45)', primitives for expressing iterative lazy algorithms
1820** `(srfi srfi-67)', compare procedures
96b73e84 1821** `(ice-9 i18n)', internationalization support
7cd99cba 1822** `(ice-9 futures)', fine-grain parallelism
0f13fcde 1823** `(rnrs bytevectors)', the R6RS bytevector API
93617170 1824** `(rnrs io ports)', a subset of the R6RS I/O port API
96b73e84 1825** `(system xref)', a cross-referencing facility (FIXME undocumented)
dbd9532e 1826** `(ice-9 vlist)', lists with constant-time random access; hash lists
fb53c347 1827** `(system foreign)', foreign function interface
18e90860
AW
1828** `(sxml match)', a pattern matcher for SXML
1829** `(srfi srfi-9 gnu)', extensions to the SRFI-9 record library
1830** `(system vm coverage)', a line-by-line code coverage library
7cd99cba
AW
1831** `(web uri)', URI data type, parser, and unparser
1832** `(web http)', HTTP header parsers and unparsers
1833** `(web request)', HTTP request data type, reader, and writer
1834** `(web response)', HTTP response data type, reader, and writer
1835** `(web server)', Generic HTTP server
1836** `(ice-9 poll)', a poll wrapper
1837** `(web server http)', HTTP-over-TCP web server implementation
66ad445d 1838
51cb0cca
AW
1839** Replaced `(ice-9 match)' with Alex Shinn's compatible, hygienic matcher.
1840
1841Guile's copy of Andrew K. Wright's `match' library has been replaced by
1842a compatible hygienic implementation by Alex Shinn. It is now
1843documented, see "Pattern Matching" in the manual.
1844
1845Compared to Andrew K. Wright's `match', the new `match' lacks
1846`match-define', `match:error-control', `match:set-error-control',
1847`match:error', `match:set-error', and all structure-related procedures.
1848
cf8ec359
AW
1849** Imported statprof, SSAX, and texinfo modules from Guile-Lib
1850
1851The statprof statistical profiler, the SSAX XML toolkit, and the texinfo
1852toolkit from Guile-Lib have been imported into Guile proper. See
1853"Standard Library" in the manual for more details.
1854
139fa149
AW
1855** Integration of lalr-scm, a parser generator
1856
1857Guile has included Dominique Boucher's fine `lalr-scm' parser generator
1858as `(system base lalr)'. See "LALR(1) Parsing" in the manual, for more
1859information.
1860
96b73e84
AW
1861* Changes to the stand-alone interpreter
1862
1863** Guile now can compile Scheme to bytecode for a custom virtual machine.
1864
1865Compiled code loads much faster than Scheme source code, and runs around
18663 or 4 times as fast, generating much less garbage in the process.
fa1804e9 1867
29b98fb2 1868** Evaluating Scheme code does not use the C stack.
fa1804e9 1869
29b98fb2
AW
1870Besides when compiling Guile itself, Guile no longer uses a recursive C
1871function as an evaluator. This obviates the need to check the C stack
1872pointer for overflow. Continuations still capture the C stack, however.
fa1804e9 1873
96b73e84
AW
1874** New environment variables: GUILE_LOAD_COMPILED_PATH,
1875 GUILE_SYSTEM_LOAD_COMPILED_PATH
fa1804e9 1876
96b73e84
AW
1877GUILE_LOAD_COMPILED_PATH is for compiled files what GUILE_LOAD_PATH is
1878for source files. It is a different path, however, because compiled
1879files are architecture-specific. GUILE_SYSTEM_LOAD_COMPILED_PATH is like
1880GUILE_SYSTEM_PATH.
1881
1882** New read-eval-print loop (REPL) implementation
1883
51cb0cca
AW
1884Running Guile with no arguments drops the user into the new REPL. See
1885"Using Guile Interactively" in the manual, for more information.
96b73e84 1886
51cb0cca
AW
1887** Remove old Emacs interface
1888
1889Guile had an unused `--emacs' command line argument that was supposed to
1890help when running Guile inside Emacs. This option has been removed, and
1891the helper functions `named-module-use!' and `load-emacs-interface' have
1892been deprecated.
1893
ef6b0e8d
AW
1894** Add `(system repl server)' module and `--listen' command-line argument
1895
1896The `(system repl server)' module exposes procedures to listen on
1897sockets for connections, and serve REPLs to those clients. The --listen
1898command-line argument allows any Guile program to thus be remotely
1899debuggable.
1900
1901See "Invoking Guile" for more information on `--listen'.
1902
7cd99cba
AW
1903** Command line additions
1904
1905The guile binary now supports a new switch "-x", which can be used to
1906extend the list of filename extensions tried when loading files
1907(%load-extensions).
1908
487bacf4
AW
1909** New reader options: `square-brackets', `r6rs-hex-escapes',
1910 `hungry-eol-escapes'
6bf927ab
LC
1911
1912The reader supports a new option (changeable via `read-options'),
1913`square-brackets', which instructs it to interpret square brackets as
29b98fb2 1914parentheses. This option is on by default.
6bf927ab
LC
1915
1916When the new `r6rs-hex-escapes' reader option is enabled, the reader
51cb0cca
AW
1917will recognize string escape sequences as defined in R6RS. R6RS string
1918escape sequences are incompatible with Guile's existing escapes, though,
1919so this option is off by default.
6bf927ab 1920
487bacf4
AW
1921Additionally, Guile follows the R6RS newline escaping rules when the
1922`hungry-eol-escapes' option is enabled.
1923
1924See "String Syntax" in the manual, for more information.
1925
cf8ec359
AW
1926** Function profiling and tracing at the REPL
1927
1928The `,profile FORM' REPL meta-command can now be used to statistically
1929profile execution of a form, to see which functions are taking the most
1930time. See `,help profile' for more information.
1931
1932Similarly, `,trace FORM' traces all function applications that occur
1933during the execution of `FORM'. See `,help trace' for more information.
1934
51cb0cca
AW
1935** Recursive debugging REPL on error
1936
1937When Guile sees an error at the REPL, instead of saving the stack, Guile
1938will directly enter a recursive REPL in the dynamic context of the
1939error. See "Error Handling" in the manual, for more information.
1940
1941A recursive REPL is the same as any other REPL, except that it
1942has been augmented with debugging information, so that one can inspect
1943the context of the error. The debugger has been integrated with the REPL
1944via a set of debugging meta-commands.
cf8ec359 1945
51cb0cca
AW
1946For example, one may access a backtrace with `,backtrace' (or
1947`,bt'). See "Interactive Debugging" in the manual, for more
1948information.
cf8ec359 1949
96b73e84
AW
1950** New `guile-tools' commands: `compile', `disassemble'
1951
93617170 1952Pass the `--help' command-line option to these commands for more
96b73e84
AW
1953information.
1954
b0217d17
AW
1955** Guile now adds its install prefix to the LTDL_LIBRARY_PATH
1956
1957Users may now install Guile to nonstandard prefixes and just run
1958`/path/to/bin/guile', instead of also having to set LTDL_LIBRARY_PATH to
1959include `/path/to/lib'.
1960
1961** Guile's Emacs integration is now more keyboard-friendly
1962
1963Backtraces may now be disclosed with the keyboard in addition to the
1964mouse.
1965
cf8ec359
AW
1966** Load path change: search in version-specific paths before site paths
1967
1968When looking for a module, Guile now searches first in Guile's
1969version-specific path (the library path), *then* in the site dir. This
1970allows Guile's copy of SSAX to override any Guile-Lib copy the user has
1971installed. Also it should cut the number of `stat' system calls by half,
1972in the common case.
1973
51cb0cca
AW
1974** Value history in the REPL on by default
1975
1976By default, the REPL will save computed values in variables like `$1',
1977`$2', and the like. There are programmatic and interactive interfaces to
1978control this. See "Value History" in the manual, for more information.
1979
1980** Readline tab completion for arguments
1981
1982When readline is enabled, tab completion works for arguments too, not
1983just for the operator position.
1984
7cd99cba
AW
1985** Expression-oriented readline history
1986
1987Guile's readline history now tries to operate on expressions instead of
1988input lines. Let us know what you think!
1989
139fa149
AW
1990** Interactive Guile follows GNU conventions
1991
1992As recommended by the GPL, Guile now shows a brief copyright and
1993warranty disclaimer on startup, along with pointers to more information.
cf8ec359 1994
96b73e84
AW
1995* Changes to Scheme functions and syntax
1996
18e90860
AW
1997** Support for R6RS libraries
1998
1999The `library' and `import' forms from the latest Scheme report have been
2000added to Guile, in such a way that R6RS libraries share a namespace with
2001Guile modules. R6RS modules may import Guile modules, and are available
2002for Guile modules to import via use-modules and all the rest. See "R6RS
2003Libraries" in the manual for more information.
2004
2005** Implementations of R6RS libraries
2006
2007Guile now has implementations for all of the libraries defined in the
2008R6RS. Thanks to Julian Graham for this excellent hack. See "R6RS
2009Standard Libraries" in the manual for a full list of libraries.
2010
2011** Partial R6RS compatibility
2012
2013Guile now has enough support for R6RS to run a reasonably large subset
2014of R6RS programs.
2015
2016Guile is not fully R6RS compatible. Many incompatibilities are simply
2017bugs, though some parts of Guile will remain R6RS-incompatible for the
2018foreseeable future. See "R6RS Incompatibilities" in the manual, for more
2019information.
2020
2021Please contact bug-guile@gnu.org if you have found an issue not
2022mentioned in that compatibility list.
2023
4a457691
AW
2024** New implementation of `primitive-eval'
2025
2026Guile's `primitive-eval' is now implemented in Scheme. Actually there is
2027still a C evaluator, used when building a fresh Guile to interpret the
2028compiler, so we can compile eval.scm. Thereafter all calls to
2029primitive-eval are implemented by VM-compiled code.
2030
2031This allows all of Guile's procedures, be they interpreted or compiled,
2032to execute on the same stack, unifying multiple-value return semantics,
2033providing for proper tail recursion between interpreted and compiled
2034code, and simplifying debugging.
2035
2036As part of this change, the evaluator no longer mutates the internal
2037representation of the code being evaluated in a thread-unsafe manner.
2038
2039There are two negative aspects of this change, however. First, Guile
2040takes a lot longer to compile now. Also, there is less debugging
2041information available for debugging interpreted code. We hope to improve
2042both of these situations.
2043
2044There are many changes to the internal C evalator interface, but all
2045public interfaces should be the same. See the ChangeLog for details. If
2046we have inadvertantly changed an interface that you were using, please
2047contact bug-guile@gnu.org.
2048
96b73e84
AW
2049** Procedure removed: `the-environment'
2050
2051This procedure was part of the interpreter's execution model, and does
2052not apply to the compiler.
fa1804e9 2053
4a457691
AW
2054** No more `local-eval'
2055
2056`local-eval' used to exist so that one could evaluate code in the
2057lexical context of a function. Since there is no way to get the lexical
2058environment any more, as that concept has no meaning for the compiler,
2059and a different meaning for the interpreter, we have removed the
2060function.
2061
2062If you think you need `local-eval', you should probably implement your
2063own metacircular evaluator. It will probably be as fast as Guile's
2064anyway.
2065
139fa149 2066** Scheme source files will now be compiled automatically.
fa1804e9
AW
2067
2068If a compiled .go file corresponding to a .scm file is not found or is
2069not fresh, the .scm file will be compiled on the fly, and the resulting
2070.go file stored away. An advisory note will be printed on the console.
2071
51cb0cca
AW
2072Note that this mechanism depends on the timestamp of the .go file being
2073newer than that of the .scm file; if the .scm or .go files are moved
2074after installation, care should be taken to preserve their original
fa1804e9
AW
2075timestamps.
2076
6f06e8d3 2077Auto-compiled files will be stored in the $XDG_CACHE_HOME/guile/ccache
19fef497
AW
2078directory, where $XDG_CACHE_HOME defaults to ~/.cache. This directory
2079will be created if needed.
fa1804e9 2080
6f06e8d3
AW
2081To inhibit automatic compilation, set the GUILE_AUTO_COMPILE environment
2082variable to 0, or pass --no-auto-compile on the Guile command line.
fa1804e9 2083
96b73e84 2084** New POSIX procedures: `getrlimit' and `setrlimit'
fa1804e9 2085
96b73e84
AW
2086Note however that the interface of these functions is likely to change
2087in the next prerelease.
fa1804e9 2088
4a457691
AW
2089** New POSIX procedure: `getsid'
2090
2091Scheme binding for the `getsid' C library call.
2092
dbd9532e
LC
2093** New POSIX procedure: `getaddrinfo'
2094
2095Scheme binding for the `getaddrinfo' C library function.
2096
7cd99cba
AW
2097** Multicast socket options
2098
2099Support was added for the IP_MULTICAST_TTL and IP_MULTICAST_IF socket
2100options. See "Network Sockets and Communication" in the manual, for
2101more information.
2102
487bacf4
AW
2103** `recv!', `recvfrom!', `send', `sendto' now deal in bytevectors
2104
2105These socket procedures now take bytevectors as arguments, instead of
2106strings. There is some deprecated string support, however.
2107
7cd99cba
AW
2108** New GNU procedures: `setaffinity' and `getaffinity'.
2109
2110See "Processes" in the manual, for more information.
2111
2112** New procedures: `compose', `negate', and `const'
2113
2114See "Higher-Order Functions" in the manual, for more information.
2115
96b73e84 2116** New procedure in `(oops goops)': `method-formals'
fa1804e9 2117
96b73e84
AW
2118** New procedures in (ice-9 session): `add-value-help-handler!',
2119 `remove-value-help-handler!', `add-name-help-handler!'
29b98fb2 2120 `remove-name-help-handler!', `procedure-arguments'
fa1804e9 2121
96b73e84
AW
2122The value and name help handlers provide some minimal extensibility to
2123the help interface. Guile-lib's `(texinfo reflection)' uses them, for
2124example, to make stexinfo help documentation available. See those
2125procedures' docstrings for more information.
2126
2127`procedure-arguments' describes the arguments that a procedure can take,
2128combining arity and formals. For example:
2129
2130 (procedure-arguments resolve-interface)
2131 => ((required . (name)) (rest . args))
fa1804e9 2132
96b73e84
AW
2133Additionally, `module-commentary' is now publically exported from
2134`(ice-9 session).
2135
cf8ec359 2136** Removed: `procedure->memoizing-macro', `procedure->syntax'
96b73e84 2137
cf8ec359
AW
2138These procedures created primitive fexprs for the old evaluator, and are
2139no longer supported. If you feel that you need these functions, you
2140probably need to write your own metacircular evaluator (which will
2141probably be as fast as Guile's, anyway).
96b73e84
AW
2142
2143** New language: ECMAScript
2144
2145Guile now ships with one other high-level language supported,
2146ECMAScript. The goal is to support all of version 3.1 of the standard,
2147but not all of the libraries are there yet. This support is not yet
2148documented; ask on the mailing list if you are interested.
2149
19fef497
AW
2150** New language: Brainfuck
2151
2152Brainfuck is a toy language that closely models Turing machines. Guile's
2153brainfuck compiler is meant to be an example of implementing other
2154languages. See the manual for details, or
2155http://en.wikipedia.org/wiki/Brainfuck for more information about the
2156Brainfuck language itself.
2157
4a457691
AW
2158** New language: Elisp
2159
2160Guile now has an experimental Emacs Lisp compiler and runtime. You can
2161now switch to Elisp at the repl: `,language elisp'. All kudos to Daniel
7cd99cba 2162Kraft and Brian Templeton, and all bugs to bug-guile@gnu.org.
4a457691 2163
139fa149
AW
2164** Better documentation infrastructure for macros
2165
2166It is now possible to introspect on the type of a macro, e.g.
2167syntax-rules, identifier-syntax, etc, and extract information about that
2168macro, such as the syntax-rules patterns or the defmacro arguments.
2169`(texinfo reflection)' takes advantage of this to give better macro
2170documentation.
2171
139fa149
AW
2172** Support for arbitrary procedure metadata
2173
2174Building on its support for docstrings, Guile now supports multiple
2175docstrings, adding them to the tail of a compiled procedure's
2176properties. For example:
2177
2178 (define (foo)
2179 "one"
2180 "two"
2181 3)
29b98fb2 2182 (procedure-properties foo)
139fa149
AW
2183 => ((name . foo) (documentation . "one") (documentation . "two"))
2184
2185Also, vectors of pairs are now treated as additional metadata entries:
2186
2187 (define (bar)
2188 #((quz . #f) (docstring . "xyzzy"))
2189 3)
29b98fb2 2190 (procedure-properties bar)
139fa149
AW
2191 => ((name . bar) (quz . #f) (docstring . "xyzzy"))
2192
2193This allows arbitrary literals to be embedded as metadata in a compiled
2194procedure.
2195
96b73e84
AW
2196** The psyntax expander now knows how to interpret the @ and @@ special
2197 forms.
2198
2199** The psyntax expander is now hygienic with respect to modules.
2200
2201Free variables in a macro are scoped in the module that the macro was
2202defined in, not in the module the macro is used in. For example, code
2203like this works now:
2204
2205 (define-module (foo) #:export (bar))
2206 (define (helper x) ...)
2207 (define-syntax bar
2208 (syntax-rules () ((_ x) (helper x))))
2209
2210 (define-module (baz) #:use-module (foo))
2211 (bar qux)
2212
2213It used to be you had to export `helper' from `(foo)' as well.
2214Thankfully, this has been fixed.
2215
51cb0cca 2216** Support for version information in Guile's `module' form
cf8ec359 2217
51cb0cca
AW
2218Guile modules now have a `#:version' field. See "R6RS Version
2219References", "General Information about Modules", "Using Guile Modules",
2220and "Creating Guile Modules" in the manual for more information.
96b73e84 2221
cf8ec359
AW
2222** Support for renaming bindings on module export
2223
2224Wherever Guile accepts a symbol as an argument to specify a binding to
2225export, it now also accepts a pair of symbols, indicating that a binding
2226should be renamed on export. See "Creating Guile Modules" in the manual
2227for more information.
96b73e84 2228
18e90860
AW
2229** New procedure: `module-export-all!'
2230
2231This procedure exports all current and future bindings from a module.
2232Use as `(module-export-all! (current-module))'.
2233
7cd99cba
AW
2234** New procedure `reload-module', and `,reload' REPL command
2235
2236See "Module System Reflection" and "Module Commands" in the manual, for
2237more information.
2238
96b73e84
AW
2239** `eval-case' has been deprecated, and replaced by `eval-when'.
2240
29b98fb2
AW
2241The semantics of `eval-when' are easier to understand. See "Eval When"
2242in the manual, for more information.
96b73e84
AW
2243
2244** Guile is now more strict about prohibiting definitions in expression
2245 contexts.
2246
2247Although previous versions of Guile accepted it, the following
2248expression is not valid, in R5RS or R6RS:
2249
2250 (if test (define foo 'bar) (define foo 'baz))
2251
2252In this specific case, it would be better to do:
2253
2254 (define foo (if test 'bar 'baz))
2255
79b3863d
AW
2256It is possible to circumvent this restriction with e.g.
2257`(module-define! (current-module) 'foo 'baz)'. Contact the list if you
2258have any questions.
96b73e84 2259
51cb0cca
AW
2260** Support for `letrec*'
2261
2262Guile now supports `letrec*', a recursive lexical binding operator in
2263which the identifiers are bound in order. See "Local Bindings" in the
2264manual, for more details.
2265
2266** Internal definitions now expand to `letrec*'
2267
2268Following the R6RS, internal definitions now expand to letrec* instead
2269of letrec. The following program is invalid for R5RS, but valid for
2270R6RS:
2271
2272 (define (foo)
2273 (define bar 10)
2274 (define baz (+ bar 20))
2275 baz)
2276
2277 ;; R5RS and Guile <= 1.8:
2278 (foo) => Unbound variable: bar
2279 ;; R6RS and Guile >= 2.0:
2280 (foo) => 30
2281
2282This change should not affect correct R5RS programs, or programs written
2283in earlier Guile dialects.
2284
18e90860
AW
2285** Macro expansion produces structures instead of s-expressions
2286
2287In the olden days, macroexpanding an s-expression would yield another
2288s-expression. Though the lexical variables were renamed, expansions of
2289core forms like `if' and `begin' were still non-hygienic, as they relied
2290on the toplevel definitions of `if' et al being the conventional ones.
2291
2292The solution is to expand to structures instead of s-expressions. There
2293is an `if' structure, a `begin' structure, a `toplevel-ref' structure,
2294etc. The expander already did this for compilation, producing Tree-IL
2295directly; it has been changed now to do so when expanding for the
2296evaluator as well.
2297
96b73e84
AW
2298** Defmacros must now produce valid Scheme expressions.
2299
2300It used to be that defmacros could unquote in Scheme values, as a way of
2301supporting partial evaluation, and avoiding some hygiene issues. For
2302example:
2303
2304 (define (helper x) ...)
2305 (define-macro (foo bar)
2306 `(,helper ,bar))
2307
2308Assuming this macro is in the `(baz)' module, the direct translation of
2309this code would be:
2310
2311 (define (helper x) ...)
2312 (define-macro (foo bar)
2313 `((@@ (baz) helper) ,bar))
2314
2315Of course, one could just use a hygienic macro instead:
2316
2317 (define-syntax foo
2318 (syntax-rules ()
2319 ((_ bar) (helper bar))))
2320
2321** Guile's psyntax now supports docstrings and internal definitions.
2322
2323The following Scheme is not strictly legal:
2324
2325 (define (foo)
2326 "bar"
2327 (define (baz) ...)
2328 (baz))
2329
2330However its intent is fairly clear. Guile interprets "bar" to be the
2331docstring of `foo', and the definition of `baz' is still in definition
2332context.
2333
51cb0cca
AW
2334** Support for settable identifier syntax
2335
2336Following the R6RS, "variable transformers" are settable
2337identifier-syntax. See "Identifier macros" in the manual, for more
2338information.
2339
2340** syntax-case treats `_' as a placeholder
2341
2342Following R6RS, a `_' in a syntax-rules or syntax-case pattern matches
2343anything, and binds no pattern variables. Unlike the R6RS, Guile also
2344permits `_' to be in the literals list for a pattern.
2345
96b73e84
AW
2346** Macros need to be defined before their first use.
2347
2348It used to be that with lazy memoization, this might work:
2349
2350 (define (foo x)
2351 (ref x))
2352 (define-macro (ref x) x)
2353 (foo 1) => 1
2354
2355But now, the body of `foo' is interpreted to mean a call to the toplevel
2356`ref' function, instead of a macro expansion. The solution is to define
2357macros before code that uses them.
2358
2359** Functions needed by macros at expand-time need to be present at
2360 expand-time.
2361
2362For example, this code will work at the REPL:
2363
2364 (define (double-helper x) (* x x))
2365 (define-macro (double-literal x) (double-helper x))
2366 (double-literal 2) => 4
2367
2368But it will not work when a file is compiled, because the definition of
2369`double-helper' is not present at expand-time. The solution is to wrap
2370the definition of `double-helper' in `eval-when':
2371
2372 (eval-when (load compile eval)
2373 (define (double-helper x) (* x x)))
2374 (define-macro (double-literal x) (double-helper x))
2375 (double-literal 2) => 4
2376
29b98fb2 2377See the documentation for eval-when for more information.
96b73e84 2378
29b98fb2 2379** `macroexpand' produces structures, not S-expressions.
96b73e84 2380
29b98fb2
AW
2381Given the need to maintain referential transparency, both lexically and
2382modular, the result of expanding Scheme expressions is no longer itself
2383an s-expression. If you want a human-readable approximation of the
2384result of `macroexpand', call `tree-il->scheme' from `(language
2385tree-il)'.
96b73e84 2386
29b98fb2 2387** Removed function: `macroexpand-1'
96b73e84 2388
29b98fb2
AW
2389It is unclear how to implement `macroexpand-1' with syntax-case, though
2390PLT Scheme does prove that it is possible.
fa1804e9
AW
2391
2392** New reader macros: #' #` #, #,@
2393
2394These macros translate, respectively, to `syntax', `quasisyntax',
2395`unsyntax', and `unsyntax-splicing'. See the R6RS for more information.
2396These reader macros may be overridden by `read-hash-extend'.
2397
2398** Incompatible change to #'
2399
2400Guile did have a #' hash-extension, by default, which just returned the
2401subsequent datum: #'foo => foo. In the unlikely event that anyone
2402actually used this, this behavior may be reinstated via the
2403`read-hash-extend' mechanism.
2404
b47fea09
AW
2405** `unquote' and `unquote-splicing' accept multiple expressions
2406
2407As per the R6RS, these syntax operators can now accept any number of
2408expressions to unquote.
2409
fa1804e9
AW
2410** Scheme expresssions may be commented out with #;
2411
93617170
LC
2412#; comments out an entire expression. See SRFI-62 or the R6RS for more
2413information.
fa1804e9 2414
b0abbaa7
AW
2415** Prompts: Delimited, composable continuations
2416
2417Guile now has prompts as part of its primitive language. See "Prompts"
2418in the manual, for more information.
2419
2420Expressions entered in at the REPL, or from the command line, are
2421surrounded by a prompt with the default prompt tag.
2422
93617170 2423** `make-stack' with a tail-called procedural narrowing argument no longer
fa1804e9
AW
2424 works (with compiled procedures)
2425
2426It used to be the case that a captured stack could be narrowed to select
2427calls only up to or from a certain procedure, even if that procedure
2428already tail-called another procedure. This was because the debug
2429information from the original procedure was kept on the stack.
2430
2431Now with the new compiler, the stack only contains active frames from
2432the current continuation. A narrow to a procedure that is not in the
2433stack will result in an empty stack. To fix this, narrow to a procedure
2434that is active in the current continuation, or narrow to a specific
2435number of stack frames.
2436
29b98fb2 2437** Backtraces through compiled procedures only show procedures that are
fa1804e9
AW
2438 active in the current continuation
2439
2440Similarly to the previous issue, backtraces in compiled code may be
2441different from backtraces in interpreted code. There are no semantic
2442differences, however. Please mail bug-guile@gnu.org if you see any
2443deficiencies with Guile's backtraces.
2444
b47fea09
AW
2445** `positions' reader option enabled by default
2446
2447This change allows primitive-load without --auto-compile to also
2448propagate source information through the expander, for better errors and
2449to let macros know their source locations. The compiler was already
2450turning it on anyway.
2451
51cb0cca
AW
2452** New macro: `current-source-location'
2453
2454The macro returns the current source location (to be documented).
2455
fa1804e9
AW
2456** syntax-rules and syntax-case macros now propagate source information
2457 through to the expanded code
2458
2459This should result in better backtraces.
2460
2461** The currying behavior of `define' has been removed.
2462
2463Before, `(define ((f a) b) (* a b))' would translate to
2464
2465 (define f (lambda (a) (lambda (b) (* a b))))
2466
93617170 2467Now a syntax error is signaled, as this syntax is not supported by
29b98fb2
AW
2468default. Use the `(ice-9 curried-definitions)' module to get back the
2469old behavior.
fa1804e9 2470
4a457691
AW
2471** New procedure, `define!'
2472
2473`define!' is a procedure that takes two arguments, a symbol and a value,
2474and binds the value to the symbol in the current module. It's useful to
2475programmatically make definitions in the current module, and is slightly
2476less verbose than `module-define!'.
2477
fa1804e9
AW
2478** All modules have names now
2479
2480Before, you could have anonymous modules: modules without names. Now,
2481because of hygiene and macros, all modules have names. If a module was
2482created without a name, the first time `module-name' is called on it, a
2483fresh name will be lazily generated for it.
2484
18e90860
AW
2485** The module namespace is now separate from the value namespace
2486
2487It was a little-known implementation detail of Guile's module system
2488that it was built on a single hierarchical namespace of values -- that
2489if there was a module named `(foo bar)', then in the module named
2490`(foo)' there was a binding from `bar' to the `(foo bar)' module.
2491
2492This was a neat trick, but presented a number of problems. One problem
2493was that the bindings in a module were not apparent from the module
2494itself; perhaps the `(foo)' module had a private binding for `bar', and
2495then an external contributor defined `(foo bar)'. In the end there can
2496be only one binding, so one of the two will see the wrong thing, and
2497produce an obtuse error of unclear provenance.
2498
2499Also, the public interface of a module was also bound in the value
2500namespace, as `%module-public-interface'. This was a hack from the early
2501days of Guile's modules.
2502
2503Both of these warts have been fixed by the addition of fields in the
2504`module' data type. Access to modules and their interfaces from the
2505value namespace has been deprecated, and all accessors use the new
2506record accessors appropriately.
2507
2508When Guile is built with support for deprecated code, as is the default,
2509the value namespace is still searched for modules and public interfaces,
2510and a deprecation warning is raised as appropriate.
2511
2512Finally, to support lazy loading of modules as one used to be able to do
2513with module binder procedures, Guile now has submodule binders, called
2514if a given submodule is not found. See boot-9.scm for more information.
2515
2516** New procedures: module-ref-submodule, module-define-submodule,
2517 nested-ref-module, nested-define-module!, local-ref-module,
2518 local-define-module
2519
2520These new accessors are like their bare variants, but operate on
2521namespaces instead of values.
2522
2523** The (app modules) module tree is officially deprecated
2524
2525It used to be that one could access a module named `(foo bar)' via
2526`(nested-ref the-root-module '(app modules foo bar))'. The `(app
2527modules)' bit was a never-used and never-documented abstraction, and has
2528been deprecated. See the following mail for a full discussion:
2529
2530 http://lists.gnu.org/archive/html/guile-devel/2010-04/msg00168.html
2531
2532The `%app' binding is also deprecated.
2533
51cb0cca
AW
2534** `module-filename' field and accessor
2535
2536Modules now record the file in which they are defined. This field may be
2537accessed with the new `module-filename' procedure.
2538
2539** Modules load within a known environment
2540
2541It takes a few procedure calls to define a module, and those procedure
2542calls need to be in scope. Now we ensure that the current module when
2543loading a module is one that has the needed bindings, instead of relying
2544on chance.
2545
b47fea09
AW
2546** `load' is a macro (!) that resolves paths relative to source file dir
2547
2548The familiar Schem `load' procedure is now a macro that captures the
2549name of the source file being expanded, and dispatches to the new
2550`load-in-vicinity'. Referencing `load' by bare name returns a closure
2551that embeds the current source file name.
2552
2553This fix allows `load' of relative paths to be resolved with respect to
2554the location of the file that calls `load'.
2555
fa1804e9
AW
2556** Many syntax errors have different texts now
2557
2558Syntax errors still throw to the `syntax-error' key, but the arguments
2559are often different now. Perhaps in the future, Guile will switch to
93617170 2560using standard SRFI-35 conditions.
fa1804e9
AW
2561
2562** Returning multiple values to compiled code will silently truncate the
2563 values to the expected number
2564
2565For example, the interpreter would raise an error evaluating the form,
2566`(+ (values 1 2) (values 3 4))', because it would see the operands as
2567being two compound "values" objects, to which `+' does not apply.
2568
2569The compiler, on the other hand, receives multiple values on the stack,
2570not as a compound object. Given that it must check the number of values
2571anyway, if too many values are provided for a continuation, it chooses
2572to truncate those values, effectively evaluating `(+ 1 3)' instead.
2573
2574The idea is that the semantics that the compiler implements is more
2575intuitive, and the use of the interpreter will fade out with time.
2576This behavior is allowed both by the R5RS and the R6RS.
2577
2578** Multiple values in compiled code are not represented by compound
2579 objects
2580
2581This change may manifest itself in the following situation:
2582
2583 (let ((val (foo))) (do-something) val)
2584
2585In the interpreter, if `foo' returns multiple values, multiple values
2586are produced from the `let' expression. In the compiler, those values
2587are truncated to the first value, and that first value is returned. In
2588the compiler, if `foo' returns no values, an error will be raised, while
2589the interpreter would proceed.
2590
2591Both of these behaviors are allowed by R5RS and R6RS. The compiler's
2592behavior is more correct, however. If you wish to preserve a potentially
2593multiply-valued return, you will need to set up a multiple-value
2594continuation, using `call-with-values'.
2595
2596** Defmacros are now implemented in terms of syntax-case.
2597
2598The practical ramification of this is that the `defmacro?' predicate has
2599been removed, along with `defmacro-transformer', `macro-table',
2600`xformer-table', `assert-defmacro?!', `set-defmacro-transformer!' and
2601`defmacro:transformer'. This is because defmacros are simply macros. If
2602any of these procedures provided useful facilities to you, we encourage
2603you to contact the Guile developers.
2604
139fa149
AW
2605** Hygienic macros documented as the primary syntactic extension mechanism.
2606
2607The macro documentation was finally fleshed out with some documentation
29b98fb2
AW
2608on `syntax-rules' and `syntax-case' macros, and other parts of the macro
2609expansion process. See "Macros" in the manual, for details.
139fa149 2610
fa1804e9
AW
2611** psyntax is now the default expander
2612
2613Scheme code is now expanded by default by the psyntax hygienic macro
2614expander. Expansion is performed completely before compilation or
2615interpretation.
2616
2617Notably, syntax errors will be signalled before interpretation begins.
2618In the past, many syntax errors were only detected at runtime if the
2619code in question was memoized.
2620
2621As part of its expansion, psyntax renames all lexically-bound
2622identifiers. Original identifier names are preserved and given to the
2623compiler, but the interpreter will see the renamed variables, e.g.,
2624`x432' instead of `x'.
2625
2626Note that the psyntax that Guile uses is a fork, as Guile already had
2627modules before incompatible modules were added to psyntax -- about 10
2628years ago! Thus there are surely a number of bugs that have been fixed
2629in psyntax since then. If you find one, please notify bug-guile@gnu.org.
2630
2631** syntax-rules and syntax-case are available by default.
2632
2633There is no longer any need to import the `(ice-9 syncase)' module
2634(which is now deprecated). The expander may be invoked directly via
29b98fb2 2635`macroexpand', though it is normally searched for via the current module
fa1804e9
AW
2636transformer.
2637
2638Also, the helper routines for syntax-case are available in the default
2639environment as well: `syntax->datum', `datum->syntax',
2640`bound-identifier=?', `free-identifier=?', `generate-temporaries',
2641`identifier?', and `syntax-violation'. See the R6RS for documentation.
2642
4a457691
AW
2643** Tail patterns in syntax-case
2644
2645Guile has pulled in some more recent changes from the psyntax portable
2646syntax expander, to implement support for "tail patterns". Such patterns
2647are supported by syntax-rules and syntax-case. This allows a syntax-case
2648match clause to have ellipses, then a pattern at the end. For example:
2649
2650 (define-syntax case
2651 (syntax-rules (else)
2652 ((_ val match-clause ... (else e e* ...))
2653 [...])))
2654
2655Note how there is MATCH-CLAUSE, which is ellipsized, then there is a
2656tail pattern for the else clause. Thanks to Andreas Rottmann for the
2657patch, and Kent Dybvig for the code.
2658
fa1804e9
AW
2659** Lexical bindings introduced by hygienic macros may not be referenced
2660 by nonhygienic macros.
2661
2662If a lexical binding is introduced by a hygienic macro, it may not be
2663referenced by a nonhygienic macro. For example, this works:
2664
2665 (let ()
2666 (define-macro (bind-x val body)
2667 `(let ((x ,val)) ,body))
2668 (define-macro (ref x)
2669 x)
2670 (bind-x 10 (ref x)))
2671
2672But this does not:
2673
2674 (let ()
2675 (define-syntax bind-x
2676 (syntax-rules ()
2677 ((_ val body) (let ((x val)) body))))
2678 (define-macro (ref x)
2679 x)
2680 (bind-x 10 (ref x)))
2681
2682It is not normal to run into this situation with existing code. However,
51cb0cca 2683if you have defmacros that expand to hygienic macros, it is possible to
66ad445d
AW
2684run into situations like this. For example, if you have a defmacro that
2685generates a `while' expression, the `break' bound by the `while' may not
2686be visible within other parts of your defmacro. The solution is to port
2687from defmacros to syntax-rules or syntax-case.
fa1804e9
AW
2688
2689** Macros may no longer be referenced as first-class values.
2690
2691In the past, you could evaluate e.g. `if', and get its macro value. Now,
2692expanding this form raises a syntax error.
2693
2694Macros still /exist/ as first-class values, but they must be
2695/referenced/ via the module system, e.g. `(module-ref (current-module)
2696'if)'.
2697
29b98fb2
AW
2698** Macros may now have docstrings.
2699
2700`object-documentation' from `(ice-9 documentation)' may be used to
2701retrieve the docstring, once you have a macro value -- but see the above
2702note about first-class macros. Docstrings are associated with the syntax
2703transformer procedures.
fa1804e9 2704
e614d375
AW
2705** `case-lambda' is now available in the default environment.
2706
2707The binding in the default environment is equivalent to the one from the
2708`(srfi srfi-16)' module. Use the srfi-16 module explicitly if you wish
2709to maintain compatibility with Guile 1.8 and earlier.
2710
29b98fb2 2711** Procedures may now have more than one arity.
5bb408cc
AW
2712
2713This can be the case, for example, in case-lambda procedures. The
2714arities of compiled procedures may be accessed via procedures from the
2715`(system vm program)' module; see "Compiled Procedures", "Optional
2716Arguments", and "Case-lambda" in the manual.
2717
18e90860
AW
2718** Deprecate arity access via (procedure-properties proc 'arity)
2719
2720Instead of accessing a procedure's arity as a property, use the new
2721`procedure-minimum-arity' function, which gives the most permissive
b3da54d1 2722arity that the function has, in the same format as the old arity
18e90860
AW
2723accessor.
2724
e614d375
AW
2725** `lambda*' and `define*' are now available in the default environment
2726
2727As with `case-lambda', `(ice-9 optargs)' continues to be supported, for
2728compatibility purposes. No semantic change has been made (we hope).
2729Optional and keyword arguments now dispatch via special VM operations,
2730without the need to cons rest arguments, making them very fast.
2731
487bacf4
AW
2732** New syntax: define-once
2733
2734`define-once' is like Lisp's `defvar': it creates a toplevel binding,
2735but only if one does not exist already.
2736
cf8ec359
AW
2737** New function, `truncated-print', with `format' support
2738
2739`(ice-9 pretty-print)' now exports `truncated-print', a printer that
2740will ensure that the output stays within a certain width, truncating the
2741output in what is hopefully an intelligent manner. See the manual for
2742more details.
2743
2744There is a new `format' specifier, `~@y', for doing a truncated
2745print (as opposed to `~y', which does a pretty-print). See the `format'
2746documentation for more details.
2747
7cd99cba
AW
2748** Better pretty-printing
2749
2750Indentation recognizes more special forms, like `syntax-case', and read
2751macros like `quote' are printed better.
2752
51cb0cca
AW
2753** Passing a number as the destination of `format' is deprecated
2754
2755The `format' procedure in `(ice-9 format)' now emits a deprecation
2756warning if a number is passed as its first argument.
2757
487bacf4
AW
2758Also, it used to be that you could omit passing a port to `format', in
2759some cases. This still works, but has been formally deprecated.
2760
cf8ec359
AW
2761** SRFI-4 vectors reimplemented in terms of R6RS bytevectors
2762
2763Guile now implements SRFI-4 vectors using bytevectors. Often when you
2764have a numeric vector, you end up wanting to write its bytes somewhere,
2765or have access to the underlying bytes, or read in bytes from somewhere
2766else. Bytevectors are very good at this sort of thing. But the SRFI-4
2767APIs are nicer to use when doing number-crunching, because they are
2768addressed by element and not by byte.
2769
2770So as a compromise, Guile allows all bytevector functions to operate on
2771numeric vectors. They address the underlying bytes in the native
2772endianness, as one would expect.
2773
2774Following the same reasoning, that it's just bytes underneath, Guile
2775also allows uniform vectors of a given type to be accessed as if they
2776were of any type. One can fill a u32vector, and access its elements with
2777u8vector-ref. One can use f64vector-ref on bytevectors. It's all the
2778same to Guile.
2779
2780In this way, uniform numeric vectors may be written to and read from
2781input/output ports using the procedures that operate on bytevectors.
2782
2783Calls to SRFI-4 accessors (ref and set functions) from Scheme are now
2784inlined to the VM instructions for bytevector access.
2785
2786See "SRFI-4" in the manual, for more information.
2787
2788** Nonstandard SRFI-4 procedures now available from `(srfi srfi-4 gnu)'
2789
2790Guile's `(srfi srfi-4)' now only exports those srfi-4 procedures that
2791are part of the standard. Complex uniform vectors and the
2792`any->FOOvector' family are now available only from `(srfi srfi-4 gnu)'.
2793
2794Guile's default environment imports `(srfi srfi-4)', and probably should
2795import `(srfi srfi-4 gnu)' as well.
2796
2797See "SRFI-4 Extensions" in the manual, for more information.
2798
e614d375
AW
2799** New syntax: include-from-path.
2800
2801`include-from-path' is like `include', except it looks for its file in
2802the load path. It can be used to compile other files into a file.
2803
2804** New syntax: quasisyntax.
2805
2806`quasisyntax' is to `syntax' as `quasiquote' is to `quote'. See the R6RS
2807documentation for more information. Thanks to Andre van Tonder for the
2808implementation.
2809
51cb0cca
AW
2810** `*unspecified*' is identifier syntax
2811
2812`*unspecified*' is no longer a variable, so it is optimized properly by
2813the compiler, and is not `set!'-able.
2814
487bacf4
AW
2815** Changes and bugfixes in numerics code
2816
2817*** Added six new sets of fast quotient and remainder operators
2818
2819Added six new sets of fast quotient and remainder operator pairs with
2820different semantics than the R5RS operators. They support not only
2821integers, but all reals, including exact rationals and inexact
2822floating point numbers.
2823
2824These procedures accept two real numbers N and D, where the divisor D
2825must be non-zero. Each set of operators computes an integer quotient
2826Q and a real remainder R such that N = Q*D + R and |R| < |D|. They
2827differ only in how N/D is rounded to produce Q.
2828
2829`euclidean-quotient' returns the integer Q and `euclidean-remainder'
2830returns the real R such that N = Q*D + R and 0 <= R < |D|. `euclidean/'
2831returns both Q and R, and is more efficient than computing each
2832separately. Note that when D > 0, `euclidean-quotient' returns
2833floor(N/D), and when D < 0 it returns ceiling(N/D).
2834
2835`centered-quotient', `centered-remainder', and `centered/' are similar
2836except that the range of remainders is -abs(D/2) <= R < abs(D/2), and
2837`centered-quotient' rounds N/D to the nearest integer. Note that these
2838operators are equivalent to the R6RS integer division operators `div',
2839`mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'.
2840
2841`floor-quotient' and `floor-remainder' compute Q and R, respectively,
2842where Q has been rounded toward negative infinity. `floor/' returns
2843both Q and R, and is more efficient than computing each separately.
2844Note that when applied to integers, `floor-remainder' is equivalent to
2845the R5RS integer-only `modulo' operator. `ceiling-quotient',
2846`ceiling-remainder', and `ceiling/' are similar except that Q is
2847rounded toward positive infinity.
2848
2849For `truncate-quotient', `truncate-remainder', and `truncate/', Q is
2850rounded toward zero. Note that when applied to integers,
2851`truncate-quotient' and `truncate-remainder' are equivalent to the
2852R5RS integer-only operators `quotient' and `remainder'.
2853
2854For `round-quotient', `round-remainder', and `round/', Q is rounded to
2855the nearest integer, with ties going to the nearest even integer.
2856
2857*** Complex number changes
2858
2859Guile is now able to represent non-real complex numbers whose
2860imaginary part is an _inexact_ zero (0.0 or -0.0), per R6RS.
2861Previously, such numbers were immediately changed into inexact reals.
2862
2863(real? 0.0+0.0i) now returns #f, per R6RS, although (zero? 0.0+0.0i)
2864still returns #t, per R6RS. (= 0 0.0+0.0i) and (= 0.0 0.0+0.0i) are
2865#t, but the same comparisons using `eqv?' or `equal?' are #f.
2866
2867Like other non-real numbers, these complex numbers with inexact zero
2868imaginary part will raise exceptions is passed to procedures requiring
2869reals, such as `<', `>', `<=', `>=', `min', `max', `positive?',
2870`negative?', `inf?', `nan?', `finite?', etc.
2871
2872**** `make-rectangular' changes
2873
2874scm_make_rectangular `make-rectangular' now returns a real number only
2875if the imaginary part is an _exact_ 0. Previously, it would return a
2876real number if the imaginary part was an inexact zero.
2877
2878scm_c_make_rectangular now always returns a non-real complex number,
2879even if the imaginary part is zero. Previously, it would return a
2880real number if the imaginary part was zero.
2881
2882**** `make-polar' changes
2883
2884scm_make_polar `make-polar' now returns a real number only if the
2885angle or magnitude is an _exact_ 0. If the magnitude is an exact 0,
2886it now returns an exact 0. Previously, it would return a real
2887number if the imaginary part was an inexact zero.
2888
2889scm_c_make_polar now always returns a non-real complex number, even if
2890the imaginary part is 0.0. Previously, it would return a real number
2891if the imaginary part was 0.0.
2892
2893**** `imag-part' changes
2894
2895scm_imag_part `imag-part' now returns an exact 0 if applied to an
2896inexact real number. Previously it returned an inexact zero in this
2897case.
2898
2899*** `eqv?' and `equal?' now compare numbers equivalently
2900
2901scm_equal_p `equal?' now behaves equivalently to scm_eqv_p `eqv?' for
2902numeric values, per R5RS. Previously, equal? worked differently,
2903e.g. `(equal? 0.0 -0.0)' returned #t but `(eqv? 0.0 -0.0)' returned #f,
2904and `(equal? +nan.0 +nan.0)' returned #f but `(eqv? +nan.0 +nan.0)'
2905returned #t.
2906
2907*** `(equal? +nan.0 +nan.0)' now returns #t
2908
2909Previously, `(equal? +nan.0 +nan.0)' returned #f, although
2910`(let ((x +nan.0)) (equal? x x))' and `(eqv? +nan.0 +nan.0)'
2911both returned #t. R5RS requires that `equal?' behave like
2912`eqv?' when comparing numbers.
2913
2914*** Change in handling products `*' involving exact 0
2915
2916scm_product `*' now handles exact 0 differently. A product containing
2917an exact 0 now returns an exact 0 if and only if the other arguments
2918are all exact. An inexact zero is returned if and only if the other
2919arguments are all finite but not all exact. If an infinite or NaN
2920value is present, a NaN value is returned. Previously, any product
2921containing an exact 0 yielded an exact 0, regardless of the other
2922arguments.
2923
2924*** `expt' and `integer-expt' changes when the base is 0
2925
2926While `(expt 0 0)' is still 1, and `(expt 0 N)' for N > 0 is still
2927zero, `(expt 0 N)' for N < 0 is now a NaN value, and likewise for
2928integer-expt. This is more correct, and conforming to R6RS, but seems
2929to be incompatible with R5RS, which would return 0 for all non-zero
2930values of N.
2931
2932*** `expt' and `integer-expt' are more generic, less strict
2933
2934When raising to an exact non-negative integer exponent, `expt' and
2935`integer-expt' are now able to exponentiate any object that can be
2936multiplied using `*'. They can also raise an object to an exact
2937negative integer power if its reciprocal can be taken using `/'.
2938In order to allow this, the type of the first argument is no longer
2939checked when raising to an exact integer power. If the exponent is 0
2940or 1, the first parameter is not manipulated at all, and need not
2941even support multiplication.
2942
2943*** Infinities are no longer integers, nor rationals
2944
2945scm_integer_p `integer?' and scm_rational_p `rational?' now return #f
2946for infinities, per R6RS. Previously they returned #t for real
2947infinities. The real infinities and NaNs are still considered real by
2948scm_real `real?' however, per R6RS.
2949
2950*** NaNs are no longer rationals
2951
2952scm_rational_p `rational?' now returns #f for NaN values, per R6RS.
2953Previously it returned #t for real NaN values. They are still
2954considered real by scm_real `real?' however, per R6RS.
2955
2956*** `inf?' and `nan?' now throw exceptions for non-reals
2957
2958The domain of `inf?' and `nan?' is the real numbers. Guile now signals
2959an error when a non-real number or non-number is passed to these
2960procedures. (Note that NaNs _are_ considered numbers by scheme, despite
2961their name).
2962
2963*** `rationalize' bugfixes and changes
2964
2965Fixed bugs in scm_rationalize `rationalize'. Previously, it returned
2966exact integers unmodified, although that was incorrect if the epsilon
2967was at least 1 or inexact, e.g. (rationalize 4 1) should return 3 per
2968R5RS and R6RS, but previously it returned 4. It also now handles
2969cases involving infinities and NaNs properly, per R6RS.
2970
2971*** Trigonometric functions now return exact numbers in some cases
2972
2973scm_sin `sin', scm_cos `cos', scm_tan `tan', scm_asin `asin', scm_acos
2974`acos', scm_atan `atan', scm_sinh `sinh', scm_cosh `cosh', scm_tanh
2975`tanh', scm_sys_asinh `asinh', scm_sys_acosh `acosh', and
2976scm_sys_atanh `atanh' now return exact results in some cases.
2977
2978*** New procedure: `finite?'
2979
2980Add scm_finite_p `finite?' from R6RS to guile core, which returns #t
2981if and only if its argument is neither infinite nor a NaN. Note that
2982this is not the same as (not (inf? x)) or (not (infinite? x)), since
2983NaNs are neither finite nor infinite.
2984
2985*** Improved exactness handling for complex number parsing
2986
2987When parsing non-real complex numbers, exactness specifiers are now
2988applied to each component, as is done in PLT Scheme. For complex
2989numbers written in rectangular form, exactness specifiers are applied
2990to the real and imaginary parts before calling scm_make_rectangular.
2991For complex numbers written in polar form, exactness specifiers are
2992applied to the magnitude and angle before calling scm_make_polar.
2993
2994Previously, exactness specifiers were applied to the number as a whole
2995_after_ calling scm_make_rectangular or scm_make_polar.
2996
2997For example, (string->number "#i5.0+0i") now does the equivalent of:
2998
2999 (make-rectangular (exact->inexact 5.0) (exact->inexact 0))
3000
3001which yields 5.0+0.0i. Previously it did the equivalent of:
3002
3003 (exact->inexact (make-rectangular 5.0 0))
3004
3005which yielded 5.0.
3006
108e18b1
AW
3007** Unicode characters
3008
3009Unicode characters may be entered in octal format via e.g. `#\454', or
3010created via (integer->char 300). A hex external representation will
3011probably be introduced at some point.
3012
3013** Unicode strings
3014
3015Internally, strings are now represented either in the `latin-1'
3016encoding, one byte per character, or in UTF-32, with four bytes per
3017character. Strings manage their own allocation, switching if needed.
3018
99e31c32
AW
3019Extended characters may be written in a literal string using the
3020hexadecimal escapes `\xXX', `\uXXXX', or `\UXXXXXX', for 8-bit, 16-bit,
3021or 24-bit codepoints, respectively, or entered directly in the native
3022encoding of the port on which the string is read.
3023
56664c08
AW
3024** Unicode symbols
3025
3026One may now use U+03BB (GREEK SMALL LETTER LAMBDA) as an identifier.
3027
99e31c32
AW
3028** Support for non-ASCII source code files
3029
3030The default reader now handles source code files for some of the
3031non-ASCII character encodings, such as UTF-8. A non-ASCII source file
3032should have an encoding declaration near the top of the file. Also,
3033there is a new function, `file-encoding', that scans a port for a coding
3034declaration. See the section of the manual entitled, "Character Encoding
3035of Source Files".
3036
3037The pre-1.9.3 reader handled 8-bit clean but otherwise unspecified source
51cb0cca
AW
3038code. This use is now discouraged. Binary input and output is
3039currently supported by opening ports in the ISO-8859-1 locale.
99e31c32 3040
487bacf4
AW
3041** Source files default to UTF-8.
3042
3043If source files do not specify their encoding via a `coding:' block,
3044the default encoding is UTF-8, instead of being taken from the current
3045locale.
3046
3047** Interactive Guile installs the current locale.
3048
3049Instead of leaving the user in the "C" locale, running the Guile REPL
3050installs the current locale. [FIXME xref?]
3051
99e31c32
AW
3052** Support for locale transcoding when reading from and writing to ports
3053
3054Ports now have an associated character encoding, and port read and write
3055operations do conversion to and from locales automatically. Ports also
3056have an associated strategy for how to deal with locale conversion
3057failures.
3058
3059See the documentation in the manual for the four new support functions,
3060`set-port-encoding!', `port-encoding', `set-port-conversion-strategy!',
3061and `port-conversion-strategy'.
3062
3063** String and SRFI-13 functions can operate on Unicode strings
3064
3065** Unicode support for SRFI-14 character sets
3066
3067The default character sets are no longer locale dependent and contain
3068characters from the whole Unicode range. There is a new predefined
3069character set, `char-set:designated', which contains all assigned
3070Unicode characters. There is a new debugging function, `%char-set-dump'.
3071
3072** Character functions operate on Unicode characters
3073
3074`char-upcase' and `char-downcase' use default Unicode casing rules.
3075Character comparisons such as `char<?' and `char-ci<?' now sort based on
3076Unicode code points.
108e18b1
AW
3077
3078** Global variables `scm_charnames' and `scm_charnums' are removed
3079
3080These variables contained the names of control characters and were
3081used when writing characters. While these were global, they were
3082never intended to be public API. They have been replaced with private
3083functions.
3084
3085** EBCDIC support is removed
3086
3087There was an EBCDIC compile flag that altered some of the character
3088processing. It appeared that full EBCDIC support was never completed
3089and was unmaintained.
3090
6bf927ab 3091** Compile-time warnings
b0217d17
AW
3092
3093Guile can warn about potentially unbound free variables. Pass the
3094-Wunbound-variable on the `guile-tools compile' command line, or add
3095`#:warnings '(unbound-variable)' to your `compile' or `compile-file'
51cb0cca
AW
3096invocation. Warnings are also enabled by default for expressions entered
3097at the REPL.
b0217d17 3098
6cf43047
AW
3099Guile can also warn when you pass the wrong number of arguments to a
3100procedure, with -Warity-mismatch, or `arity-mismatch' in the
3101`#:warnings' as above.
3102
6bf927ab 3103Other warnings include `-Wunused-variable' and `-Wunused-toplevel', to
ef6b0e8d
AW
3104warn about unused local or global (top-level) variables, and `-Wformat',
3105to check for various errors related to the `format' procedure.
6bf927ab 3106
93617170
LC
3107** A new `memoize-symbol' evaluator trap has been added.
3108
3109This trap can be used for efficiently implementing a Scheme code
3110coverage.
fa1804e9 3111
96b73e84 3112** Duplicate bindings among used modules are resolved lazily.
93617170 3113
96b73e84 3114This slightly improves program startup times.
fa1804e9 3115
96b73e84 3116** New thread cancellation and thread cleanup API
93617170 3117
96b73e84 3118See `cancel-thread', `set-thread-cleanup!', and `thread-cleanup'.
fa1804e9 3119
51cb0cca
AW
3120** New threads are in `(guile-user)' by default, not `(guile)'
3121
3122It used to be that a new thread entering Guile would do so in the
3123`(guile)' module, unless this was the first time Guile was initialized,
3124in which case it was `(guile-user)'. This has been fixed to have all
3125new threads unknown to Guile default to `(guile-user)'.
3126
b47fea09
AW
3127** New helpers: `print-exception', `set-exception-printer!'
3128
3129These functions implement an extensible exception printer. Guile
3130registers printers for all of the exceptions it throws. Users may add
3131their own printers. There is also `scm_print_exception', for use by C
3132programs. Pleasantly, this allows SRFI-35 and R6RS exceptions to be
3133printed appropriately.
3134
4a457691
AW
3135** GOOPS dispatch in scheme
3136
3137As an implementation detail, GOOPS dispatch is no longer implemented by
3138special evaluator bytecodes, but rather directly via a Scheme function
3139associated with an applicable struct. There is some VM support for the
3140underlying primitives, like `class-of'.
3141
3142This change will in the future allow users to customize generic function
3143dispatch without incurring a performance penalty, and allow us to
3144implement method combinations.
3145
4a457691
AW
3146** Applicable struct support
3147
3148One may now make structs from Scheme that may be applied as procedures.
3149To do so, make a struct whose vtable is `<applicable-struct-vtable>'.
3150That struct will be the vtable of your applicable structs; instances of
3151that new struct are assumed to have the procedure in their first slot.
3152`<applicable-struct-vtable>' is like Common Lisp's
3153`funcallable-standard-class'. Likewise there is
3154`<applicable-struct-with-setter-vtable>', which looks for the setter in
3155the second slot. This needs to be better documented.
3156
29b98fb2
AW
3157** GOOPS cleanups.
3158
3159GOOPS had a number of concepts that were relevant to the days of Tcl,
3160but not any more: operators and entities, mainly. These objects were
3161never documented, and it is unlikely that they were ever used. Operators
3162were a kind of generic specific to the Tcl support. Entities were
3163replaced by applicable structs, mentioned above.
3164
4a457691
AW
3165** New struct slot allocation: "hidden"
3166
3167A hidden slot is readable and writable, but will not be initialized by a
3168call to make-struct. For example in your layout you would say "ph"
3169instead of "pw". Hidden slots are useful for adding new slots to a
3170vtable without breaking existing invocations to make-struct.
3171
3172** eqv? not a generic
3173
3174One used to be able to extend `eqv?' as a primitive-generic, but no
3175more. Because `eqv?' is in the expansion of `case' (via `memv'), which
3176should be able to compile to static dispatch tables, it doesn't make
3177sense to allow extensions that would subvert this optimization.
3178
e614d375
AW
3179** `inet-ntop' and `inet-pton' are always available.
3180
3181Guile now use a portable implementation of `inet_pton'/`inet_ntop', so
3182there is no more need to use `inet-aton'/`inet-ntoa'. The latter
3183functions are deprecated.
3184
b47fea09
AW
3185** `getopt-long' parsing errors throw to `quit', not `misc-error'
3186
3187This change should inhibit backtraces on argument parsing errors.
3188`getopt-long' has been modified to print out the error that it throws
3189itself.
3190
51cb0cca
AW
3191** New primitive: `tmpfile'.
3192
3193See "File System" in the manual.
3194
3195** Random generator state may be serialized to a datum
3196
3197`random-state->datum' will serialize a random state to a datum, which
3198may be written out, read back in later, and revivified using
3199`datum->random-state'. See "Random" in the manual, for more details.
3200
3201** Fix random number generator on 64-bit platforms
3202
3203There was a nasty bug on 64-bit platforms in which asking for a random
3204integer with a range between 2**32 and 2**64 caused a segfault. After
3205many embarrassing iterations, this was fixed.
3206
5bb408cc
AW
3207** Fast bit operations.
3208
3209The bit-twiddling operations `ash', `logand', `logior', and `logxor' now
3210have dedicated bytecodes. Guile is not just for symbolic computation,
3211it's for number crunching too.
3212
4a457691
AW
3213** Faster SRFI-9 record access
3214
3215SRFI-9 records are now implemented directly on top of Guile's structs,
3216and their accessors are defined in such a way that normal call-sites
3217inline to special VM opcodes, while still allowing for the general case
3218(e.g. passing a record accessor to `apply').
3219
e614d375
AW
3220** R6RS block comment support
3221
3222Guile now supports R6RS nested block comments. The start of a comment is
3223marked with `#|', and the end with `|#'.
3224
3225** `guile-2' cond-expand feature
3226
3227To test if your code is running under Guile 2.0 (or its alpha releases),
3228test for the `guile-2' cond-expand feature. Like this:
3229
3230 (cond-expand (guile-2 (eval-when (compile)
3231 ;; This must be evaluated at compile time.
3232 (fluid-set! current-reader my-reader)))
3233 (guile
3234 ;; Earlier versions of Guile do not have a
3235 ;; separate compilation phase.
3236 (fluid-set! current-reader my-reader)))
3237
96b73e84 3238** New global variables: %load-compiled-path, %load-compiled-extensions
fa1804e9 3239
96b73e84 3240These are analogous to %load-path and %load-extensions.
fa1804e9 3241
18e90860
AW
3242** New fluid: `%file-port-name-canonicalization'
3243
3244This fluid parameterizes the file names that are associated with file
3245ports. If %file-port-name-canonicalization is 'absolute, then file names
3246are canonicalized to be absolute paths. If it is 'relative, then the
3247name is canonicalized, but any prefix corresponding to a member of
3248`%load-path' is stripped off. Otherwise the names are passed through
3249unchanged.
3250
3251In addition, the `compile-file' and `compile-and-load' procedures bind
3252%file-port-name-canonicalization to their `#:canonicalization' keyword
3253argument, which defaults to 'relative. In this way, one might compile
3254"../module/ice-9/boot-9.scm", but the path that gets residualized into
3255the .go is "ice-9/boot-9.scm".
3256
96b73e84 3257** New procedure, `make-promise'
fa1804e9 3258
96b73e84 3259`(make-promise (lambda () foo))' is equivalent to `(delay foo)'.
fa1804e9 3260
108e18b1
AW
3261** `defined?' may accept a module as its second argument
3262
3263Previously it only accepted internal structures from the evaluator.
3264
96b73e84 3265** New entry into %guile-build-info: `ccachedir'
fa1804e9 3266
96b73e84 3267** Fix bug in `module-bound?'.
fa1804e9 3268
96b73e84
AW
3269`module-bound?' was returning true if a module did have a local
3270variable, but one that was unbound, but another imported module bound
3271the variable. This was an error, and was fixed.
fa1804e9 3272
96b73e84 3273** `(ice-9 syncase)' has been deprecated.
fa1804e9 3274
96b73e84
AW
3275As syntax-case is available by default, importing `(ice-9 syncase)' has
3276no effect, and will trigger a deprecation warning.
fa1804e9 3277
b0217d17
AW
3278** New readline history functions
3279
3280The (ice-9 readline) module now provides add-history, read-history,
3281write-history and clear-history, which wrap the corresponding GNU
3282History library functions.
3283
86d88a22
AW
3284** Removed deprecated uniform array procedures:
3285 dimensions->uniform-array, list->uniform-array, array-prototype
3286
3287Instead, use make-typed-array, list->typed-array, or array-type,
3288respectively.
3289
51cb0cca
AW
3290** Deprecate the old `scm-style-repl'
3291
3292The following bindings from boot-9 are now found in `(ice-9
3293scm-style-repl)': `scm-style-repl', `error-catching-loop',
3294`error-catching-repl', `bad-throw', `scm-repl-silent'
3295`assert-repl-silence', `repl-print-unspecified',
3296`assert-repl-print-unspecified', `scm-repl-verbose',
3297`assert-repl-verbosity', `scm-repl-prompt', `set-repl-prompt!', `repl',
3298`default-pre-unwind-handler', `handle-system-error',
3299
3300The following bindings have been deprecated, with no replacement:
3301`pre-unwind-handler-dispatch'.
3302
3303The following bindings have been totally removed:
3304`before-signal-stack'.
3305
3306Deprecated forwarding shims have been installed so that users that
3307expect these bindings in the main namespace will still work, but receive
3308a deprecation warning.
3309
3310** `set-batch-mode?!' replaced by `ensure-batch-mode!'
3311
3312"Batch mode" is a flag used to tell a program that it is not running
3313interactively. One usually turns it on after a fork. It may not be
3314turned off. `ensure-batch-mode!' deprecates the old `set-batch-mode?!',
3315because it is a better interface, as it can only turn on batch mode, not
3316turn it off.
3317
3318** Deprecate `save-stack', `the-last-stack'
3319
3320It used to be that the way to debug programs in Guile was to capture the
3321stack at the time of error, drop back to the REPL, then debug that
3322stack. But this approach didn't compose, was tricky to get right in the
3323presence of threads, and was not very powerful.
3324
3325So `save-stack', `stack-saved?', and `the-last-stack' have been moved to
3326`(ice-9 save-stack)', with deprecated bindings left in the root module.
3327
3328** `top-repl' has its own module
3329
3330The `top-repl' binding, called with Guile is run interactively, is now
3331is its own module, `(ice-9 top-repl)'. A deprecated forwarding shim was
3332left in the default environment.
3333
3334** `display-error' takes a frame
3335
3336The `display-error' / `scm_display_error' helper now takes a frame as an
3337argument instead of a stack. Stacks are still supported in deprecated
3338builds. Additionally, `display-error' will again source location
3339information for the error.
3340
3341** No more `(ice-9 debug)'
3342
3343This module had some debugging helpers that are no longer applicable to
3344the current debugging model. Importing this module will produce a
3345deprecation warning. Users should contact bug-guile for support.
3346
ef6b0e8d
AW
3347** Remove obsolete debug-options
3348
3349Removed `breakpoints', `trace', `procnames', `indent', `frames',
3350`maxdepth', and `debug' debug-options.
3351
3352** `backtrace' debug option on by default
3353
3354Given that Guile 2.0 can always give you a backtrace, backtraces are now
3355on by default.
3356
3357** `turn-on-debugging' deprecated
3358
3359** Remove obsolete print-options
3360
3361The `source' and `closure-hook' print options are obsolete, and have
3362been removed.
3363
3364** Remove obsolete read-options
3365
3366The "elisp-strings" and "elisp-vectors" read options were unused and
3367obsolete, so they have been removed.
3368
3369** Remove eval-options and trap-options
3370
3371Eval-options and trap-options are obsolete with the new VM and
3372evaluator.
3373
3374** Remove (ice-9 debugger) and (ice-9 debugging)
3375
3376See "Traps" and "Interactive Debugging" in the manual, for information
3377on their replacements.
3378
3379** Remove the GDS Emacs integration
3380
3381See "Using Guile in Emacs" in the manual, for info on how we think you
3382should use Guile with Emacs.
3383
b0abbaa7
AW
3384** Deprecated: `lazy-catch'
3385
3386`lazy-catch' was a form that captured the stack at the point of a
3387`throw', but the dynamic state at the point of the `catch'. It was a bit
3388crazy. Please change to use `catch', possibly with a throw-handler, or
3389`with-throw-handler'.
3390
487bacf4
AW
3391** Deprecated: primitive properties
3392
3393The `primitive-make-property', `primitive-property-set!',
3394`primitive-property-ref', and `primitive-property-del!' procedures were
3395crufty and only used to implement object properties, which has a new,
3396threadsafe implementation. Use object properties or weak hash tables
3397instead.
3398
18e90860
AW
3399** Deprecated `@bind' syntax
3400
3401`@bind' was part of an older implementation of the Emacs Lisp language,
3402and is no longer used.
3403
51cb0cca
AW
3404** Miscellaneous other deprecations
3405
7cd99cba
AW
3406`cuserid' has been deprecated, as it only returns 8 bytes of a user's
3407login. Use `(passwd:name (getpwuid (geteuid)))' instead.
3408
487bacf4
AW
3409Additionally, the procedures `apply-to-args', `has-suffix?', `scheme-file-suffix'
3410`get-option', `for-next-option', `display-usage-report',
3411`transform-usage-lambda', `collect', and `set-batch-mode?!' have all
3412been deprecated.
3413
7cd99cba
AW
3414** Add support for unbound fluids
3415
3416See `make-unbound-fluid', `fluid-unset!', and `fluid-bound?' in the
3417manual.
3418
3419** Add `variable-unset!'
3420
3421See "Variables" in the manual, for more details.
51cb0cca 3422
87e00370
LC
3423** Last but not least, the `λ' macro can be used in lieu of `lambda'
3424
96b73e84 3425* Changes to the C interface
fa1804e9 3426
7b96f3dd
LC
3427** Guile now uses libgc, the Boehm-Demers-Weiser garbage collector
3428
3429The semantics of `scm_gc_malloc ()' have been changed, in a
3430backward-compatible way. A new allocation routine,
3431`scm_gc_malloc_pointerless ()', was added.
3432
3433Libgc is a conservative GC, which we hope will make interaction with C
3434code easier and less error-prone.
3435
487bacf4
AW
3436** New procedures: `scm_to_stringn', `scm_from_stringn'
3437** New procedures: scm_{to,from}_{utf8,latin1}_symbol{n,}
3438** New procedures: scm_{to,from}_{utf8,utf32,latin1}_string{n,}
3439
3440These new procedures convert to and from string representations in
3441particular encodings.
ef6b0e8d 3442
487bacf4
AW
3443Users should continue to use locale encoding for user input, user
3444output, or interacting with the C library.
ef6b0e8d 3445
487bacf4 3446Use the Latin-1 functions for ASCII, and for literals in source code.
ef6b0e8d 3447
487bacf4
AW
3448Use UTF-8 functions for interaction with modern libraries which deal in
3449UTF-8, and UTF-32 for interaction with utf32-using libraries.
3450
3451Otherwise, use scm_to_stringn or scm_from_stringn with a specific
3452encoding.
ef6b0e8d 3453
4a457691
AW
3454** New type definitions for `scm_t_intptr' and friends.
3455
3456`SCM_T_UINTPTR_MAX', `SCM_T_INTPTR_MIN', `SCM_T_INTPTR_MAX',
3457`SIZEOF_SCM_T_BITS', `scm_t_intptr' and `scm_t_uintptr' are now
3458available to C. Have fun!
3459
96b73e84 3460** The GH interface (deprecated in version 1.6, 2001) was removed.
fa1804e9 3461
96b73e84 3462** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF
fa1804e9 3463
96b73e84
AW
3464This makes these internal functions technically not callable from
3465application code.
fa1804e9 3466
96b73e84
AW
3467** Functions for handling `scm_option' now no longer require an argument
3468indicating length of the `scm_t_option' array.
fa1804e9 3469
4a457691
AW
3470** Procedures-with-setters are now implemented using applicable structs
3471
3472From a user's perspective this doesn't mean very much. But if, for some
3473odd reason, you used the SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE, or
3474SCM_SETTER macros, know that they're deprecated now. Also, scm_tc7_pws
3475is gone.
3476
3477** Remove old evaluator closures
3478
3479There used to be ranges of typecodes allocated to interpreted data
3480structures, but that it no longer the case, given that interpreted
3481procedure are now just regular VM closures. As a result, there is a
3482newly free tc3, and a number of removed macros. See the ChangeLog for
3483details.
3484
cf8ec359 3485** Primitive procedures are now VM trampoline procedures
4a457691
AW
3486
3487It used to be that there were something like 12 different typecodes
3488allocated to primitive procedures, each with its own calling convention.
3489Now there is only one, the gsubr. This may affect user code if you were
3490defining a procedure using scm_c_make_subr rather scm_c_make_gsubr. The
3491solution is to switch to use scm_c_make_gsubr. This solution works well
b3da54d1 3492both with the old 1.8 and with the current 1.9 branch.
4a457691 3493
cf8ec359
AW
3494Guile's old evaluator used to have special cases for applying "gsubrs",
3495primitive procedures with specified numbers of required, optional, and
3496rest arguments. Now, however, Guile represents gsubrs as normal VM
3497procedures, with appropriate bytecode to parse out the correct number of
3498arguments, including optional and rest arguments, and then with a
3499special bytecode to apply the gsubr.
3500
3501This allows primitive procedures to appear on the VM stack, allowing
3502them to be accurately counted in profiles. Also they now have more
3503debugging information attached to them -- their number of arguments, for
3504example. In addition, the VM can completely inline the application
3505mechanics, allowing for faster primitive calls.
3506
3507However there are some changes on the C level. There is no more
3508`scm_tc7_gsubr' or `scm_tcs_subrs' typecode for primitive procedures, as
3509they are just VM procedures. Likewise the macros `SCM_GSUBR_TYPE',
3510`SCM_GSUBR_MAKTYPE', `SCM_GSUBR_REQ', `SCM_GSUBR_OPT', and
3511`SCM_GSUBR_REST' are gone, as are `SCM_SUBR_META_INFO', `SCM_SUBR_PROPS'
3512`SCM_SET_SUBR_GENERIC_LOC', and `SCM_SUBR_ARITY_TO_TYPE'.
3513
3514Perhaps more significantly, `scm_c_make_subr',
3515`scm_c_make_subr_with_generic', `scm_c_define_subr', and
3516`scm_c_define_subr_with_generic'. They all operated on subr typecodes,
3517and there are no more subr typecodes. Use the scm_c_make_gsubr family
3518instead.
3519
3520Normal users of gsubrs should not be affected, though, as the
3521scm_c_make_gsubr family still is the correct way to create primitive
3522procedures.
3523
3524** Remove deprecated array C interfaces
3525
3526Removed the deprecated array functions `scm_i_arrayp',
3527`scm_i_array_ndim', `scm_i_array_mem', `scm_i_array_v',
3528`scm_i_array_base', `scm_i_array_dims', and the deprecated macros
3529`SCM_ARRAYP', `SCM_ARRAY_NDIM', `SCM_ARRAY_CONTP', `SCM_ARRAY_MEM',
3530`SCM_ARRAY_V', `SCM_ARRAY_BASE', and `SCM_ARRAY_DIMS'.
3531
3532** Remove unused snarf macros
3533
3534`SCM_DEFINE1', `SCM_PRIMITIVE_GENERIC_1', `SCM_PROC1, and `SCM_GPROC1'
3535are no more. Use SCM_DEFINE or SCM_PRIMITIVE_GENERIC instead.
3536
cf8ec359
AW
3537** New functions: `scm_call_n', `scm_c_run_hookn'
3538
3539`scm_call_n' applies to apply a function to an array of arguments.
3540`scm_c_run_hookn' runs a hook with an array of arguments.
3541
4a457691
AW
3542** Some SMOB types changed to have static typecodes
3543
3544Fluids, dynamic states, and hash tables used to be SMOB objects, but now
3545they have statically allocated tc7 typecodes.
3546
3547** Preparations for changing SMOB representation
3548
3549If things go right, we'll be changing the SMOB representation soon. To
3550that end, we did a lot of cleanups to calls to e.g. SCM_CELL_WORD_2(x) when
3551the code meant SCM_SMOB_DATA_2(x); user code will need similar changes
3552in the future. Code accessing SMOBs using SCM_CELL macros was never
3553correct, but until now things still worked. Users should be aware of
3554such changes.
fa1804e9 3555
cf8ec359
AW
3556** Changed invocation mechanics of applicable SMOBs
3557
3558Guile's old evaluator used to have special cases for applying SMOB
3559objects. Now, with the VM, when Guile sees a SMOB, it looks up a VM
3560trampoline procedure for it, and use the normal mechanics to apply the
3561trampoline. This simplifies procedure application in the normal,
3562non-SMOB case.
3563
3564The upshot is that the mechanics used to apply a SMOB are different from
35651.8. Descriptors no longer have `apply_0', `apply_1', `apply_2', and
3566`apply_3' functions, and the macros SCM_SMOB_APPLY_0 and friends are now
3567deprecated. Just use the scm_call_0 family of procedures.
3568
ef6b0e8d
AW
3569** Removed support shlibs for SRFIs 1, 4, 13, 14, and 60
3570
3571Though these SRFI support libraries did expose API, they encoded a
3572strange version string into their library names. That version was never
3573programmatically exported, so there was no way people could use the
3574libs.
3575
3576This was a fortunate oversight, as it allows us to remove the need for
3577extra, needless shared libraries --- the C support code for SRFIs 4, 13,
3578and 14 was already in core --- and allow us to incrementally return the
3579SRFI implementation to Scheme.
3580
96b73e84 3581** New C function: scm_module_public_interface
a4f1c77d 3582
96b73e84 3583This procedure corresponds to Scheme's `module-public-interface'.
24d6fae8 3584
4a457691
AW
3585** Undeprecate `scm_the_root_module ()'
3586
3587It's useful to be able to get the root module from C without doing a
3588full module lookup.
3589
e614d375
AW
3590** Inline vector allocation
3591
3592Instead of having vectors point out into the heap for their data, their
3593data is now allocated inline to the vector object itself. The same is
3594true for bytevectors, by default, though there is an indirection
3595available which should allow for making a bytevector from an existing
3596memory region.
3597
4a457691
AW
3598** New struct constructors that don't involve making lists
3599
3600`scm_c_make_struct' and `scm_c_make_structv' are new varargs and array
3601constructors, respectively, for structs. You might find them useful.
3602
3603** Stack refactor
3604
3605In Guile 1.8, there were debugging frames on the C stack. Now there is
3606no more need to explicitly mark the stack in this way, because Guile has
3607a VM stack that it knows how to walk, which simplifies the C API
3608considerably. See the ChangeLog for details; the relevant interface is
3609in libguile/stacks.h. The Scheme API has not been changed significantly.
3610
e614d375
AW
3611** Removal of Guile's primitive object system.
3612
3613There were a number of pieces in `objects.[ch]' that tried to be a
3614minimal object system, but were never documented, and were quickly
3615obseleted by GOOPS' merge into Guile proper. So `scm_make_class_object',
3616`scm_make_subclass_object', `scm_metaclass_standard', and like symbols
3617from objects.h are no more. In the very unlikely case in which these
3618were useful to you, we urge you to contact guile-devel.
3619
3620** No future.
3621
3622Actually the future is still in the state that it was, is, and ever
3623shall be, Amen, except that `futures.c' and `futures.h' are no longer a
3624part of it. These files were experimental, never compiled, and would be
3625better implemented in Scheme anyway. In the future, that is.
3626
4a457691
AW
3627** Deprecate trampolines
3628
3629There used to be C functions `scm_trampoline_0', `scm_trampoline_1', and
3630so on. The point was to do some precomputation on the type of the
3631procedure, then return a specialized "call" procedure. However this
3632optimization wasn't actually an optimization, so it is now deprecated.
3633Just use `scm_call_0', etc instead.
3634
18e90860
AW
3635** Deprecated `scm_badargsp'
3636
3637This function is unused in Guile, but was part of its API.
3638
5bb408cc
AW
3639** Better support for Lisp `nil'.
3640
3641The bit representation of `nil' has been tweaked so that it is now very
3642efficient to check e.g. if a value is equal to Scheme's end-of-list or
3643Lisp's nil. Additionally there are a heap of new, specific predicates
b390b008 3644like scm_is_null_or_nil.
5bb408cc 3645
139fa149
AW
3646** Better integration of Lisp `nil'.
3647
3648`scm_is_boolean', `scm_is_false', and `scm_is_null' all return true now
3649for Lisp's `nil'. This shouldn't affect any Scheme code at this point,
3650but when we start to integrate more with Emacs, it is possible that we
3651break code that assumes that, for example, `(not x)' implies that `x' is
3652`eq?' to `#f'. This is not a common assumption. Refactoring affected
3653code to rely on properties instead of identities will improve code
3654correctness. See "Nil" in the manual, for more details.
3655
e614d375
AW
3656** Support for static allocation of strings, symbols, and subrs.
3657
3658Calls to snarfing CPP macros like SCM_DEFINE macro will now allocate
3659much of their associated data as static variables, reducing Guile's
3660memory footprint.
3661
93617170
LC
3662** `scm_stat' has an additional argument, `exception_on_error'
3663** `scm_primitive_load_path' has an additional argument `exception_on_not_found'
24d6fae8 3664
f1ce9199
LC
3665** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type
3666
3667Previously they would use the `off_t' type, which is fragile since its
3668definition depends on the application's value for `_FILE_OFFSET_BITS'.
3669
ba4c43dc
LC
3670** The `long_long' C type, deprecated in 1.8, has been removed
3671
86d88a22
AW
3672** Removed deprecated uniform array procedures: scm_make_uve,
3673 scm_array_prototype, scm_list_to_uniform_array,
3674 scm_dimensions_to_uniform_array, scm_make_ra, scm_shap2ra, scm_cvref,
3675 scm_ra_set_contp, scm_aind, scm_raprin1
3676
3677These functions have been deprecated since early 2005.
3678
a4f1c77d 3679* Changes to the distribution
6caac03c 3680
53befeb7
NJ
3681** Guile's license is now LGPLv3+
3682
3683In other words the GNU Lesser General Public License, version 3 or
3684later (at the discretion of each person that chooses to redistribute
3685part of Guile).
3686
51cb0cca
AW
3687** AM_SILENT_RULES
3688
3689Guile's build is visually quieter, due to the use of Automake 1.11's
3690AM_SILENT_RULES. Build as `make V=1' to see all of the output.
3691
56664c08
AW
3692** GOOPS documentation folded into Guile reference manual
3693
3694GOOPS, Guile's object system, used to be documented in separate manuals.
3695This content is now included in Guile's manual directly.
3696
96b73e84 3697** `guile-config' will be deprecated in favor of `pkg-config'
8a9faebc 3698
96b73e84 3699`guile-config' has been rewritten to get its information from
93617170 3700`pkg-config', so this should be a transparent change. Note however that
96b73e84
AW
3701guile.m4 has yet to be modified to call pkg-config instead of
3702guile-config.
2e77f720 3703
54dd0ca5
LC
3704** Guile now provides `guile-2.0.pc' instead of `guile-1.8.pc'
3705
3706Programs that use `pkg-config' to find Guile or one of its Autoconf
3707macros should now require `guile-2.0' instead of `guile-1.8'.
3708
96b73e84 3709** New installation directory: $(pkglibdir)/1.9/ccache
62560650 3710
96b73e84
AW
3711If $(libdir) is /usr/lib, for example, Guile will install its .go files
3712to /usr/lib/guile/1.9/ccache. These files are architecture-specific.
89bc270d 3713
b0abbaa7
AW
3714** Parallel installability fixes
3715
3716Guile now installs its header files to a effective-version-specific
3717directory, and includes the effective version (e.g. 2.0) in the library
3718name (e.g. libguile-2.0.so).
3719
3720This change should be transparent to users, who should detect Guile via
3721the guile.m4 macro, or the guile-2.0.pc pkg-config file. It will allow
3722parallel installs for multiple versions of Guile development
3723environments.
3724
b0217d17
AW
3725** Dynamically loadable extensions may be placed in a Guile-specific path
3726
3727Before, Guile only searched the system library paths for extensions
3728(e.g. /usr/lib), which meant that the names of Guile extensions had to
3729be globally unique. Installing them to a Guile-specific extensions
66ad445d 3730directory is cleaner. Use `pkg-config --variable=extensiondir
b0217d17
AW
3731guile-2.0' to get the location of the extensions directory.
3732
51cb0cca
AW
3733** User Scheme code may be placed in a version-specific path
3734
3735Before, there was only one way to install user Scheme code to a
3736version-specific Guile directory: install to Guile's own path,
3737e.g. /usr/share/guile/2.0. The site directory,
3738e.g. /usr/share/guile/site, was unversioned. This has been changed to
3739add a version-specific site directory, e.g. /usr/share/guile/site/2.0,
3740searched before the global site directory.
3741
7b96f3dd
LC
3742** New dependency: libgc
3743
3744See http://www.hpl.hp.com/personal/Hans_Boehm/gc/, for more information.
3745
3746** New dependency: GNU libunistring
32e29e24 3747
108e18b1 3748See http://www.gnu.org/software/libunistring/, for more information. Our
7b96f3dd 3749Unicode support uses routines from libunistring.
32e29e24 3750
dbd9532e
LC
3751** New dependency: libffi
3752
3753See http://sourceware.org/libffi/, for more information.
3754
a4f1c77d 3755
dc686d7b 3756\f
9957b1c7
LC
3757Changes in 1.8.8 (since 1.8.7)
3758
3759* Bugs fixed
3760
3761** Fix possible buffer overruns when parsing numbers
c15d8e6a 3762** Avoid clash with system setjmp/longjmp on IA64
1ff4da65 3763** Fix `wrong type arg' exceptions with IPv6 addresses
9957b1c7
LC
3764
3765\f
dc686d7b
NJ
3766Changes in 1.8.7 (since 1.8.6)
3767
922d417b
JG
3768* New modules (see the manual for details)
3769
3770** `(srfi srfi-98)', an interface to access environment variables
3771
dc686d7b
NJ
3772* Bugs fixed
3773
f5851b89 3774** Fix compilation with `--disable-deprecated'
dc686d7b 3775** Fix %fast-slot-ref/set!, to avoid possible segmentation fault
cbee5075 3776** Fix MinGW build problem caused by HAVE_STRUCT_TIMESPEC confusion
ab878b0f 3777** Fix build problem when scm_t_timespec is different from struct timespec
95a040cd 3778** Fix build when compiled with -Wundef -Werror
1bcf7993 3779** More build fixes for `alphaev56-dec-osf5.1b' (Tru64)
5374ec9c 3780** Build fixes for `powerpc-ibm-aix5.3.0.0' (AIX 5.3)
5c006c3f
LC
3781** With GCC, always compile with `-mieee' on `alpha*' and `sh*'
3782** Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130)
fc76c08d 3783** Fix parsing of SRFI-88/postfix keywords longer than 128 characters
40f89215 3784** Fix reading of complex numbers where both parts are inexact decimals
d41668fa 3785
ad5f5ada
NJ
3786** Allow @ macro to work with (ice-9 syncase)
3787
3788Previously, use of the @ macro in a module whose code is being
3789transformed by (ice-9 syncase) would cause an "Invalid syntax" error.
3790Now it works as you would expect (giving the value of the specified
3791module binding).
3792
05588a1a
LC
3793** Have `scm_take_locale_symbol ()' return an interned symbol (bug #25865)
3794
d41668fa 3795\f
8c40b75d
LC
3796Changes in 1.8.6 (since 1.8.5)
3797
071bb6a8
LC
3798* New features (see the manual for details)
3799
3800** New convenience function `scm_c_symbol_length ()'
3801
091baf9e
NJ
3802** Single stepping through code from Emacs
3803
3804When you use GDS to evaluate Scheme code from Emacs, you can now use
3805`C-u' to indicate that you want to single step through that code. See
3806`Evaluating Scheme Code' in the manual for more details.
3807
9e4db0ef
LC
3808** New "guile(1)" man page!
3809
242ebeaf
LC
3810* Changes to the distribution
3811
3812** Automake's `AM_MAINTAINER_MODE' is no longer used
3813
3814Thus, the `--enable-maintainer-mode' configure option is no longer
3815available: Guile is now always configured in "maintainer mode".
3816
e0063477
LC
3817** `ChangeLog' files are no longer updated
3818
3819Instead, changes are detailed in the version control system's logs. See
3820the top-level `ChangeLog' files for details.
3821
3822
8c40b75d
LC
3823* Bugs fixed
3824
fd2b17b9 3825** `symbol->string' now returns a read-only string, as per R5RS
c6333102 3826** Fix incorrect handling of the FLAGS argument of `fold-matches'
589d9eb8 3827** `guile-config link' now prints `-L$libdir' before `-lguile'
4a1db3a9 3828** Fix memory corruption involving GOOPS' `class-redefinition'
191e7165 3829** Fix possible deadlock in `mutex-lock'
95c6523b 3830** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro)
4696a666 3831** Fix build issue on mips, mipsel, powerpc and ia64 (stack direction)
450be18d 3832** Fix build issue on hppa2.0w-hp-hpux11.11 (`dirent64' and `readdir64_r')
88cefbc7 3833** Fix build issue on i386-unknown-freebsd7.0 ("break strict-aliasing rules")
76dae881 3834** Fix misleading output from `(help rationalize)'
5ea8e76e 3835** Fix build failure on Debian hppa architecture (bad stack growth detection)
1dd79792 3836** Fix `gcd' when called with a single, negative argument.
d8b6e191 3837** Fix `Stack overflow' errors seen when building on some platforms
ccf1ca4a
LC
3838** Fix bug when `scm_with_guile ()' was called several times from the
3839 same thread
76350432
LC
3840** The handler of SRFI-34 `with-exception-handler' is now invoked in the
3841 dynamic environment of the call to `raise'
cb823e63 3842** Fix potential deadlock in `make-struct'
691343ea 3843** Fix compilation problem with libltdl from Libtool 2.2.x
3ae3166b 3844** Fix sloppy bound checking in `string-{ref,set!}' with the empty string
6eadcdab 3845
8c40b75d 3846\f
5305df84
LC
3847Changes in 1.8.5 (since 1.8.4)
3848
4b824aae
LC
3849* Infrastructure changes
3850
3851** Guile repository switched from CVS to Git
3852
3853The new repository can be accessed using
3854"git-clone git://git.sv.gnu.org/guile.git", or can be browsed on-line at
3855http://git.sv.gnu.org/gitweb/?p=guile.git . See `README' for details.
3856
92826dd0
LC
3857** Add support for `pkg-config'
3858
3859See "Autoconf Support" in the manual for details.
3860
189681f5
LC
3861* New modules (see the manual for details)
3862
3863** `(srfi srfi-88)'
3864
ef4cbc08
LC
3865* New features (see the manual for details)
3866
3867** New `postfix' read option, for SRFI-88 keyword syntax
f5c2af4b 3868** Some I/O primitives have been inlined, which improves I/O performance
b20ef3a6 3869** New object-based traps infrastructure
ef4cbc08 3870
b20ef3a6
NJ
3871This is a GOOPS-based infrastructure that builds on Guile's low-level
3872evaluator trap calls and facilitates the development of debugging
3873features like single-stepping, breakpoints, tracing and profiling.
3874See the `Traps' node of the manual for details.
3875
3876** New support for working on Guile code from within Emacs
3877
3878Guile now incorporates the `GDS' library (previously distributed
3879separately) for working on Guile code from within Emacs. See the
3880`Using Guile In Emacs' node of the manual for details.
3881
5305df84
LC
3882* Bugs fixed
3883
e27d2495
LC
3884** `scm_add_slot ()' no longer segfaults (fixes bug #22369)
3885** Fixed `(ice-9 match)' for patterns like `((_ ...) ...)'
3886
3887Previously, expressions like `(match '((foo) (bar)) (((_ ...) ...) #t))'
3888would trigger an unbound variable error for `match:andmap'.
3889
62c5382b
LC
3890** `(oop goops describe)' now properly provides the `describe' feature
3891** Fixed `args-fold' from `(srfi srfi-37)'
3892
3893Previously, parsing short option names of argument-less options would
3894lead to a stack overflow.
3895
816e3edf 3896** `(srfi srfi-35)' is now visible through `cond-expand'
61b6542a 3897** Fixed type-checking for the second argument of `eval'
0fb11ae4 3898** Fixed type-checking for SRFI-1 `partition'
f1c212b1
LC
3899** Fixed `struct-ref' and `struct-set!' on "light structs"
3900** Honor struct field access rights in GOOPS
be10cba8 3901** Changed the storage strategy of source properties, which fixes a deadlock
979eade6 3902** Allow compilation of Guile-using programs in C99 mode with GCC 4.3 and later
bfb64eb4 3903** Fixed build issue for GNU/Linux on IA64
fa80e280 3904** Fixed build issues on NetBSD 1.6
a2c25234 3905** Fixed build issue on Solaris 2.10 x86_64
3f520967 3906** Fixed build issue with DEC/Compaq/HP's compiler
c2ad98ad
LC
3907** Fixed `scm_from_complex_double' build issue on FreeBSD
3908** Fixed `alloca' build issue on FreeBSD 6
a7286720 3909** Removed use of non-portable makefile constructs
535b3592 3910** Fixed shadowing of libc's <random.h> on Tru64, which broke compilation
eedcb08a 3911** Make sure all tests honor `$TMPDIR'
5305df84
LC
3912
3913\f
d41668fa
LC
3914Changes in 1.8.4 (since 1.8.3)
3915
3916* Bugs fixed
3917
3918** CR (ASCII 0x0d) is (again) recognized as a token delimiter by the reader
6e14de7d
NJ
3919** Fixed a segmentation fault which occurred when displaying the
3920backtrace of a stack with a promise object (made by `delay') in it.
7d1fc872 3921** Make `accept' leave guile mode while blocking
693758d5 3922** `scm_c_read ()' and `scm_c_write ()' now type-check their port argument
378cc645 3923** Fixed a build problem on AIX (use of func_data identifier)
15bd90ea
NJ
3924** Fixed a segmentation fault which occurred when hashx-ref or hashx-set! was
3925called with an associator proc that returns neither a pair nor #f.
3ac8359a 3926** Secondary threads now always return a valid module for (current-module).
d05bcb2e
NJ
3927** Avoid MacOS build problems caused by incorrect combination of "64"
3928system and library calls.
9a6fac59 3929** `guile-snarf' now honors `$TMPDIR'
25a640ca 3930** `guile-config compile' now reports CPPFLAGS used at compile-time
7f74cf9a 3931** Fixed build with Sun Studio (Solaris 9)
4a19ed04
NJ
3932** Fixed wrong-type-arg errors when creating zero length SRFI-4
3933uniform vectors on AIX.
86a597f8 3934** Fixed a deadlock that occurs upon GC with multiple threads.
4b26c03e 3935** Fixed compile problem with GCC on Solaris and AIX (use of _Complex_I)
d4a00708 3936** Fixed autotool-derived build problems on AIX 6.1.
9a6fac59 3937** Fixed NetBSD/alpha support
b226295a 3938** Fixed MacOS build problem caused by use of rl_get_keymap(_name)
7d1fc872
LC
3939
3940* New modules (see the manual for details)
3941
3942** `(srfi srfi-69)'
d41668fa 3943
b226295a
NJ
3944* Documentation fixes and improvements
3945
3946** Removed premature breakpoint documentation
3947
3948The features described are not available in the series of 1.8.x
3949releases, so the documentation was misleading and has been removed.
3950
3951** More about Guile's default *random-state* variable
3952
3953** GOOPS: more about how to use `next-method'
3954
d3cf93bc
NJ
3955* Changes to the distribution
3956
3957** Corrected a few files that referred incorrectly to the old GPL + special exception licence
3958
3959In fact Guile since 1.8.0 has been licensed with the GNU Lesser
3960General Public License, and the few incorrect files have now been
3961fixed to agree with the rest of the Guile distribution.
3962
5e42b8e7
NJ
3963** Removed unnecessary extra copies of COPYING*
3964
3965The distribution now contains a single COPYING.LESSER at its top level.
3966
a4f1c77d 3967\f
d4c38221
LC
3968Changes in 1.8.3 (since 1.8.2)
3969
3970* New modules (see the manual for details)
3971
f50ca8da 3972** `(srfi srfi-35)'
d4c38221
LC
3973** `(srfi srfi-37)'
3974
e08f3f7a
LC
3975* Bugs fixed
3976
dc061a74 3977** The `(ice-9 slib)' module now works as expected
e08f3f7a 3978** Expressions like "(set! 'x #t)" no longer yield a crash
d7c0c26d 3979** Warnings about duplicate bindings now go to stderr
1ac5fb45 3980** A memory leak in `make-socket-address' was fixed
f43f3620 3981** Alignment issues (e.g., on SPARC) in network routines were fixed
29776e85 3982** A threading issue that showed up at least on NetBSD was fixed
66302618 3983** Build problems on Solaris and IRIX fixed
e08f3f7a 3984
1fdd8ffa
LC
3985* Implementation improvements
3986
7ff6c169 3987** The reader is now faster, which reduces startup time
1fdd8ffa
LC
3988** Procedures returned by `record-accessor' and `record-modifier' are faster
3989
d4c38221 3990\f
45c0ff10
KR
3991Changes in 1.8.2 (since 1.8.1):
3992
3993* New procedures (see the manual for details)
3994
3995** set-program-arguments
b3aa4626 3996** make-vtable
45c0ff10 3997
9320e933
LC
3998* Incompatible changes
3999
4000** The body of a top-level `define' no longer sees the binding being created
4001
4002In a top-level `define', the binding being created is no longer visible
4003from the `define' body. This breaks code like
4004"(define foo (begin (set! foo 1) (+ foo 1)))", where `foo' is now
4005unbound in the body. However, such code was not R5RS-compliant anyway,
4006per Section 5.2.1.
4007
45c0ff10
KR
4008* Bugs fixed
4009
4010** Fractions were not `equal?' if stored in unreduced form.
4011(A subtle problem, since printing a value reduced it, making it work.)
4012** srfi-60 `copy-bit' failed on 64-bit systems
4013** "guile --use-srfi" option at the REPL can replace core functions
4014(Programs run with that option were ok, but in the interactive REPL
4015the core bindings got priority, preventing SRFI replacements or
4016extensions.)
4017** `regexp-exec' doesn't abort() on #\nul in the input or bad flags arg
df449722 4018** `kill' on mingw throws an error for a PID other than oneself
45c0ff10
KR
4019** Procedure names are attached to procedure-with-setters
4020** Array read syntax works with negative lower bound
4021** `array-in-bounds?' fix if an array has different lower bounds on each index
4022** `*' returns exact 0 for "(* inexact 0)"
4023This follows what it always did for "(* 0 inexact)".
c122500a 4024** SRFI-19: Value returned by `(current-time time-process)' was incorrect
0867f7ba 4025** SRFI-19: `date->julian-day' did not account for timezone offset
a1ef7406 4026** `ttyname' no longer crashes when passed a non-tty argument
27782696 4027** `inet-ntop' no longer crashes on SPARC when passed an `AF_INET' address
0867f7ba 4028** Small memory leaks have been fixed in `make-fluid' and `add-history'
b1f57ea4 4029** GOOPS: Fixed a bug in `method-more-specific?'
45c0ff10 4030** Build problems on Solaris fixed
df449722
LC
4031** Build problems on HP-UX IA64 fixed
4032** Build problems on MinGW fixed
45c0ff10
KR
4033
4034\f
a4f1c77d
KR
4035Changes in 1.8.1 (since 1.8.0):
4036
8ab3d8a0 4037* LFS functions are now used to access 64-bit files on 32-bit systems.
a4f1c77d 4038
8ab3d8a0 4039* New procedures (see the manual for details)
4f416616 4040
8ab3d8a0
KR
4041** primitive-_exit - [Scheme] the-root-module
4042** scm_primitive__exit - [C]
4043** make-completion-function - [Scheme] (ice-9 readline)
4044** scm_c_locale_stringn_to_number - [C]
4045** scm_srfi1_append_reverse [C]
4046** scm_srfi1_append_reverse_x [C]
4047** scm_log - [C]
4048** scm_log10 - [C]
4049** scm_exp - [C]
4050** scm_sqrt - [C]
4051
4052* Bugs fixed
4053
4054** Build problems have been fixed on MacOS, SunOS, and QNX.
af4f8612 4055
b3aa4626
KR
4056** `strftime' fix sign of %z timezone offset.
4057
534cd148 4058** A one-dimensional array can now be 'equal?' to a vector.
8ab3d8a0 4059
ad97642e 4060** Structures, records, and SRFI-9 records can now be compared with `equal?'.
af4f8612 4061
8ab3d8a0
KR
4062** SRFI-14 standard char sets are recomputed upon a successful `setlocale'.
4063
4064** `record-accessor' and `record-modifier' now have strict type checks.
4065
4066Record accessor and modifier procedures now throw an error if the
4067record type of the record they're given is not the type expected.
4068(Previously accessors returned #f and modifiers silently did nothing).
4069
4070** It is now OK to use both autoload and use-modules on a given module.
4071
4072** `apply' checks the number of arguments more carefully on "0 or 1" funcs.
4073
4074Previously there was no checking on primatives like make-vector that
4075accept "one or two" arguments. Now there is.
4076
4077** The srfi-1 assoc function now calls its equality predicate properly.
4078
4079Previously srfi-1 assoc would call the equality predicate with the key
4080last. According to the SRFI, the key should be first.
4081
4082** A bug in n-par-for-each and n-for-each-par-map has been fixed.
4083
4084** The array-set! procedure no longer segfaults when given a bit vector.
4085
4086** Bugs in make-shared-array have been fixed.
4087
4088** string<? and friends now follow char<? etc order on 8-bit chars.
4089
4090** The format procedure now handles inf and nan values for ~f correctly.
4091
4092** exact->inexact should no longer overflow when given certain large fractions.
4093
4094** srfi-9 accessor and modifier procedures now have strict record type checks.
a4f1c77d 4095
8ab3d8a0 4096This matches the srfi-9 specification.
a4f1c77d 4097
8ab3d8a0 4098** (ice-9 ftw) procedures won't ignore different files with same inode number.
a4f1c77d 4099
8ab3d8a0
KR
4100Previously the (ice-9 ftw) procedures would ignore any file that had
4101the same inode number as a file they had already seen, even if that
4102file was on a different device.
4f416616
KR
4103
4104\f
8ab3d8a0 4105Changes in 1.8.0 (changes since the 1.6.x series):
ee0c7345 4106
4e250ded
MV
4107* Changes to the distribution
4108
eff2965e
MV
4109** Guile is now licensed with the GNU Lesser General Public License.
4110
77e51fd6
MV
4111** The manual is now licensed with the GNU Free Documentation License.
4112
e2d0a649
RB
4113** Guile now requires GNU MP (http://swox.com/gmp).
4114
4115Guile now uses the GNU MP library for arbitrary precision arithmetic.
e2d0a649 4116
5ebbe4ef
RB
4117** Guile now has separate private and public configuration headers.
4118
b0d10ba6
MV
4119That is, things like HAVE_STRING_H no longer leak from Guile's
4120headers.
5ebbe4ef
RB
4121
4122** Guile now provides and uses an "effective" version number.
b2cbe8d8
RB
4123
4124Guile now provides scm_effective_version and effective-version
4125functions which return the "effective" version number. This is just
4126the normal full version string without the final micro-version number,
a4f1c77d 4127so the current effective-version is "1.8". The effective version
b2cbe8d8
RB
4128should remain unchanged during a stable series, and should be used for
4129items like the versioned share directory name
a4f1c77d 4130i.e. /usr/share/guile/1.8.
b2cbe8d8
RB
4131
4132Providing an unchanging version number during a stable release for
4133things like the versioned share directory can be particularly
4134important for Guile "add-on" packages, since it provides a directory
4135that they can install to that won't be changed out from under them
4136with each micro release during a stable series.
4137
8d54e73a 4138** Thread implementation has changed.
f0b4d944
MV
4139
4140When you configure "--with-threads=null", you will get the usual
4141threading API (call-with-new-thread, make-mutex, etc), but you can't
429d88d4
MV
4142actually create new threads. Also, "--with-threads=no" is now
4143equivalent to "--with-threads=null". This means that the thread API
4144is always present, although you might not be able to create new
4145threads.
f0b4d944 4146
8d54e73a
MV
4147When you configure "--with-threads=pthreads" or "--with-threads=yes",
4148you will get threads that are implemented with the portable POSIX
4149threads. These threads can run concurrently (unlike the previous
4150"coop" thread implementation), but need to cooperate for things like
a558cc63 4151the GC.
f0b4d944 4152
8d54e73a
MV
4153The default is "pthreads", unless your platform doesn't have pthreads,
4154in which case "null" threads are used.
2902a459 4155
a6d75e53
MV
4156See the manual for details, nodes "Initialization", "Multi-Threading",
4157"Blocking", and others.
a558cc63 4158
f74bdbd3
MV
4159** There is the new notion of 'discouraged' features.
4160
4161This is a milder form of deprecation.
4162
4163Things that are discouraged should not be used in new code, but it is
4164OK to leave them in old code for now. When a discouraged feature is
4165used, no warning message is printed like there is for 'deprecated'
4166features. Also, things that are merely discouraged are nevertheless
4167implemented efficiently, while deprecated features can be very slow.
4168
4169You can omit discouraged features from libguile by configuring it with
4170the '--disable-discouraged' option.
4171
4172** Deprecation warnings can be controlled at run-time.
4173
4174(debug-enable 'warn-deprecated) switches them on and (debug-disable
4175'warn-deprecated) switches them off.
4176
0f24e75b 4177** Support for SRFI 61, extended cond syntax for multiple values has
a81d0de1
MV
4178 been added.
4179
4180This SRFI is always available.
4181
f7fb2f39 4182** Support for require-extension, SRFI-55, has been added.
9a5fc8c2 4183
f7fb2f39
RB
4184The SRFI-55 special form `require-extension' has been added. It is
4185available at startup, and provides a portable way to load Scheme
4186extensions. SRFI-55 only requires support for one type of extension,
4187"srfi"; so a set of SRFIs may be loaded via (require-extension (srfi 1
418813 14)).
4189
4190** New module (srfi srfi-26) provides support for `cut' and `cute'.
4191
4192The (srfi srfi-26) module is an implementation of SRFI-26 which
4193provides the `cut' and `cute' syntax. These may be used to specialize
4194parameters without currying.
9a5fc8c2 4195
f5d54eb7
RB
4196** New module (srfi srfi-31)
4197
4198This is an implementation of SRFI-31 which provides a special form
4199`rec' for recursive evaluation.
4200
7b1574ed
MV
4201** The modules (srfi srfi-13), (srfi srfi-14) and (srfi srfi-4) have
4202 been merged with the core, making their functionality always
4203 available.
c5080b51 4204
ce7c0293
MV
4205The modules are still available, tho, and you could use them together
4206with a renaming import, for example.
c5080b51 4207
6191ccec 4208** Guile no longer includes its own version of libltdl.
4e250ded 4209
6191ccec 4210The official version is good enough now.
4e250ded 4211
ae7ded56
MV
4212** The --enable-htmldoc option has been removed from 'configure'.
4213
4214Support for translating the documentation into HTML is now always
4215provided. Use 'make html'.
4216
0f24e75b
MV
4217** New module (ice-9 serialize):
4218
4219(serialize FORM1 ...) and (parallelize FORM1 ...) are useful when you
4220don't trust the thread safety of most of your program, but where you
4221have some section(s) of code which you consider can run in parallel to
4222other sections. See ice-9/serialize.scm for more information.
4223
c34e5780
MV
4224** The configure option '--disable-arrays' has been removed.
4225
4226Support for arrays and uniform numeric arrays is now always included
4227in Guile.
4228
328dc9a3 4229* Changes to the stand-alone interpreter
f12ef3fd 4230
3ece39d6
MV
4231** New command line option `-L'.
4232
4233This option adds a directory to the front of the load path.
4234
f12ef3fd
MV
4235** New command line option `--no-debug'.
4236
4237Specifying `--no-debug' on the command line will keep the debugging
4238evaluator turned off, even for interactive sessions.
4239
4240** User-init file ~/.guile is now loaded with the debugging evaluator.
4241
4242Previously, the normal evaluator would have been used. Using the
4243debugging evaluator gives better error messages.
4244
aff7e166
MV
4245** The '-e' option now 'read's its argument.
4246
4247This is to allow the new '(@ MODULE-NAME VARIABLE-NAME)' construct to
4248be used with '-e'. For example, you can now write a script like
4249
4250 #! /bin/sh
4251 exec guile -e '(@ (demo) main)' -s "$0" "$@"
4252 !#
4253
4254 (define-module (demo)
4255 :export (main))
4256
4257 (define (main args)
4258 (format #t "Demo: ~a~%" args))
4259
4260
f12ef3fd
MV
4261* Changes to Scheme functions and syntax
4262
930888e8
MV
4263** Guardians have changed back to their original semantics
4264
4265Guardians now behave like described in the paper by Dybvig et al. In
4266particular, they no longer make guarantees about the order in which
4267they return objects, and they can no longer be greedy.
4268
4269They no longer drop cyclic data structures.
4270
4271The C function scm_make_guardian has been changed incompatibly and no
4272longer takes the 'greedy_p' argument.
4273
87bdbdbc
MV
4274** New function hashx-remove!
4275
4276This function completes the set of 'hashx' functions.
4277
a558cc63
MV
4278** The concept of dynamic roots has been factored into continuation
4279 barriers and dynamic states.
4280
4281Each thread has a current dynamic state that carries the values of the
4282fluids. You can create and copy dynamic states and use them as the
4283second argument for 'eval'. See "Fluids and Dynamic States" in the
4284manual.
4285
4286To restrict the influence that captured continuations can have on the
4287control flow, you can errect continuation barriers. See "Continuation
4288Barriers" in the manual.
4289
4290The function call-with-dynamic-root now essentially temporarily
4291installs a new dynamic state and errects a continuation barrier.
4292
a2b6a0e7
MV
4293** The default load path no longer includes "." at the end.
4294
4295Automatically loading modules from the current directory should not
4296happen by default. If you want to allow it in a more controlled
4297manner, set the environment variable GUILE_LOAD_PATH or the Scheme
4298variable %load-path.
4299
7b1574ed
MV
4300** The uniform vector and array support has been overhauled.
4301
4302It now complies with SRFI-4 and the weird prototype based uniform
4303array creation has been deprecated. See the manual for more details.
4304
d233b123
MV
4305Some non-compatible changes have been made:
4306 - characters can no longer be stored into byte arrays.
0f24e75b
MV
4307 - strings and bit vectors are no longer considered to be uniform numeric
4308 vectors.
3167d5e4
MV
4309 - array-rank throws an error for non-arrays instead of returning zero.
4310 - array-ref does no longer accept non-arrays when no indices are given.
d233b123
MV
4311
4312There is the new notion of 'generalized vectors' and corresponding
4313procedures like 'generalized-vector-ref'. Generalized vectors include
c34e5780 4314strings, bitvectors, ordinary vectors, and uniform numeric vectors.
d233b123 4315
a558cc63
MV
4316Arrays use generalized vectors as their storage, so that you still
4317have arrays of characters, bits, etc. However, uniform-array-read!
4318and uniform-array-write can no longer read/write strings and
4319bitvectors.
bb9f50ae 4320
ce7c0293
MV
4321** There is now support for copy-on-write substrings, mutation-sharing
4322 substrings and read-only strings.
3ff9283d 4323
ce7c0293
MV
4324Three new procedures are related to this: substring/shared,
4325substring/copy, and substring/read-only. See the manual for more
4326information.
4327
6a1d27ea
MV
4328** Backtraces will now highlight the value that caused the error.
4329
4330By default, these values are enclosed in "{...}", such as in this
4331example:
4332
4333 guile> (car 'a)
4334
4335 Backtrace:
4336 In current input:
4337 1: 0* [car {a}]
4338
4339 <unnamed port>:1:1: In procedure car in expression (car (quote a)):
4340 <unnamed port>:1:1: Wrong type (expecting pair): a
4341 ABORT: (wrong-type-arg)
4342
4343The prefix and suffix used for highlighting can be set via the two new
4344printer options 'highlight-prefix' and 'highlight-suffix'. For
4345example, putting this into ~/.guile will output the bad value in bold
4346on an ANSI terminal:
4347
4348 (print-set! highlight-prefix "\x1b[1m")
4349 (print-set! highlight-suffix "\x1b[22m")
4350
4351
8dbafacd
MV
4352** 'gettext' support for internationalization has been added.
4353
4354See the manual for details.
4355
aff7e166
MV
4356** New syntax '@' and '@@':
4357
4358You can now directly refer to variables exported from a module by
4359writing
4360
4361 (@ MODULE-NAME VARIABLE-NAME)
4362
4363For example (@ (ice-9 pretty-print) pretty-print) will directly access
4364the pretty-print variable exported from the (ice-9 pretty-print)
4365module. You don't need to 'use' that module first. You can also use
b0d10ba6 4366'@' as a target of 'set!', as in (set! (@ mod var) val).
aff7e166
MV
4367
4368The related syntax (@@ MODULE-NAME VARIABLE-NAME) works just like '@',
4369but it can also access variables that have not been exported. It is
4370intended only for kluges and temporary fixes and for debugging, not
4371for ordinary code.
4372
aef0bdb4
MV
4373** Keyword syntax has been made more disciplined.
4374
4375Previously, the name of a keyword was read as a 'token' but printed as
4376a symbol. Now, it is read as a general Scheme datum which must be a
4377symbol.
4378
4379Previously:
4380
4381 guile> #:12
4382 #:#{12}#
4383 guile> #:#{12}#
4384 #:#{\#{12}\#}#
4385 guile> #:(a b c)
4386 #:#{}#
4387 ERROR: In expression (a b c):
4388 Unbound variable: a
4389 guile> #: foo
4390 #:#{}#
4391 ERROR: Unbound variable: foo
4392
4393Now:
4394
4395 guile> #:12
4396 ERROR: Wrong type (expecting symbol): 12
4397 guile> #:#{12}#
4398 #:#{12}#
4399 guile> #:(a b c)
4400 ERROR: Wrong type (expecting symbol): (a b c)
4401 guile> #: foo
4402 #:foo
4403
227eafdb
MV
4404** The printing of symbols that might look like keywords can be
4405 controlled.
4406
4407The new printer option 'quote-keywordish-symbols' controls how symbols
4408are printed that have a colon as their first or last character. The
4409default now is to only quote a symbol with #{...}# when the read
4410option 'keywords' is not '#f'. Thus:
4411
4412 guile> (define foo (string->symbol ":foo"))
4413 guile> (read-set! keywords #f)
4414 guile> foo
4415 :foo
4416 guile> (read-set! keywords 'prefix)
4417 guile> foo
4418 #{:foo}#
4419 guile> (print-set! quote-keywordish-symbols #f)
4420 guile> foo
4421 :foo
4422
1363e3e7
KR
4423** 'while' now provides 'break' and 'continue'
4424
4425break and continue were previously bound in a while loop, but not
4426documented, and continue didn't quite work properly. The undocumented
4427parameter to break which gave a return value for the while has been
4428dropped.
4429
570b5b14
MV
4430** 'call-with-current-continuation' is now also available under the name
4431 'call/cc'.
4432
b0d10ba6 4433** The module system now checks for duplicate bindings.
7b07e5ef 4434
fe6ee052
MD
4435The module system now can check for name conflicts among imported
4436bindings.
f595ccfe 4437
b0d10ba6 4438The behavior can be controlled by specifying one or more 'duplicates'
fe6ee052
MD
4439handlers. For example, to make Guile return an error for every name
4440collision, write:
7b07e5ef
MD
4441
4442(define-module (foo)
4443 :use-module (bar)
4444 :use-module (baz)
fe6ee052 4445 :duplicates check)
f595ccfe 4446
fe6ee052
MD
4447The new default behavior of the module system when a name collision
4448has been detected is to
4449
4450 1. Give priority to bindings marked as a replacement.
6496a663 4451 2. Issue a warning (different warning if overriding core binding).
fe6ee052
MD
4452 3. Give priority to the last encountered binding (this corresponds to
4453 the old behavior).
4454
4455If you want the old behavior back without replacements or warnings you
4456can add the line:
f595ccfe 4457
70a9dc9c 4458 (default-duplicate-binding-handler 'last)
7b07e5ef 4459
fe6ee052 4460to your .guile init file.
7b07e5ef 4461
f595ccfe
MD
4462** New define-module option: :replace
4463
4464:replace works as :export, but, in addition, marks the binding as a
4465replacement.
4466
4467A typical example is `format' in (ice-9 format) which is a replacement
4468for the core binding `format'.
7b07e5ef 4469
70da0033
MD
4470** Adding prefixes to imported bindings in the module system
4471
4472There is now a new :use-module option :prefix. It can be used to add
4473a prefix to all imported bindings.
4474
4475 (define-module (foo)
4476 :use-module ((bar) :prefix bar:))
4477
4478will import all bindings exported from bar, but rename them by adding
4479the prefix `bar:'.
4480
b0d10ba6
MV
4481** Conflicting generic functions can be automatically merged.
4482
4483When two imported bindings conflict and they are both generic
4484functions, the two functions can now be merged automatically. This is
4485activated with the 'duplicates' handler 'merge-generics'.
4486
b2cbe8d8
RB
4487** New function: effective-version
4488
4489Returns the "effective" version number. This is just the normal full
4490version string without the final micro-version number. See "Changes
4491to the distribution" above.
4492
382053e9 4493** New threading functions: parallel, letpar, par-map, and friends
dbe30084 4494
382053e9
KR
4495These are convenient ways to run calculations in parallel in new
4496threads. See "Parallel forms" in the manual for details.
359aab24 4497
e2d820a1
MV
4498** New function 'try-mutex'.
4499
4500This function will attempt to lock a mutex but will return immediately
0f24e75b 4501instead of blocking and indicate failure.
e2d820a1
MV
4502
4503** Waiting on a condition variable can have a timeout.
4504
0f24e75b 4505The function 'wait-condition-variable' now takes a third, optional
e2d820a1
MV
4506argument that specifies the point in time where the waiting should be
4507aborted.
4508
4509** New function 'broadcast-condition-variable'.
4510
5e405a60
MV
4511** New functions 'all-threads' and 'current-thread'.
4512
4513** Signals and system asyncs work better with threads.
4514
4515The function 'sigaction' now takes a fourth, optional, argument that
4516specifies the thread that the handler should run in. When the
4517argument is omitted, the handler will run in the thread that called
4518'sigaction'.
4519
4520Likewise, 'system-async-mark' takes a second, optional, argument that
4521specifies the thread that the async should run in. When it is
4522omitted, the async will run in the thread that called
4523'system-async-mark'.
4524
4525C code can use the new functions scm_sigaction_for_thread and
4526scm_system_async_mark_for_thread to pass the new thread argument.
4527
a558cc63
MV
4528When a thread blocks on a mutex, a condition variable or is waiting
4529for IO to be possible, it will still execute system asyncs. This can
4530be used to interrupt such a thread by making it execute a 'throw', for
4531example.
4532
5e405a60
MV
4533** The function 'system-async' is deprecated.
4534
4535You can now pass any zero-argument procedure to 'system-async-mark'.
4536The function 'system-async' will just return its argument unchanged
4537now.
4538
acfa1f52
MV
4539** New functions 'call-with-blocked-asyncs' and
4540 'call-with-unblocked-asyncs'
4541
4542The expression (call-with-blocked-asyncs PROC) will call PROC and will
4543block execution of system asyncs for the current thread by one level
4544while PROC runs. Likewise, call-with-unblocked-asyncs will call a
4545procedure and will unblock the execution of system asyncs by one
4546level for the current thread.
4547
4548Only system asyncs are affected by these functions.
4549
4550** The functions 'mask-signals' and 'unmask-signals' are deprecated.
4551
4552Use 'call-with-blocked-asyncs' or 'call-with-unblocked-asyncs'
4553instead. Those functions are easier to use correctly and can be
4554nested.
4555
7b232758
MV
4556** New function 'unsetenv'.
4557
f30482f3
MV
4558** New macro 'define-syntax-public'.
4559
4560It works like 'define-syntax' and also exports the defined macro (but
4561only on top-level).
4562
1ee34062
MV
4563** There is support for Infinity and NaNs.
4564
4565Following PLT Scheme, Guile can now work with infinite numbers, and
4566'not-a-numbers'.
4567
4568There is new syntax for numbers: "+inf.0" (infinity), "-inf.0"
4569(negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as
4570"+nan.0"). These numbers are inexact and have no exact counterpart.
4571
4572Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the
4573sign of the dividend. The infinities are integers, and they answer #t
4574for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is
4575not '=' to itself, but '+nan.0' is 'eqv?' to itself.
4576
4577For example
4578
4579 (/ 1 0.0)
4580 => +inf.0
4581
4582 (/ 0 0.0)
4583 => +nan.0
4584
4585 (/ 0)
4586 ERROR: Numerical overflow
4587
7b232758
MV
4588Two new predicates 'inf?' and 'nan?' can be used to test for the
4589special values.
4590
ba1b077b
MV
4591** Inexact zero can have a sign.
4592
4593Guile can now distinguish between plus and minus inexact zero, if your
4594platform supports this, too. The two zeros are equal according to
4595'=', but not according to 'eqv?'. For example
4596
4597 (- 0.0)
4598 => -0.0
4599
4600 (= 0.0 (- 0.0))
4601 => #t
4602
4603 (eqv? 0.0 (- 0.0))
4604 => #f
4605
bdf26b60
MV
4606** Guile now has exact rationals.
4607
4608Guile can now represent fractions such as 1/3 exactly. Computing with
4609them is also done exactly, of course:
4610
4611 (* 1/3 3/2)
4612 => 1/2
4613
4614** 'floor', 'ceiling', 'round' and 'truncate' now return exact numbers
4615 for exact arguments.
4616
4617For example: (floor 2) now returns an exact 2 where in the past it
4618returned an inexact 2.0. Likewise, (floor 5/4) returns an exact 1.
4619
4620** inexact->exact no longer returns only integers.
4621
4622Without exact rationals, the closest exact number was always an
4623integer, but now inexact->exact returns the fraction that is exactly
4624equal to a floating point number. For example:
4625
4626 (inexact->exact 1.234)
4627 => 694680242521899/562949953421312
4628
e299cee2 4629When you want the old behavior, use 'round' explicitly:
bdf26b60
MV
4630
4631 (inexact->exact (round 1.234))
4632 => 1
4633
4634** New function 'rationalize'.
4635
4636This function finds a simple fraction that is close to a given real
4637number. For example (and compare with inexact->exact above):
4638
fb16d26e 4639 (rationalize (inexact->exact 1.234) 1/2000)
bdf26b60
MV
4640 => 58/47
4641
fb16d26e
MV
4642Note that, as required by R5RS, rationalize returns only then an exact
4643result when both its arguments are exact.
4644
bdf26b60
MV
4645** 'odd?' and 'even?' work also for inexact integers.
4646
4647Previously, (odd? 1.0) would signal an error since only exact integers
4648were recognized as integers. Now (odd? 1.0) returns #t, (odd? 2.0)
4649returns #f and (odd? 1.5) signals an error.
4650
b0d10ba6 4651** Guile now has uninterned symbols.
610922b2 4652
b0d10ba6 4653The new function 'make-symbol' will return an uninterned symbol. This
610922b2
MV
4654is a symbol that is unique and is guaranteed to remain unique.
4655However, uninterned symbols can not yet be read back in.
4656
4657Use the new function 'symbol-interned?' to check whether a symbol is
4658interned or not.
4659
0e6f7775
MV
4660** pretty-print has more options.
4661
4662The function pretty-print from the (ice-9 pretty-print) module can now
4663also be invoked with keyword arguments that control things like
71f271b2 4664maximum output width. See the manual for details.
0e6f7775 4665
8c84b81e 4666** Variables have no longer a special behavior for `equal?'.
ee0c7345
MV
4667
4668Previously, comparing two variables with `equal?' would recursivly
4669compare their values. This is no longer done. Variables are now only
4670`equal?' if they are `eq?'.
4671
4e21fa60
MV
4672** `(begin)' is now valid.
4673
4674You can now use an empty `begin' form. It will yield #<unspecified>
4675when evaluated and simply be ignored in a definition context.
4676
3063e30a
DH
4677** Deprecated: procedure->macro
4678
b0d10ba6
MV
4679Change your code to use 'define-macro' or r5rs macros. Also, be aware
4680that macro expansion will not be done during evaluation, but prior to
4681evaluation.
3063e30a 4682
0a50eeaa
NJ
4683** Soft ports now allow a `char-ready?' procedure
4684
4685The vector argument to `make-soft-port' can now have a length of
4686either 5 or 6. (Previously the length had to be 5.) The optional 6th
4687element is interpreted as an `input-waiting' thunk -- i.e. a thunk
4688that returns the number of characters that can be read immediately
4689without the soft port blocking.
4690
63dd3413
DH
4691** Deprecated: undefine
4692
4693There is no replacement for undefine.
4694
9abd541e
NJ
4695** The functions make-keyword-from-dash-symbol and keyword-dash-symbol
4696 have been discouraged.
aef0bdb4
MV
4697
4698They are relics from a time where a keyword like #:foo was used
4699directly as a Tcl option "-foo" and thus keywords were internally
4700stored as a symbol with a starting dash. We now store a symbol
4701without the dash.
4702
4703Use symbol->keyword and keyword->symbol instead.
4704
9abd541e
NJ
4705** The `cheap' debug option is now obsolete
4706
4707Evaluator trap calls are now unconditionally "cheap" - in other words,
4708they pass a debug object to the trap handler rather than a full
4709continuation. The trap handler code can capture a full continuation
4710by using `call-with-current-continuation' in the usual way, if it so
4711desires.
4712
4713The `cheap' option is retained for now so as not to break existing
4714code which gets or sets it, but setting it now has no effect. It will
4715be removed in the next major Guile release.
4716
4717** Evaluator trap calls now support `tweaking'
4718
4719`Tweaking' means that the trap handler code can modify the Scheme
4720expression that is about to be evaluated (in the case of an
4721enter-frame trap) or the value that is being returned (in the case of
4722an exit-frame trap). The trap handler code indicates that it wants to
4723do this by returning a pair whose car is the symbol 'instead and whose
4724cdr is the modified expression or return value.
36a9b236 4725
b00418df
DH
4726* Changes to the C interface
4727
87bdbdbc
MV
4728** The functions scm_hash_fn_remove_x and scm_hashx_remove_x no longer
4729 take a 'delete' function argument.
4730
4731This argument makes no sense since the delete function is used to
4732remove a pair from an alist, and this must not be configurable.
4733
4734This is an incompatible change.
4735
1cf1bb95
MV
4736** The GH interface is now subject to the deprecation mechanism
4737
4738The GH interface has been deprecated for quite some time but now it is
4739actually removed from Guile when it is configured with
4740--disable-deprecated.
4741
4742See the manual "Transitioning away from GH" for more information.
4743
f7f3964e
MV
4744** A new family of functions for converting between C values and
4745 Scheme values has been added.
4746
4747These functions follow a common naming scheme and are designed to be
4748easier to use, thread-safe and more future-proof than the older
4749alternatives.
4750
4751 - int scm_is_* (...)
4752
4753 These are predicates that return a C boolean: 1 or 0. Instead of
4754 SCM_NFALSEP, you can now use scm_is_true, for example.
4755
4756 - <type> scm_to_<type> (SCM val, ...)
4757
4758 These are functions that convert a Scheme value into an appropriate
4759 C value. For example, you can use scm_to_int to safely convert from
4760 a SCM to an int.
4761
a2b6a0e7 4762 - SCM scm_from_<type> (<type> val, ...)
f7f3964e
MV
4763
4764 These functions convert from a C type to a SCM value; for example,
4765 scm_from_int for ints.
4766
4767There is a huge number of these functions, for numbers, strings,
4768symbols, vectors, etc. They are documented in the reference manual in
4769the API section together with the types that they apply to.
4770
96d8c217
MV
4771** New functions for dealing with complex numbers in C have been added.
4772
4773The new functions are scm_c_make_rectangular, scm_c_make_polar,
4774scm_c_real_part, scm_c_imag_part, scm_c_magnitude and scm_c_angle.
4775They work like scm_make_rectangular etc but take or return doubles
4776directly.
4777
4778** The function scm_make_complex has been discouraged.
4779
4780Use scm_c_make_rectangular instead.
4781
f7f3964e
MV
4782** The INUM macros have been deprecated.
4783
4784A lot of code uses these macros to do general integer conversions,
b0d10ba6
MV
4785although the macros only work correctly with fixnums. Use the
4786following alternatives.
f7f3964e
MV
4787
4788 SCM_INUMP -> scm_is_integer or similar
4789 SCM_NINUMP -> !scm_is_integer or similar
4790 SCM_MAKINUM -> scm_from_int or similar
4791 SCM_INUM -> scm_to_int or similar
4792
b0d10ba6 4793 SCM_VALIDATE_INUM_* -> Do not use these; scm_to_int, etc. will
f7f3964e
MV
4794 do the validating for you.
4795
f9656a9f
MV
4796** The scm_num2<type> and scm_<type>2num functions and scm_make_real
4797 have been discouraged.
f7f3964e
MV
4798
4799Use the newer scm_to_<type> and scm_from_<type> functions instead for
4800new code. The functions have been discouraged since they don't fit
4801the naming scheme.
4802
4803** The 'boolean' macros SCM_FALSEP etc have been discouraged.
4804
4805They have strange names, especially SCM_NFALSEP, and SCM_BOOLP
4806evaluates its argument twice. Use scm_is_true, etc. instead for new
4807code.
4808
4809** The macro SCM_EQ_P has been discouraged.
4810
4811Use scm_is_eq for new code, which fits better into the naming
4812conventions.
d5b203a6 4813
d5ac9b2a
MV
4814** The macros SCM_CONSP, SCM_NCONSP, SCM_NULLP, and SCM_NNULLP have
4815 been discouraged.
4816
4817Use the function scm_is_pair or scm_is_null instead.
4818
409eb4e5
MV
4819** The functions scm_round and scm_truncate have been deprecated and
4820 are now available as scm_c_round and scm_c_truncate, respectively.
4821
4822These functions occupy the names that scm_round_number and
4823scm_truncate_number should have.
4824
3ff9283d
MV
4825** The functions scm_c_string2str, scm_c_substring2str, and
4826 scm_c_symbol2str have been deprecated.
c41acab3
MV
4827
4828Use scm_to_locale_stringbuf or similar instead, maybe together with
4829scm_substring.
4830
3ff9283d
MV
4831** New functions scm_c_make_string, scm_c_string_length,
4832 scm_c_string_ref, scm_c_string_set_x, scm_c_substring,
4833 scm_c_substring_shared, scm_c_substring_copy.
4834
4835These are like scm_make_string, scm_length, etc. but are slightly
4836easier to use from C.
4837
4838** The macros SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_LENGTH,
4839 SCM_SYMBOL_CHARS, and SCM_SYMBOL_LENGTH have been deprecated.
4840
4841They export too many assumptions about the implementation of strings
4842and symbols that are no longer true in the presence of
b0d10ba6
MV
4843mutation-sharing substrings and when Guile switches to some form of
4844Unicode.
3ff9283d
MV
4845
4846When working with strings, it is often best to use the normal string
4847functions provided by Guile, such as scm_c_string_ref,
b0d10ba6
MV
4848scm_c_string_set_x, scm_string_append, etc. Be sure to look in the
4849manual since many more such functions are now provided than
4850previously.
3ff9283d
MV
4851
4852When you want to convert a SCM string to a C string, use the
4853scm_to_locale_string function or similar instead. For symbols, use
4854scm_symbol_to_string and then work with that string. Because of the
4855new string representation, scm_symbol_to_string does not need to copy
4856and is thus quite efficient.
4857
aef0bdb4 4858** Some string, symbol and keyword functions have been discouraged.
3ff9283d 4859
b0d10ba6 4860They don't fit into the uniform naming scheme and are not explicit
3ff9283d
MV
4861about the character encoding.
4862
4863Replace according to the following table:
4864
4865 scm_allocate_string -> scm_c_make_string
4866 scm_take_str -> scm_take_locale_stringn
4867 scm_take0str -> scm_take_locale_string
4868 scm_mem2string -> scm_from_locale_stringn
4869 scm_str2string -> scm_from_locale_string
4870 scm_makfrom0str -> scm_from_locale_string
4871 scm_mem2symbol -> scm_from_locale_symboln
b0d10ba6 4872 scm_mem2uninterned_symbol -> scm_from_locale_stringn + scm_make_symbol
3ff9283d
MV
4873 scm_str2symbol -> scm_from_locale_symbol
4874
4875 SCM_SYMBOL_HASH -> scm_hashq
4876 SCM_SYMBOL_INTERNED_P -> scm_symbol_interned_p
4877
aef0bdb4
MV
4878 scm_c_make_keyword -> scm_from_locale_keyword
4879
4880** The functions scm_keyword_to_symbol and sym_symbol_to_keyword are
4881 now also available to C code.
4882
4883** SCM_KEYWORDP and SCM_KEYWORDSYM have been deprecated.
4884
4885Use scm_is_keyword and scm_keyword_to_symbol instead, but note that
4886the latter returns the true name of the keyword, not the 'dash name',
4887as SCM_KEYWORDSYM used to do.
4888
dc91d8de
MV
4889** A new way to access arrays in a thread-safe and efficient way has
4890 been added.
4891
4892See the manual, node "Accessing Arrays From C".
4893
3167d5e4
MV
4894** The old uniform vector and bitvector implementations have been
4895 unceremoniously removed.
d4ea47c8 4896
a558cc63 4897This implementation exposed the details of the tagging system of
d4ea47c8 4898Guile. Use the new C API explained in the manual in node "Uniform
c34e5780 4899Numeric Vectors" and "Bit Vectors", respectively.
d4ea47c8
MV
4900
4901The following macros are gone: SCM_UVECTOR_BASE, SCM_SET_UVECTOR_BASE,
4902SCM_UVECTOR_MAXLENGTH, SCM_UVECTOR_LENGTH, SCM_MAKE_UVECTOR_TAG,
3167d5e4
MV
4903SCM_SET_UVECTOR_LENGTH, SCM_BITVECTOR_P, SCM_BITVECTOR_BASE,
4904SCM_SET_BITVECTOR_BASE, SCM_BITVECTOR_MAX_LENGTH,
4905SCM_BITVECTOR_LENGTH, SCM_MAKE_BITVECTOR_TAG,
0b63c1ee
MV
4906SCM_SET_BITVECTOR_LENGTH, SCM_BITVEC_REF, SCM_BITVEC_SET,
4907SCM_BITVEC_CLR.
d4ea47c8 4908
c34e5780
MV
4909** The macros dealing with vectors have been deprecated.
4910
4911Use the new functions scm_is_vector, scm_vector_elements,
0b63c1ee
MV
4912scm_vector_writable_elements, etc, or scm_is_simple_vector,
4913SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, etc instead. See the
4914manual for more details.
c34e5780
MV
4915
4916Deprecated are SCM_VECTORP, SCM_VELTS, SCM_VECTOR_MAX_LENGTH,
4917SCM_VECTOR_LENGTH, SCM_VECTOR_REF, SCM_VECTOR_SET, SCM_WRITABLE_VELTS.
4918
4919The following macros have been removed: SCM_VECTOR_BASE,
4920SCM_SET_VECTOR_BASE, SCM_MAKE_VECTOR_TAG, SCM_SET_VECTOR_LENGTH,
4921SCM_VELTS_AS_STACKITEMS, SCM_SETVELTS, SCM_GC_WRITABLE_VELTS.
4922
0c7a5cab 4923** Some C functions and macros related to arrays have been deprecated.
dc91d8de
MV
4924
4925Migrate according to the following table:
4926
e94d0be2 4927 scm_make_uve -> scm_make_typed_array, scm_make_u8vector etc.
dc91d8de
MV
4928 scm_make_ra -> scm_make_array
4929 scm_shap2ra -> scm_make_array
4930 scm_cvref -> scm_c_generalized_vector_ref
4931 scm_ra_set_contp -> do not use
4932 scm_aind -> scm_array_handle_pos
4933 scm_raprin1 -> scm_display or scm_write
4934
0c7a5cab
MV
4935 SCM_ARRAYP -> scm_is_array
4936 SCM_ARRAY_NDIM -> scm_c_array_rank
4937 SCM_ARRAY_DIMS -> scm_array_handle_dims
4938 SCM_ARRAY_CONTP -> do not use
4939 SCM_ARRAY_MEM -> do not use
4940 SCM_ARRAY_V -> scm_array_handle_elements or similar
4941 SCM_ARRAY_BASE -> do not use
4942
c1e7caf7
MV
4943** SCM_CELL_WORD_LOC has been deprecated.
4944
b0d10ba6 4945Use the new macro SCM_CELL_OBJECT_LOC instead, which returns a pointer
c1e7caf7
MV
4946to a SCM, as opposed to a pointer to a scm_t_bits.
4947
4948This was done to allow the correct use of pointers into the Scheme
4949heap. Previously, the heap words were of type scm_t_bits and local
4950variables and function arguments were of type SCM, making it
4951non-standards-conformant to have a pointer that can point to both.
4952
3ff9283d 4953** New macros SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, etc.
27968825
MV
4954
4955These macros should be used instead of SCM_CELL_WORD_2/3 to access the
4956second and third words of double smobs. Likewise for
4957SCM_SET_SMOB_DATA_2 and SCM_SET_SMOB_DATA_3.
4958
4959Also, there is SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS that should be
4960used to get and set the 16 exra bits in the zeroth word of a smob.
4961
4962And finally, there is SCM_SMOB_OBJECT and SCM_SMOB_SET_OBJECT for
4963accesing the first immediate word of a smob as a SCM value, and there
4964is SCM_SMOB_OBJECT_LOC for getting a pointer to the first immediate
b0d10ba6 4965smob word. Like wise for SCM_SMOB_OBJECT_2, etc.
27968825 4966
b0d10ba6 4967** New way to deal with non-local exits and re-entries.
9879d390
MV
4968
4969There is a new set of functions that essentially do what
fc6bb283
MV
4970scm_internal_dynamic_wind does, but in a way that is more convenient
4971for C code in some situations. Here is a quick example of how to
4972prevent a potential memory leak:
9879d390
MV
4973
4974 void
4975 foo ()
4976 {
4977 char *mem;
4978
661ae7ab 4979 scm_dynwind_begin (0);
9879d390
MV
4980
4981 mem = scm_malloc (100);
661ae7ab 4982 scm_dynwind_unwind_handler (free, mem, SCM_F_WIND_EXPLICITLY);
f1da8e4e
MV
4983
4984 /* MEM would leak if BAR throws an error.
661ae7ab 4985 SCM_DYNWIND_UNWIND_HANDLER frees it nevertheless.
c41acab3 4986 */
9879d390 4987
9879d390
MV
4988 bar ();
4989
661ae7ab 4990 scm_dynwind_end ();
9879d390 4991
e299cee2 4992 /* Because of SCM_F_WIND_EXPLICITLY, MEM will be freed by
661ae7ab 4993 SCM_DYNWIND_END as well.
9879d390
MV
4994 */
4995 }
4996
661ae7ab 4997For full documentation, see the node "Dynamic Wind" in the manual.
9879d390 4998
661ae7ab 4999** New function scm_dynwind_free
c41acab3 5000
661ae7ab
MV
5001This function calls 'free' on a given pointer when a dynwind context
5002is left. Thus the call to scm_dynwind_unwind_handler above could be
5003replaced with simply scm_dynwind_free (mem).
c41acab3 5004
a6d75e53
MV
5005** New functions scm_c_call_with_blocked_asyncs and
5006 scm_c_call_with_unblocked_asyncs
5007
5008Like scm_call_with_blocked_asyncs etc. but for C functions.
5009
661ae7ab 5010** New functions scm_dynwind_block_asyncs and scm_dynwind_unblock_asyncs
49c00ecc
MV
5011
5012In addition to scm_c_call_with_blocked_asyncs you can now also use
661ae7ab
MV
5013scm_dynwind_block_asyncs in a 'dynwind context' (see above). Likewise for
5014scm_c_call_with_unblocked_asyncs and scm_dynwind_unblock_asyncs.
49c00ecc 5015
a558cc63
MV
5016** The macros SCM_DEFER_INTS, SCM_ALLOW_INTS, SCM_REDEFER_INTS,
5017 SCM_REALLOW_INTS have been deprecated.
5018
5019They do no longer fulfill their original role of blocking signal
5020delivery. Depending on what you want to achieve, replace a pair of
661ae7ab
MV
5021SCM_DEFER_INTS and SCM_ALLOW_INTS with a dynwind context that locks a
5022mutex, blocks asyncs, or both. See node "Critical Sections" in the
5023manual.
a6d75e53
MV
5024
5025** The value 'scm_mask_ints' is no longer writable.
5026
5027Previously, you could set scm_mask_ints directly. This is no longer
5028possible. Use scm_c_call_with_blocked_asyncs and
5029scm_c_call_with_unblocked_asyncs instead.
a558cc63 5030
49c00ecc
MV
5031** New way to temporarily set the current input, output or error ports
5032
661ae7ab 5033C code can now use scm_dynwind_current_<foo>_port in a 'dynwind
0f24e75b 5034context' (see above). <foo> is one of "input", "output" or "error".
49c00ecc 5035
fc6bb283
MV
5036** New way to temporarily set fluids
5037
661ae7ab 5038C code can now use scm_dynwind_fluid in a 'dynwind context' (see
fc6bb283
MV
5039above) to temporarily set the value of a fluid.
5040
89fcf1b4
MV
5041** New types scm_t_intmax and scm_t_uintmax.
5042
5043On platforms that have them, these types are identical to intmax_t and
5044uintmax_t, respectively. On other platforms, they are identical to
5045the largest integer types that Guile knows about.
5046
b0d10ba6 5047** The functions scm_unmemocopy and scm_unmemoize have been removed.
9fcf3cbb 5048
b0d10ba6 5049You should not have used them.
9fcf3cbb 5050
5ebbe4ef
RB
5051** Many public #defines with generic names have been made private.
5052
5053#defines with generic names like HAVE_FOO or SIZEOF_FOO have been made
b0d10ba6 5054private or renamed with a more suitable public name.
f03314f9
DH
5055
5056** The macro SCM_TYP16S has been deprecated.
5057
b0d10ba6 5058This macro is not intended for public use.
f03314f9 5059
0d5e3480
DH
5060** The macro SCM_SLOPPY_INEXACTP has been deprecated.
5061
b0d10ba6 5062Use scm_is_true (scm_inexact_p (...)) instead.
0d5e3480
DH
5063
5064** The macro SCM_SLOPPY_REALP has been deprecated.
5065
b0d10ba6 5066Use scm_is_real instead.
0d5e3480
DH
5067
5068** The macro SCM_SLOPPY_COMPLEXP has been deprecated.
5069
b0d10ba6 5070Use scm_is_complex instead.
5ebbe4ef 5071
b0d10ba6 5072** Some preprocessor defines have been deprecated.
5ebbe4ef 5073
b0d10ba6
MV
5074These defines indicated whether a certain feature was present in Guile
5075or not. Going forward, assume that the features are always present.
5ebbe4ef 5076
b0d10ba6
MV
5077The macros are: USE_THREADS, GUILE_ISELECT, READER_EXTENSIONS,
5078DEBUG_EXTENSIONS, DYNAMIC_LINKING.
5ebbe4ef 5079
b0d10ba6
MV
5080The following macros have been removed completely: MEMOIZE_LOCALS,
5081SCM_RECKLESS, SCM_CAUTIOUS.
5ebbe4ef
RB
5082
5083** The preprocessor define STACK_DIRECTION has been deprecated.
5084
5085There should be no need to know about the stack direction for ordinary
b0d10ba6 5086programs.
5ebbe4ef 5087
b2cbe8d8
RB
5088** New function: scm_effective_version
5089
5090Returns the "effective" version number. This is just the normal full
5091version string without the final micro-version number. See "Changes
5092to the distribution" above.
5093
2902a459
MV
5094** The function scm_call_with_new_thread has a new prototype.
5095
5096Instead of taking a list with the thunk and handler, these two
5097arguments are now passed directly:
5098
5099 SCM scm_call_with_new_thread (SCM thunk, SCM handler);
5100
5101This is an incompatible change.
5102
ffd0ef3b
MV
5103** New snarfer macro SCM_DEFINE_PUBLIC.
5104
5105This is like SCM_DEFINE, but also calls scm_c_export for the defined
5106function in the init section.
5107
8734ce02
MV
5108** The snarfer macro SCM_SNARF_INIT is now officially supported.
5109
39e8f371
HWN
5110** Garbage collector rewrite.
5111
5112The garbage collector is cleaned up a lot, and now uses lazy
5113sweeping. This is reflected in the output of (gc-stats); since cells
5114are being freed when they are allocated, the cells-allocated field
5115stays roughly constant.
5116
5117For malloc related triggers, the behavior is changed. It uses the same
5118heuristic as the cell-triggered collections. It may be tuned with the
5119environment variables GUILE_MIN_YIELD_MALLOC. This is the percentage
5120for minimum yield of malloc related triggers. The default is 40.
5121GUILE_INIT_MALLOC_LIMIT sets the initial trigger for doing a GC. The
5122default is 200 kb.
5123
5124Debugging operations for the freelist have been deprecated, along with
5125the C variables that control garbage collection. The environment
5126variables GUILE_MAX_SEGMENT_SIZE, GUILE_INIT_SEGMENT_SIZE_2,
5127GUILE_INIT_SEGMENT_SIZE_1, and GUILE_MIN_YIELD_2 should be used.
5128
1367aa5e
HWN
5129For understanding the memory usage of a GUILE program, the routine
5130gc-live-object-stats returns an alist containing the number of live
5131objects for every type.
5132
5133
5ec1d2c8
DH
5134** The function scm_definedp has been renamed to scm_defined_p
5135
5136The name scm_definedp is deprecated.
5137
b0d10ba6 5138** The struct scm_cell type has been renamed to scm_t_cell
228a24ef
DH
5139
5140This is in accordance to Guile's naming scheme for types. Note that
5141the name scm_cell is now used for a function that allocates and
5142initializes a new cell (see below).
5143
0906625f
MV
5144** New functions for memory management
5145
5146A new set of functions for memory management has been added since the
5147old way (scm_must_malloc, scm_must_free, etc) was error prone and
5148indeed, Guile itself contained some long standing bugs that could
5149cause aborts in long running programs.
5150
5151The new functions are more symmetrical and do not need cooperation
5152from smob free routines, among other improvements.
5153
eab1b259
HWN
5154The new functions are scm_malloc, scm_realloc, scm_calloc, scm_strdup,
5155scm_strndup, scm_gc_malloc, scm_gc_calloc, scm_gc_realloc,
5156scm_gc_free, scm_gc_register_collectable_memory, and
0906625f
MV
5157scm_gc_unregister_collectable_memory. Refer to the manual for more
5158details and for upgrading instructions.
5159
5160The old functions for memory management have been deprecated. They
5161are: scm_must_malloc, scm_must_realloc, scm_must_free,
5162scm_must_strdup, scm_must_strndup, scm_done_malloc, scm_done_free.
5163
4aa104a4
MV
5164** Declarations of exported features are marked with SCM_API.
5165
5166Every declaration of a feature that belongs to the exported Guile API
5167has been marked by adding the macro "SCM_API" to the start of the
5168declaration. This macro can expand into different things, the most
5169common of which is just "extern" for Unix platforms. On Win32, it can
5170be used to control which symbols are exported from a DLL.
5171
8f99e3f3 5172If you `#define SCM_IMPORT' before including <libguile.h>, SCM_API
4aa104a4
MV
5173will expand into "__declspec (dllimport) extern", which is needed for
5174linking to the Guile DLL in Windows.
5175
b0d10ba6 5176There are also SCM_RL_IMPORT, SCM_SRFI1314_IMPORT, and
8f99e3f3 5177SCM_SRFI4_IMPORT, for the corresponding libraries.
4aa104a4 5178
a9930d22
MV
5179** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated.
5180
b0d10ba6
MV
5181Use the new functions scm_cell and scm_double_cell instead. The old
5182macros had problems because with them allocation and initialization
5183was separated and the GC could sometimes observe half initialized
5184cells. Only careful coding by the user of SCM_NEWCELL and
5185SCM_NEWCELL2 could make this safe and efficient.
a9930d22 5186
5132eef0
DH
5187** CHECK_ENTRY, CHECK_APPLY and CHECK_EXIT have been deprecated.
5188
5189Use the variables scm_check_entry_p, scm_check_apply_p and scm_check_exit_p
5190instead.
5191
bc76d628
DH
5192** SRCBRKP has been deprecated.
5193
5194Use scm_c_source_property_breakpoint_p instead.
5195
3063e30a
DH
5196** Deprecated: scm_makmacro
5197
b0d10ba6
MV
5198Change your code to use either scm_makmmacro or to define macros in
5199Scheme, using 'define-macro'.
1e5f92ce 5200
1a61d41b
MV
5201** New function scm_c_port_for_each.
5202
5203This function is like scm_port_for_each but takes a pointer to a C
5204function as the callback instead of a SCM value.
5205
1f834c95
MV
5206** The names scm_internal_select, scm_thread_sleep, and
5207 scm_thread_usleep have been discouraged.
5208
5209Use scm_std_select, scm_std_sleep, scm_std_usleep instead.
5210
aa9200e5
MV
5211** The GC can no longer be blocked.
5212
5213The global flags scm_gc_heap_lock and scm_block_gc have been removed.
5214The GC can now run (partially) concurrently with other code and thus
5215blocking it is not well defined.
5216
b0d10ba6
MV
5217** Many definitions have been removed that were previously deprecated.
5218
5219scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify,
5220scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify,
5221scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2,
5222scm_tc16_allocated, SCM_SET_SYMBOL_HASH, SCM_IM_NIL_IFY, SCM_IM_T_IFY,
5223SCM_IM_0_COND, SCM_IM_0_IFY, SCM_IM_1_IFY, SCM_GC_SET_ALLOCATED,
5224scm_debug_newcell, scm_debug_newcell2, SCM_HUP_SIGNAL, SCM_INT_SIGNAL,
5225SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, SCM_ALRM_SIGNAL,
5226SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, SCM_ORD_SIG,
5227SCM_NUM_SIGS, scm_top_level_lookup_closure_var,
5228*top-level-lookup-closure*, scm_system_transformer, scm_eval_3,
5229scm_eval2, root_module_lookup_closure, SCM_SLOPPY_STRINGP,
5230SCM_RWSTRINGP, scm_read_only_string_p, scm_make_shared_substring,
5231scm_tc7_substring, sym_huh, SCM_VARVCELL, SCM_UDVARIABLEP,
5232SCM_DEFVARIABLEP, scm_mkbig, scm_big2inum, scm_adjbig, scm_normbig,
5233scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl, SCM_FIXNUM_BIT,
5234SCM_SETCHARS, SCM_SLOPPY_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
5235SCM_LENGTH_MAX, SCM_SETLENGTH, SCM_ROSTRINGP, SCM_ROLENGTH,
5236SCM_ROCHARS, SCM_ROUCHARS, SCM_SUBSTRP, SCM_COERCE_SUBSTR,
5237scm_sym2vcell, scm_intern, scm_intern0, scm_sysintern, scm_sysintern0,
66c8ded2 5238scm_sysintern0_no_module_lookup, scm_init_symbols_deprecated,
2109da78 5239scm_vector_set_length_x, scm_contregs, scm_debug_info,
983e697d
MV
5240scm_debug_frame, SCM_DSIDEVAL, SCM_CONST_LONG, SCM_VCELL,
5241SCM_GLOBAL_VCELL, SCM_VCELL_INIT, SCM_GLOBAL_VCELL_INIT,
5242SCM_HUGE_LENGTH, SCM_VALIDATE_STRINGORSUBSTR, SCM_VALIDATE_ROSTRING,
5243SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY,
5244SCM_VALIDATE_RWSTRING, DIGITS, scm_small_istr2int, scm_istr2int,
2109da78
MV
5245scm_istr2flo, scm_istring2number, scm_istr2int, scm_istr2flo,
5246scm_istring2number, scm_vtable_index_vcell, scm_si_vcell, SCM_ECONSP,
5247SCM_NECONSP, SCM_GLOC_VAR, SCM_GLOC_VAL, SCM_GLOC_SET_VAL,
c41acab3
MV
5248SCM_GLOC_VAL_LOC, scm_make_gloc, scm_gloc_p, scm_tc16_variable,
5249SCM_CHARS, SCM_LENGTH, SCM_SET_STRING_CHARS, SCM_SET_STRING_LENGTH.
b51bad08 5250
09172f9c
NJ
5251* Changes to bundled modules
5252
5253** (ice-9 debug)
5254
5255Using the (ice-9 debug) module no longer automatically switches Guile
5256to use the debugging evaluator. If you want to switch to the
5257debugging evaluator (which is needed for backtrace information if you
5258hit an error), please add an explicit "(debug-enable 'debug)" to your
5259code just after the code to use (ice-9 debug).
5260
328dc9a3 5261\f
c299f186
MD
5262Changes since Guile 1.4:
5263
5264* Changes to the distribution
5265
32d6f999
TTN
5266** A top-level TODO file is included.
5267
311b6a3c 5268** Guile now uses a versioning scheme similar to that of the Linux kernel.
c81ea65d
RB
5269
5270Guile now always uses three numbers to represent the version,
5271i.e. "1.6.5". The first number, 1, is the major version number, the
5272second number, 6, is the minor version number, and the third number,
52735, is the micro version number. Changes in major version number
5274indicate major changes in Guile.
5275
5276Minor version numbers that are even denote stable releases, and odd
5277minor version numbers denote development versions (which may be
5278unstable). The micro version number indicates a minor sub-revision of
5279a given MAJOR.MINOR release.
5280
5281In keeping with the new scheme, (minor-version) and scm_minor_version
5282no longer return everything but the major version number. They now
5283just return the minor version number. Two new functions
5284(micro-version) and scm_micro_version have been added to report the
5285micro version number.
5286
5287In addition, ./GUILE-VERSION now defines GUILE_MICRO_VERSION.
5288
5c790b44
RB
5289** New preprocessor definitions are available for checking versions.
5290
5291version.h now #defines SCM_MAJOR_VERSION, SCM_MINOR_VERSION, and
5292SCM_MICRO_VERSION to the appropriate integer values.
5293
311b6a3c
MV
5294** Guile now actively warns about deprecated features.
5295
5296The new configure option `--enable-deprecated=LEVEL' and the
5297environment variable GUILE_WARN_DEPRECATED control this mechanism.
5298See INSTALL and README for more information.
5299
0b073f0f
RB
5300** Guile is much more likely to work on 64-bit architectures.
5301
5302Guile now compiles and passes "make check" with only two UNRESOLVED GC
5e137c65
RB
5303cases on Alpha and ia64 based machines now. Thanks to John Goerzen
5304for the use of a test machine, and thanks to Stefan Jahn for ia64
5305patches.
0b073f0f 5306
e658215a
RB
5307** New functions: setitimer and getitimer.
5308
5309These implement a fairly direct interface to the libc functions of the
5310same name.
5311
8630fdfc
RB
5312** The #. reader extension is now disabled by default.
5313
5314For safety reasons, #. evaluation is disabled by default. To
5315re-enable it, set the fluid read-eval? to #t. For example:
5316
67b7dd9e 5317 (fluid-set! read-eval? #t)
8630fdfc
RB
5318
5319but make sure you realize the potential security risks involved. With
5320read-eval? enabled, reading a data file from an untrusted source can
5321be dangerous.
5322
f2a75d81 5323** New SRFI modules have been added:
4df36934 5324
dfdf5826
MG
5325SRFI-0 `cond-expand' is now supported in Guile, without requiring
5326using a module.
5327
e8bb0476
MG
5328(srfi srfi-1) is a library containing many useful pair- and list-processing
5329 procedures.
5330
7adc2c58 5331(srfi srfi-2) exports and-let*.
4df36934 5332
b74a7ec8
MG
5333(srfi srfi-4) implements homogeneous numeric vector datatypes.
5334
7adc2c58
RB
5335(srfi srfi-6) is a dummy module for now, since guile already provides
5336 all of the srfi-6 procedures by default: open-input-string,
5337 open-output-string, get-output-string.
4df36934 5338
7adc2c58 5339(srfi srfi-8) exports receive.
4df36934 5340
7adc2c58 5341(srfi srfi-9) exports define-record-type.
4df36934 5342
dfdf5826
MG
5343(srfi srfi-10) exports define-reader-ctor and implements the reader
5344 extension #,().
5345
7adc2c58 5346(srfi srfi-11) exports let-values and let*-values.
4df36934 5347
7adc2c58 5348(srfi srfi-13) implements the SRFI String Library.
53e29a1e 5349
7adc2c58 5350(srfi srfi-14) implements the SRFI Character-Set Library.
53e29a1e 5351
dfdf5826
MG
5352(srfi srfi-17) implements setter and getter-with-setter and redefines
5353 some accessor procedures as procedures with getters. (such as car,
5354 cdr, vector-ref etc.)
5355
5356(srfi srfi-19) implements the SRFI Time/Date Library.
2b60bc95 5357
466bb4b3
TTN
5358** New scripts / "executable modules"
5359
5360Subdirectory "scripts" contains Scheme modules that are packaged to
5361also be executable as scripts. At this time, these scripts are available:
5362
5363 display-commentary
5364 doc-snarf
5365 generate-autoload
5366 punify
58e5b910 5367 read-scheme-source
466bb4b3
TTN
5368 use2dot
5369
5370See README there for more info.
5371
54c17ccb
TTN
5372These scripts can be invoked from the shell with the new program
5373"guile-tools", which keeps track of installation directory for you.
5374For example:
5375
5376 $ guile-tools display-commentary srfi/*.scm
5377
5378guile-tools is copied to the standard $bindir on "make install".
5379
0109c4bf
MD
5380** New module (ice-9 stack-catch):
5381
5382stack-catch is like catch, but saves the current state of the stack in
3c1d1301
RB
5383the fluid the-last-stack. This fluid can be useful when using the
5384debugger and when re-throwing an error.
0109c4bf 5385
fbf0c8c7
MV
5386** The module (ice-9 and-let*) has been renamed to (ice-9 and-let-star)
5387
5388This has been done to prevent problems on lesser operating systems
5389that can't tolerate `*'s in file names. The exported macro continues
5390to be named `and-let*', of course.
5391
4f60cc33 5392On systems that support it, there is also a compatibility module named
fbf0c8c7 5393(ice-9 and-let*). It will go away in the next release.
6c0201ad 5394
9d774814 5395** New modules (oop goops) etc.:
14f1d9fe
MD
5396
5397 (oop goops)
5398 (oop goops describe)
5399 (oop goops save)
5400 (oop goops active-slot)
5401 (oop goops composite-slot)
5402
9d774814 5403The Guile Object Oriented Programming System (GOOPS) has been
311b6a3c
MV
5404integrated into Guile. For further information, consult the GOOPS
5405manual and tutorial in the `doc' directory.
14f1d9fe 5406
9d774814
GH
5407** New module (ice-9 rdelim).
5408
5409This exports the following procedures which were previously defined
1c8cbd62 5410in the default environment:
9d774814 5411
1c8cbd62
GH
5412read-line read-line! read-delimited read-delimited! %read-delimited!
5413%read-line write-line
9d774814 5414
1c8cbd62
GH
5415For backwards compatibility the definitions are still imported into the
5416default environment in this version of Guile. However you should add:
9d774814
GH
5417
5418(use-modules (ice-9 rdelim))
5419
1c8cbd62
GH
5420to any program which uses the definitions, since this may change in
5421future.
9d774814
GH
5422
5423Alternatively, if guile-scsh is installed, the (scsh rdelim) module
5424can be used for similar functionality.
5425
7e267da1
GH
5426** New module (ice-9 rw)
5427
5428This is a subset of the (scsh rw) module from guile-scsh. Currently
373f4948 5429it defines two procedures:
7e267da1 5430
311b6a3c 5431*** New function: read-string!/partial str [port_or_fdes [start [end]]]
7e267da1 5432
4bcdfe46
GH
5433 Read characters from a port or file descriptor into a string STR.
5434 A port must have an underlying file descriptor -- a so-called
5435 fport. This procedure is scsh-compatible and can efficiently read
311b6a3c 5436 large strings.
7e267da1 5437
4bcdfe46
GH
5438*** New function: write-string/partial str [port_or_fdes [start [end]]]
5439
5440 Write characters from a string STR to a port or file descriptor.
5441 A port must have an underlying file descriptor -- a so-called
5442 fport. This procedure is mostly compatible and can efficiently
5443 write large strings.
5444
e5005373
KN
5445** New module (ice-9 match)
5446
311b6a3c
MV
5447This module includes Andrew K. Wright's pattern matcher. See
5448ice-9/match.scm for brief description or
e5005373 5449
311b6a3c 5450 http://www.star-lab.com/wright/code.html
e5005373 5451
311b6a3c 5452for complete documentation.
e5005373 5453
4f60cc33
NJ
5454** New module (ice-9 buffered-input)
5455
5456This module provides procedures to construct an input port from an
5457underlying source of input that reads and returns its input in chunks.
5458The underlying input source is a Scheme procedure, specified by the
5459caller, which the port invokes whenever it needs more input.
5460
5461This is useful when building an input port whose back end is Readline
5462or a UI element such as the GtkEntry widget.
5463
5464** Documentation
5465
5466The reference and tutorial documentation that was previously
5467distributed separately, as `guile-doc', is now included in the core
5468Guile distribution. The documentation consists of the following
5469manuals.
5470
5471- The Guile Tutorial (guile-tut.texi) contains a tutorial introduction
5472 to using Guile.
5473
5474- The Guile Reference Manual (guile.texi) contains (or is intended to
5475 contain) reference documentation on all aspects of Guile.
5476
5477- The GOOPS Manual (goops.texi) contains both tutorial-style and
5478 reference documentation for using GOOPS, Guile's Object Oriented
5479 Programming System.
5480
c3e62877
NJ
5481- The Revised^5 Report on the Algorithmic Language Scheme
5482 (r5rs.texi).
4f60cc33
NJ
5483
5484See the README file in the `doc' directory for more details.
5485
094a67bb
MV
5486** There are a couple of examples in the examples/ directory now.
5487
9d774814
GH
5488* Changes to the stand-alone interpreter
5489
e7e58018
MG
5490** New command line option `--use-srfi'
5491
5492Using this option, SRFI modules can be loaded on startup and be
5493available right from the beginning. This makes programming portable
5494Scheme programs easier.
5495
5496The option `--use-srfi' expects a comma-separated list of numbers,
5497each representing a SRFI number to be loaded into the interpreter
5498before starting evaluating a script file or the REPL. Additionally,
5499the feature identifier for the loaded SRFIs is recognized by
5500`cond-expand' when using this option.
5501
5502Example:
5503$ guile --use-srfi=8,13
5504guile> (receive (x z) (values 1 2) (+ 1 2))
55053
58e5b910 5506guile> (string-pad "bla" 20)
e7e58018
MG
5507" bla"
5508
094a67bb
MV
5509** Guile now always starts up in the `(guile-user)' module.
5510
6e9382f1 5511Previously, scripts executed via the `-s' option would run in the
094a67bb
MV
5512`(guile)' module and the repl would run in the `(guile-user)' module.
5513Now every user action takes place in the `(guile-user)' module by
5514default.
e7e58018 5515
c299f186
MD
5516* Changes to Scheme functions and syntax
5517
720e1c30
MV
5518** Character classifiers work for non-ASCII characters.
5519
5520The predicates `char-alphabetic?', `char-numeric?',
5521`char-whitespace?', `char-lower?', `char-upper?' and `char-is-both?'
5522no longer check whether their arguments are ASCII characters.
5523Previously, a character would only be considered alphabetic when it
5524was also ASCII, for example.
5525
311b6a3c
MV
5526** Previously deprecated Scheme functions have been removed:
5527
5528 tag - no replacement.
5529 fseek - replaced by seek.
5530 list* - replaced by cons*.
5531
5532** It's now possible to create modules with controlled environments
5533
5534Example:
5535
5536(use-modules (ice-9 safe))
5537(define m (make-safe-module))
5538;;; m will now be a module containing only a safe subset of R5RS
5539(eval '(+ 1 2) m) --> 3
5540(eval 'load m) --> ERROR: Unbound variable: load
5541
5542** Evaluation of "()", the empty list, is now an error.
8c2c9967
MV
5543
5544Previously, the expression "()" evaluated to the empty list. This has
5545been changed to signal a "missing expression" error. The correct way
5546to write the empty list as a literal constant is to use quote: "'()".
5547
311b6a3c
MV
5548** New concept of `Guile Extensions'.
5549
5550A Guile Extension is just a ordinary shared library that can be linked
5551at run-time. We found it advantageous to give this simple concept a
5552dedicated name to distinguish the issues related to shared libraries
5553from the issues related to the module system.
5554
5555*** New function: load-extension
5556
5557Executing (load-extension lib init) is mostly equivalent to
5558
5559 (dynamic-call init (dynamic-link lib))
5560
5561except when scm_register_extension has been called previously.
5562Whenever appropriate, you should use `load-extension' instead of
5563dynamic-link and dynamic-call.
5564
5565*** New C function: scm_c_register_extension
5566
5567This function registers a initialization function for use by
5568`load-extension'. Use it when you don't want specific extensions to
5569be loaded as shared libraries (for example on platforms that don't
5570support dynamic linking).
5571
8c2c9967
MV
5572** Auto-loading of compiled-code modules is deprecated.
5573
5574Guile used to be able to automatically find and link a shared
c10ecc4c 5575library to satisfy requests for a module. For example, the module
8c2c9967
MV
5576`(foo bar)' could be implemented by placing a shared library named
5577"foo/libbar.so" (or with a different extension) in a directory on the
5578load path of Guile.
5579
311b6a3c
MV
5580This has been found to be too tricky, and is no longer supported. The
5581shared libraries are now called "extensions". You should now write a
5582small Scheme file that calls `load-extension' to load the shared
e299cee2 5583library and initialize it explicitly.
8c2c9967
MV
5584
5585The shared libraries themselves should be installed in the usual
5586places for shared libraries, with names like "libguile-foo-bar".
5587
5588For example, place this into a file "foo/bar.scm"
5589
5590 (define-module (foo bar))
5591
311b6a3c
MV
5592 (load-extension "libguile-foo-bar" "foobar_init")
5593
5594** Backward incompatible change: eval EXP ENVIRONMENT-SPECIFIER
5595
5596`eval' is now R5RS, that is it takes two arguments.
5597The second argument is an environment specifier, i.e. either
5598
5599 (scheme-report-environment 5)
5600 (null-environment 5)
5601 (interaction-environment)
5602
5603or
8c2c9967 5604
311b6a3c 5605 any module.
8c2c9967 5606
6f76852b
MV
5607** The module system has been made more disciplined.
5608
311b6a3c
MV
5609The function `eval' will save and restore the current module around
5610the evaluation of the specified expression. While this expression is
5611evaluated, `(current-module)' will now return the right module, which
5612is the module specified as the second argument to `eval'.
6f76852b 5613
311b6a3c 5614A consequence of this change is that `eval' is not particularly
6f76852b
MV
5615useful when you want allow the evaluated code to change what module is
5616designated as the current module and have this change persist from one
5617call to `eval' to the next. The read-eval-print-loop is an example
5618where `eval' is now inadequate. To compensate, there is a new
5619function `primitive-eval' that does not take a module specifier and
5620that does not save/restore the current module. You should use this
5621function together with `set-current-module', `current-module', etc
5622when you want to have more control over the state that is carried from
5623one eval to the next.
5624
5625Additionally, it has been made sure that forms that are evaluated at
5626the top level are always evaluated with respect to the current module.
5627Previously, subforms of top-level forms such as `begin', `case',
5628etc. did not respect changes to the current module although these
5629subforms are at the top-level as well.
5630
311b6a3c 5631To prevent strange behavior, the forms `define-module',
6f76852b
MV
5632`use-modules', `use-syntax', and `export' have been restricted to only
5633work on the top level. The forms `define-public' and
5634`defmacro-public' only export the new binding on the top level. They
5635behave just like `define' and `defmacro', respectively, when they are
5636used in a lexical environment.
5637
0a892a2c
MV
5638Also, `export' will no longer silently re-export bindings imported
5639from a used module. It will emit a `deprecation' warning and will
5640cease to perform any re-export in the next version. If you actually
5641want to re-export bindings, use the new `re-export' in place of
5642`export'. The new `re-export' will not make copies of variables when
5643rexporting them, as `export' did wrongly.
5644
047dc3ae
TTN
5645** Module system now allows selection and renaming of imported bindings
5646
5647Previously, when using `use-modules' or the `#:use-module' clause in
5648the `define-module' form, all the bindings (association of symbols to
5649values) for imported modules were added to the "current module" on an
5650as-is basis. This has been changed to allow finer control through two
5651new facilities: selection and renaming.
5652
5653You can now select which of the imported module's bindings are to be
5654visible in the current module by using the `:select' clause. This
5655clause also can be used to rename individual bindings. For example:
5656
5657 ;; import all bindings no questions asked
5658 (use-modules (ice-9 common-list))
5659
5660 ;; import four bindings, renaming two of them;
5661 ;; the current module sees: every some zonk-y zonk-n
5662 (use-modules ((ice-9 common-list)
5663 :select (every some
5664 (remove-if . zonk-y)
5665 (remove-if-not . zonk-n))))
5666
5667You can also programmatically rename all selected bindings using the
5668`:renamer' clause, which specifies a proc that takes a symbol and
5669returns another symbol. Because it is common practice to use a prefix,
5670we now provide the convenience procedure `symbol-prefix-proc'. For
5671example:
5672
5673 ;; import four bindings, renaming two of them specifically,
5674 ;; and all four w/ prefix "CL:";
5675 ;; the current module sees: CL:every CL:some CL:zonk-y CL:zonk-n
5676 (use-modules ((ice-9 common-list)
5677 :select (every some
5678 (remove-if . zonk-y)
5679 (remove-if-not . zonk-n))
5680 :renamer (symbol-prefix-proc 'CL:)))
5681
5682 ;; import four bindings, renaming two of them specifically,
5683 ;; and all four by upcasing.
5684 ;; the current module sees: EVERY SOME ZONK-Y ZONK-N
5685 (define (upcase-symbol sym)
5686 (string->symbol (string-upcase (symbol->string sym))))
5687
5688 (use-modules ((ice-9 common-list)
5689 :select (every some
5690 (remove-if . zonk-y)
5691 (remove-if-not . zonk-n))
5692 :renamer upcase-symbol))
5693
5694Note that programmatic renaming is done *after* individual renaming.
5695Also, the above examples show `use-modules', but the same facilities are
5696available for the `#:use-module' clause of `define-module'.
5697
5698See manual for more info.
5699
b7d69200 5700** The semantics of guardians have changed.
56495472 5701
b7d69200 5702The changes are for the most part compatible. An important criterion
6c0201ad 5703was to keep the typical usage of guardians as simple as before, but to
c0a5d888 5704make the semantics safer and (as a result) more useful.
56495472 5705
c0a5d888 5706*** All objects returned from guardians are now properly alive.
56495472 5707
c0a5d888
ML
5708It is now guaranteed that any object referenced by an object returned
5709from a guardian is alive. It's now impossible for a guardian to
5710return a "contained" object before its "containing" object.
56495472
ML
5711
5712One incompatible (but probably not very important) change resulting
5713from this is that it is no longer possible to guard objects that
5714indirectly reference themselves (i.e. are parts of cycles). If you do
5715so accidentally, you'll get a warning.
5716
c0a5d888
ML
5717*** There are now two types of guardians: greedy and sharing.
5718
5719If you call (make-guardian #t) or just (make-guardian), you'll get a
5720greedy guardian, and for (make-guardian #f) a sharing guardian.
5721
5722Greedy guardians are the default because they are more "defensive".
5723You can only greedily guard an object once. If you guard an object
5724more than once, once in a greedy guardian and the rest of times in
5725sharing guardians, then it is guaranteed that the object won't be
5726returned from sharing guardians as long as it is greedily guarded
5727and/or alive.
5728
5729Guardians returned by calls to `make-guardian' can now take one more
5730optional parameter, which says whether to throw an error in case an
5731attempt is made to greedily guard an object that is already greedily
5732guarded. The default is true, i.e. throw an error. If the parameter
5733is false, the guardian invocation returns #t if guarding was
5734successful and #f if it wasn't.
5735
5736Also, since greedy guarding is, in effect, a side-effecting operation
5737on objects, a new function is introduced: `destroy-guardian!'.
5738Invoking this function on a guardian renders it unoperative and, if
5739the guardian is greedy, clears the "greedily guarded" property of the
5740objects that were guarded by it, thus undoing the side effect.
5741
5742Note that all this hair is hardly very important, since guardian
5743objects are usually permanent.
5744
311b6a3c
MV
5745** Continuations created by call-with-current-continuation now accept
5746any number of arguments, as required by R5RS.
818febc0 5747
c10ecc4c 5748** New function `issue-deprecation-warning'
56426fdb 5749
311b6a3c 5750This function is used to display the deprecation messages that are
c10ecc4c 5751controlled by GUILE_WARN_DEPRECATION as explained in the README.
56426fdb
KN
5752
5753 (define (id x)
c10ecc4c
MV
5754 (issue-deprecation-warning "`id' is deprecated. Use `identity' instead.")
5755 (identity x))
56426fdb
KN
5756
5757 guile> (id 1)
5758 ;; `id' is deprecated. Use `identity' instead.
5759 1
5760 guile> (id 1)
5761 1
5762
c10ecc4c
MV
5763** New syntax `begin-deprecated'
5764
5765When deprecated features are included (as determined by the configure
5766option --enable-deprecated), `begin-deprecated' is identical to
5767`begin'. When deprecated features are excluded, it always evaluates
5768to `#f', ignoring the body forms.
5769
17f367e0
MV
5770** New function `make-object-property'
5771
5772This function returns a new `procedure with setter' P that can be used
5773to attach a property to objects. When calling P as
5774
5775 (set! (P obj) val)
5776
5777where `obj' is any kind of object, it attaches `val' to `obj' in such
5778a way that it can be retrieved by calling P as
5779
5780 (P obj)
5781
5782This function will replace procedure properties, symbol properties and
5783source properties eventually.
5784
76ef92f3
MV
5785** Module (ice-9 optargs) now uses keywords instead of `#&'.
5786
5787Instead of #&optional, #&key, etc you should now use #:optional,
5788#:key, etc. Since #:optional is a keyword, you can write it as just
5789:optional when (read-set! keywords 'prefix) is active.
5790
5791The old reader syntax `#&' is still supported, but deprecated. It
5792will be removed in the next release.
5793
c0997079
MD
5794** New define-module option: pure
5795
5796Tells the module system not to include any bindings from the root
5797module.
5798
5799Example:
5800
5801(define-module (totally-empty-module)
5802 :pure)
5803
5804** New define-module option: export NAME1 ...
5805
5806Export names NAME1 ...
5807
5808This option is required if you want to be able to export bindings from
5809a module which doesn't import one of `define-public' or `export'.
5810
5811Example:
5812
311b6a3c
MV
5813 (define-module (foo)
5814 :pure
5815 :use-module (ice-9 r5rs)
5816 :export (bar))
69b5f65a 5817
311b6a3c 5818 ;;; Note that we're pure R5RS below this point!
69b5f65a 5819
311b6a3c
MV
5820 (define (bar)
5821 ...)
daa6ba18 5822
1f3908c4
KN
5823** New function: object->string OBJ
5824
5825Return a Scheme string obtained by printing a given object.
5826
eb5c0a2a
GH
5827** New function: port? X
5828
5829Returns a boolean indicating whether X is a port. Equivalent to
5830`(or (input-port? X) (output-port? X))'.
5831
efa40607
DH
5832** New function: file-port?
5833
5834Determines whether a given object is a port that is related to a file.
5835
34b56ec4
GH
5836** New function: port-for-each proc
5837
311b6a3c
MV
5838Apply PROC to each port in the Guile port table in turn. The return
5839value is unspecified. More specifically, PROC is applied exactly once
5840to every port that exists in the system at the time PORT-FOR-EACH is
5841invoked. Changes to the port table while PORT-FOR-EACH is running
5842have no effect as far as PORT-FOR-EACH is concerned.
34b56ec4
GH
5843
5844** New function: dup2 oldfd newfd
5845
5846A simple wrapper for the `dup2' system call. Copies the file
5847descriptor OLDFD to descriptor number NEWFD, replacing the
5848previous meaning of NEWFD. Both OLDFD and NEWFD must be integers.
5849Unlike for dup->fdes or primitive-move->fdes, no attempt is made
264e9cbc 5850to move away ports which are using NEWFD. The return value is
34b56ec4
GH
5851unspecified.
5852
5853** New function: close-fdes fd
5854
5855A simple wrapper for the `close' system call. Close file
5856descriptor FD, which must be an integer. Unlike close (*note
5857close: Ports and File Descriptors.), the file descriptor will be
5858closed even if a port is using it. The return value is
5859unspecified.
5860
94e6d793
MG
5861** New function: crypt password salt
5862
5863Encrypts `password' using the standard unix password encryption
5864algorithm.
5865
5866** New function: chroot path
5867
5868Change the root directory of the running process to `path'.
5869
5870** New functions: getlogin, cuserid
5871
5872Return the login name or the user name of the current effective user
5873id, respectively.
5874
5875** New functions: getpriority which who, setpriority which who prio
5876
5877Get or set the priority of the running process.
5878
5879** New function: getpass prompt
5880
5881Read a password from the terminal, first displaying `prompt' and
5882disabling echoing.
5883
5884** New function: flock file operation
5885
5886Set/remove an advisory shared or exclusive lock on `file'.
5887
5888** New functions: sethostname name, gethostname
5889
5890Set or get the hostname of the machine the current process is running
5891on.
5892
6d163216 5893** New function: mkstemp! tmpl
4f60cc33 5894
6d163216
GH
5895mkstemp creates a new unique file in the file system and returns a
5896new buffered port open for reading and writing to the file. TMPL
5897is a string specifying where the file should be created: it must
5898end with `XXXXXX' and will be changed in place to return the name
5899of the temporary file.
5900
62e63ba9
MG
5901** New function: open-input-string string
5902
5903Return an input string port which delivers the characters from
4f60cc33 5904`string'. This procedure, together with `open-output-string' and
62e63ba9
MG
5905`get-output-string' implements SRFI-6.
5906
5907** New function: open-output-string
5908
5909Return an output string port which collects all data written to it.
5910The data can then be retrieved by `get-output-string'.
5911
5912** New function: get-output-string
5913
5914Return the contents of an output string port.
5915
56426fdb
KN
5916** New function: identity
5917
5918Return the argument.
5919
5bef627d
GH
5920** socket, connect, accept etc., now have support for IPv6. IPv6 addresses
5921 are represented in Scheme as integers with normal host byte ordering.
5922
5923** New function: inet-pton family address
5924
311b6a3c
MV
5925Convert a printable string network address into an integer. Note that
5926unlike the C version of this function, the result is an integer with
5927normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
5928e.g.,
5929
5930 (inet-pton AF_INET "127.0.0.1") => 2130706433
5931 (inet-pton AF_INET6 "::1") => 1
5bef627d
GH
5932
5933** New function: inet-ntop family address
5934
311b6a3c
MV
5935Convert an integer network address into a printable string. Note that
5936unlike the C version of this function, the input is an integer with
5937normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
5938e.g.,
5939
5940 (inet-ntop AF_INET 2130706433) => "127.0.0.1"
5941 (inet-ntop AF_INET6 (- (expt 2 128) 1)) =>
5bef627d
GH
5942 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
5943
56426fdb
KN
5944** Deprecated: id
5945
5946Use `identity' instead.
5947
5cd06d5e
DH
5948** Deprecated: -1+
5949
5950Use `1-' instead.
5951
5952** Deprecated: return-it
5953
311b6a3c 5954Do without it.
5cd06d5e
DH
5955
5956** Deprecated: string-character-length
5957
5958Use `string-length' instead.
5959
5960** Deprecated: flags
5961
5962Use `logior' instead.
5963
4f60cc33
NJ
5964** Deprecated: close-all-ports-except.
5965
5966This was intended for closing ports in a child process after a fork,
5967but it has the undesirable side effect of flushing buffers.
5968port-for-each is more flexible.
34b56ec4
GH
5969
5970** The (ice-9 popen) module now attempts to set up file descriptors in
5971the child process from the current Scheme ports, instead of using the
5972current values of file descriptors 0, 1, and 2 in the parent process.
5973
b52e071b
DH
5974** Removed function: builtin-weak-bindings
5975
5976There is no such concept as a weak binding any more.
5977
9d774814 5978** Removed constants: bignum-radix, scm-line-incrementors
0f979f3f 5979
7d435120
MD
5980** define-method: New syntax mandatory.
5981
5982The new method syntax is now mandatory:
5983
5984(define-method (NAME ARG-SPEC ...) BODY ...)
5985(define-method (NAME ARG-SPEC ... . REST-ARG) BODY ...)
5986
5987 ARG-SPEC ::= ARG-NAME | (ARG-NAME TYPE)
5988 REST-ARG ::= ARG-NAME
5989
5990If you have old code using the old syntax, import
5991(oop goops old-define-method) before (oop goops) as in:
5992
5993 (use-modules (oop goops old-define-method) (oop goops))
5994
f3f9dcbc
MV
5995** Deprecated function: builtin-variable
5996 Removed function: builtin-bindings
5997
5998There is no longer a distinction between builtin or other variables.
5999Use module system operations for all variables.
6000
311b6a3c
MV
6001** Lazy-catch handlers are no longer allowed to return.
6002
6003That is, a call to `throw', `error', etc is now guaranteed to not
6004return.
6005
a583bf1e 6006** Bugfixes for (ice-9 getopt-long)
8c84b81e 6007
a583bf1e
TTN
6008This module is now tested using test-suite/tests/getopt-long.test.
6009The following bugs have been fixed:
6010
6011*** Parsing for options that are specified to have `optional' args now checks
6012if the next element is an option instead of unconditionally taking it as the
8c84b81e
TTN
6013option arg.
6014
a583bf1e
TTN
6015*** An error is now thrown for `--opt=val' when the option description
6016does not specify `(value #t)' or `(value optional)'. This condition used to
6017be accepted w/o error, contrary to the documentation.
6018
6019*** The error message for unrecognized options is now more informative.
6020It used to be "not a record", an artifact of the implementation.
6021
6022*** The error message for `--opt' terminating the arg list (no value), when
6023`(value #t)' is specified, is now more informative. It used to be "not enough
6024args".
6025
6026*** "Clumped" single-char args now preserve trailing string, use it as arg.
6027The expansion used to be like so:
6028
6029 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "--xyz")
6030
6031Note that the "5d" is dropped. Now it is like so:
6032
6033 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "5d" "--xyz")
6034
6035This enables single-char options to have adjoining arguments as long as their
6036constituent characters are not potential single-char options.
8c84b81e 6037
998bfc70
TTN
6038** (ice-9 session) procedure `arity' now works with (ice-9 optargs) `lambda*'
6039
6040The `lambda*' and derivative forms in (ice-9 optargs) now set a procedure
6041property `arglist', which can be retrieved by `arity'. The result is that
6042`arity' can give more detailed information than before:
6043
6044Before:
6045
6046 guile> (use-modules (ice-9 optargs))
6047 guile> (define* (foo #:optional a b c) a)
6048 guile> (arity foo)
6049 0 or more arguments in `lambda*:G0'.
6050
6051After:
6052
6053 guile> (arity foo)
6054 3 optional arguments: `a', `b' and `c'.
6055 guile> (define* (bar a b #:key c d #:allow-other-keys) a)
6056 guile> (arity bar)
6057 2 required arguments: `a' and `b', 2 keyword arguments: `c'
6058 and `d', other keywords allowed.
6059 guile> (define* (baz a b #:optional c #:rest r) a)
6060 guile> (arity baz)
6061 2 required arguments: `a' and `b', 1 optional argument: `c',
6062 the rest in `r'.
6063
311b6a3c
MV
6064* Changes to the C interface
6065
c81c130e
MV
6066** Types have been renamed from scm_*_t to scm_t_*.
6067
6068This has been done for POSIX sake. It reserves identifiers ending
6069with "_t". What a concept.
6070
6071The old names are still available with status `deprecated'.
6072
6073** scm_t_bits (former scm_bits_t) is now a unsigned type.
6074
6e9382f1 6075** Deprecated features have been removed.
e6c9e497
MV
6076
6077*** Macros removed
6078
6079 SCM_INPORTP, SCM_OUTPORTP SCM_ICHRP, SCM_ICHR, SCM_MAKICHR
6080 SCM_SETJMPBUF SCM_NSTRINGP SCM_NRWSTRINGP SCM_NVECTORP SCM_DOUBLE_CELLP
6081
6082*** C Functions removed
6083
6084 scm_sysmissing scm_tag scm_tc16_flo scm_tc_flo
6085 scm_fseek - replaced by scm_seek.
6086 gc-thunk - replaced by after-gc-hook.
6087 gh_int2scmb - replaced by gh_bool2scm.
6088 scm_tc_dblr - replaced by scm_tc16_real.
6089 scm_tc_dblc - replaced by scm_tc16_complex.
6090 scm_list_star - replaced by scm_cons_star.
6091
36284627
DH
6092** Deprecated: scm_makfromstr
6093
6094Use scm_mem2string instead.
6095
311b6a3c
MV
6096** Deprecated: scm_make_shared_substring
6097
6098Explicit shared substrings will disappear from Guile.
6099
6100Instead, "normal" strings will be implemented using sharing
6101internally, combined with a copy-on-write strategy.
6102
6103** Deprecated: scm_read_only_string_p
6104
6105The concept of read-only strings will disappear in next release of
6106Guile.
6107
6108** Deprecated: scm_sloppy_memq, scm_sloppy_memv, scm_sloppy_member
c299f186 6109
311b6a3c 6110Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
c299f186 6111
dd0e04ed
KN
6112** New functions: scm_call_0, scm_call_1, scm_call_2, scm_call_3
6113
83dbedcc
KR
6114Call a procedure with the indicated number of arguments. See "Fly
6115Evaluation" in the manual.
dd0e04ed
KN
6116
6117** New functions: scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3
6118
83dbedcc
KR
6119Call a procedure with the indicated number of arguments and a list of
6120further arguments. See "Fly Evaluation" in the manual.
dd0e04ed 6121
e235f2a6
KN
6122** New functions: scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5
6123
83dbedcc
KR
6124Create a list of the given number of elements. See "List
6125Constructors" in the manual.
e235f2a6
KN
6126
6127** Renamed function: scm_listify has been replaced by scm_list_n.
6128
6129** Deprecated macros: SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4,
6130SCM_LIST5, SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9.
6131
6132Use functions scm_list_N instead.
6133
6fe692e9
MD
6134** New function: scm_c_read (SCM port, void *buffer, scm_sizet size)
6135
6136Used by an application to read arbitrary number of bytes from a port.
6137Same semantics as libc read, except that scm_c_read only returns less
6138than SIZE bytes if at end-of-file.
6139
6140Warning: Doesn't update port line and column counts!
6141
6142** New function: scm_c_write (SCM port, const void *ptr, scm_sizet size)
6143
6144Used by an application to write arbitrary number of bytes to an SCM
6145port. Similar semantics as libc write. However, unlike libc
6146write, scm_c_write writes the requested number of bytes and has no
6147return value.
6148
6149Warning: Doesn't update port line and column counts!
6150
17f367e0
MV
6151** New function: scm_init_guile ()
6152
6153In contrast to scm_boot_guile, scm_init_guile will return normally
6154after initializing Guile. It is not available on all systems, tho.
6155
23ade5e7
DH
6156** New functions: scm_str2symbol, scm_mem2symbol
6157
6158The function scm_str2symbol takes a const char* pointing to a zero-terminated
6159field of characters and creates a scheme symbol object from that C string.
6160The function scm_mem2symbol takes a const char* and a number of characters and
6161creates a symbol from the characters in that memory area.
6162
17f367e0
MV
6163** New functions: scm_primitive_make_property
6164 scm_primitive_property_ref
6165 scm_primitive_property_set_x
6166 scm_primitive_property_del_x
6167
6168These functions implement a new way to deal with object properties.
6169See libguile/properties.c for their documentation.
6170
9d47a1e6
ML
6171** New function: scm_done_free (long size)
6172
6173This function is the inverse of scm_done_malloc. Use it to report the
6174amount of smob memory you free. The previous method, which involved
6175calling scm_done_malloc with negative argument, was somewhat
6176unintuitive (and is still available, of course).
6177
79a3dafe
DH
6178** New function: scm_c_memq (SCM obj, SCM list)
6179
6180This function provides a fast C level alternative for scm_memq for the case
6181that the list parameter is known to be a proper list. The function is a
6182replacement for scm_sloppy_memq, but is stricter in its requirements on its
6183list input parameter, since for anything else but a proper list the function's
6184behaviour is undefined - it may even crash or loop endlessly. Further, for
6185the case that the object is not found in the list, scm_c_memq returns #f which
6186is similar to scm_memq, but different from scm_sloppy_memq's behaviour.
6187
6c0201ad 6188** New functions: scm_remember_upto_here_1, scm_remember_upto_here_2,
5d2b97cd
DH
6189scm_remember_upto_here
6190
6191These functions replace the function scm_remember.
6192
6193** Deprecated function: scm_remember
6194
6195Use one of the new functions scm_remember_upto_here_1,
6196scm_remember_upto_here_2 or scm_remember_upto_here instead.
6197
be54b15d
DH
6198** New function: scm_allocate_string
6199
6200This function replaces the function scm_makstr.
6201
6202** Deprecated function: scm_makstr
6203
6204Use the new function scm_allocate_string instead.
6205
32d0d4b1
DH
6206** New global variable scm_gc_running_p introduced.
6207
6208Use this variable to find out if garbage collection is being executed. Up to
6209now applications have used scm_gc_heap_lock to test if garbage collection was
6210running, which also works because of the fact that up to know only the garbage
6211collector has set this variable. But, this is an implementation detail that
6212may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use
6213of this variable is (and has been) not fully safe anyway.
6214
5b9eb8ae
DH
6215** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH
6216
6217Use these instead of SCM_LENGTH_MAX.
6218
6c0201ad 6219** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH,
a6d9e5ab
DH
6220SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH,
6221SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH.
6222
6223Use these instead of SCM_LENGTH.
6224
6c0201ad 6225** New macros: SCM_SET_CONTINUATION_LENGTH, SCM_SET_STRING_LENGTH,
93778877
DH
6226SCM_SET_SYMBOL_LENGTH, SCM_SET_VECTOR_LENGTH, SCM_SET_UVECTOR_LENGTH,
6227SCM_SET_BITVECTOR_LENGTH
bc0eaf7b
DH
6228
6229Use these instead of SCM_SETLENGTH
6230
6c0201ad 6231** New macros: SCM_STRING_CHARS, SCM_SYMBOL_CHARS, SCM_CCLO_BASE,
a6d9e5ab
DH
6232SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM,
6233SCM_ARRAY_MEM
6234
e51fe79c
DH
6235Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or
6236SCM_VELTS.
a6d9e5ab 6237
6c0201ad 6238** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS,
6a0476fd
DH
6239SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE,
6240SCM_SET_VECTOR_BASE
6241
6242Use these instead of SCM_SETCHARS.
6243
a6d9e5ab
DH
6244** New macro: SCM_BITVECTOR_P
6245
6246** New macro: SCM_STRING_COERCE_0TERMINATION_X
6247
6248Use instead of SCM_COERCE_SUBSTR.
6249
30ea841d
DH
6250** New macros: SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN
6251
6252For directory objects, use these instead of SCM_OPDIRP and SCM_OPN.
6253
6c0201ad
TTN
6254** Deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL,
6255SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL,
6256SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD,
d1ca2c64 6257SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SYMBOL_SLOTS, SCM_SLOTS, SCM_SLOPPY_STRINGP,
a6d9e5ab
DH
6258SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
6259SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
6260SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
b24b5e13 6261SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
34f0f2b8 6262SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
fd336365 6263SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP,
30ea841d 6264SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC,
b3fcac34
DH
6265SCM_OPDIRP, SCM_VALIDATE_OPDIR, SCM_WTA, RETURN_SCM_WTA, SCM_CONST_LONG,
6266SCM_WNA, SCM_FUNC_NAME, SCM_VALIDATE_NUMBER_COPY,
61045190 6267SCM_VALIDATE_NUMBER_DEF_COPY, SCM_SLOPPY_CONSP, SCM_SLOPPY_NCONSP,
e038c042 6268SCM_SETAND_CDR, SCM_SETOR_CDR, SCM_SETAND_CAR, SCM_SETOR_CAR
b63a956d
DH
6269
6270Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
6271Use scm_memory_error instead of SCM_NALLOC.
c1aef037 6272Use SCM_STRINGP instead of SCM_SLOPPY_STRINGP.
d1ca2c64
DH
6273Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_STRINGORSUBSTR.
6274Use SCM_FREE_CELL_P instead of SCM_FREEP/SCM_NFREEP
a6d9e5ab 6275Use a type specific accessor macro instead of SCM_CHARS/SCM_UCHARS.
6c0201ad 6276Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH.
a6d9e5ab
DH
6277Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING.
6278Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
b24b5e13 6279Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
f0942910
DH
6280Use SCM_STRINGP instead of SCM_RWSTRINGP.
6281Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
34f0f2b8
DH
6282Use SCM_STRING_CHARS instead of SCM_ROCHARS.
6283Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
93778877 6284Use a type specific setter macro instead of SCM_SETLENGTH.
6a0476fd 6285Use a type specific setter macro instead of SCM_SETCHARS.
5b9eb8ae 6286Use a type specific length macro instead of SCM_LENGTH_MAX.
fd336365
DH
6287Use SCM_GCMARKP instead of SCM_GC8MARKP.
6288Use SCM_SETGCMARK instead of SCM_SETGC8MARK.
6289Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK.
6290Use SCM_TYP16 instead of SCM_GCTYP16.
6291Use SCM_CDR instead of SCM_GCCDR.
30ea841d 6292Use SCM_DIR_OPEN_P instead of SCM_OPDIRP.
276dd677
DH
6293Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of SCM_WTA.
6294Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of RETURN_SCM_WTA.
8dea8611 6295Use SCM_VCELL_INIT instead of SCM_CONST_LONG.
b3fcac34 6296Use SCM_WRONG_NUM_ARGS instead of SCM_WNA.
ced99e92
DH
6297Use SCM_CONSP instead of SCM_SLOPPY_CONSP.
6298Use !SCM_CONSP instead of SCM_SLOPPY_NCONSP.
b63a956d 6299
f7620510
DH
6300** Removed function: scm_struct_init
6301
93d40df2
DH
6302** Removed variable: scm_symhash_dim
6303
818febc0
GH
6304** Renamed function: scm_make_cont has been replaced by
6305scm_make_continuation, which has a different interface.
6306
cc4feeca
DH
6307** Deprecated function: scm_call_catching_errors
6308
6309Use scm_catch or scm_lazy_catch from throw.[ch] instead.
6310
28b06554
DH
6311** Deprecated function: scm_strhash
6312
6313Use scm_string_hash instead.
6314
1b9be268
DH
6315** Deprecated function: scm_vector_set_length_x
6316
6317Instead, create a fresh vector of the desired size and copy the contents.
6318
302f229e
MD
6319** scm_gensym has changed prototype
6320
6321scm_gensym now only takes one argument.
6322
1660782e
DH
6323** Deprecated type tags: scm_tc7_ssymbol, scm_tc7_msymbol, scm_tcs_symbols,
6324scm_tc7_lvector
28b06554
DH
6325
6326There is now only a single symbol type scm_tc7_symbol.
1660782e 6327The tag scm_tc7_lvector was not used anyway.
28b06554 6328
2f6fb7c5
KN
6329** Deprecated function: scm_make_smob_type_mfpe, scm_set_smob_mfpe.
6330
6331Use scm_make_smob_type and scm_set_smob_XXX instead.
6332
6333** New function scm_set_smob_apply.
6334
6335This can be used to set an apply function to a smob type.
6336
1f3908c4
KN
6337** Deprecated function: scm_strprint_obj
6338
6339Use scm_object_to_string instead.
6340
b3fcac34
DH
6341** Deprecated function: scm_wta
6342
6343Use scm_wrong_type_arg, or another appropriate error signalling function
6344instead.
6345
f3f9dcbc
MV
6346** Explicit support for obarrays has been deprecated.
6347
6348Use `scm_str2symbol' and the generic hashtable functions instead.
6349
6350** The concept of `vcells' has been deprecated.
6351
6352The data type `variable' is now used exclusively. `Vcells' have been
6353a low-level concept so you are likely not affected by this change.
6354
6355*** Deprecated functions: scm_sym2vcell, scm_sysintern,
6356 scm_sysintern0, scm_symbol_value0, scm_intern, scm_intern0.
6357
6358Use scm_c_define or scm_c_lookup instead, as appropriate.
6359
6360*** New functions: scm_c_module_lookup, scm_c_lookup,
6361 scm_c_module_define, scm_c_define, scm_module_lookup, scm_lookup,
6362 scm_module_define, scm_define.
6363
6364These functions work with variables instead of with vcells.
6365
311b6a3c
MV
6366** New functions for creating and defining `subr's and `gsubr's.
6367
6368The new functions more clearly distinguish between creating a subr (or
6369gsubr) object and adding it to the current module.
6370
6371These new functions are available: scm_c_make_subr, scm_c_define_subr,
6372scm_c_make_subr_with_generic, scm_c_define_subr_with_generic,
6373scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
6374scm_c_define_gsubr_with_generic.
6375
6376** Deprecated functions: scm_make_subr, scm_make_subr_opt,
6377 scm_make_subr_with_generic, scm_make_gsubr,
6378 scm_make_gsubr_with_generic.
6379
6380Use the new ones from above instead.
6381
6382** C interface to the module system has changed.
6383
6384While we suggest that you avoid as many explicit module system
6385operations from C as possible for the time being, the C interface has
6386been made more similar to the high-level Scheme module system.
6387
6388*** New functions: scm_c_define_module, scm_c_use_module,
6389 scm_c_export, scm_c_resolve_module.
6390
6391They mostly work like their Scheme namesakes. scm_c_define_module
6392takes a function that is called a context where the new module is
6393current.
6394
6395*** Deprecated functions: scm_the_root_module, scm_make_module,
6396 scm_ensure_user_module, scm_load_scheme_module.
6397
6398Use the new functions instead.
6399
6400** Renamed function: scm_internal_with_fluids becomes
6401 scm_c_with_fluids.
6402
6403scm_internal_with_fluids is available as a deprecated function.
6404
6405** New function: scm_c_with_fluid.
6406
6407Just like scm_c_with_fluids, but takes one fluid and one value instead
6408of lists of same.
6409
1be6b49c
ML
6410** Deprecated typedefs: long_long, ulong_long.
6411
6412They are of questionable utility and they pollute the global
6413namespace.
6414
1be6b49c
ML
6415** Deprecated typedef: scm_sizet
6416
6417It is of questionable utility now that Guile requires ANSI C, and is
6418oddly named.
6419
6420** Deprecated typedefs: scm_port_rw_active, scm_port,
6421 scm_ptob_descriptor, scm_debug_info, scm_debug_frame, scm_fport,
6422 scm_option, scm_rstate, scm_rng, scm_array, scm_array_dim.
6423
6424Made more compliant with the naming policy by adding a _t at the end.
6425
6426** Deprecated functions: scm_mkbig, scm_big2num, scm_adjbig,
6427 scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl
6428
373f4948 6429With the exception of the mysterious scm_2ulong2big, they are still
1be6b49c
ML
6430available under new names (scm_i_mkbig etc). These functions are not
6431intended to be used in user code. You should avoid dealing with
6432bignums directly, and should deal with numbers in general (which can
6433be bignums).
6434
147c18a0
MD
6435** Change in behavior: scm_num2long, scm_num2ulong
6436
6437The scm_num2[u]long functions don't any longer accept an inexact
6438argument. This change in behavior is motivated by concordance with
6439R5RS: It is more common that a primitive doesn't want to accept an
6440inexact for an exact.
6441
1be6b49c 6442** New functions: scm_short2num, scm_ushort2num, scm_int2num,
f3f70257
ML
6443 scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
6444 scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff,
1be6b49c
ML
6445 scm_num2size.
6446
6447These are conversion functions between the various ANSI C integral
147c18a0
MD
6448types and Scheme numbers. NOTE: The scm_num2xxx functions don't
6449accept an inexact argument.
1be6b49c 6450
5437598b
MD
6451** New functions: scm_float2num, scm_double2num,
6452 scm_num2float, scm_num2double.
6453
6454These are conversion functions between the two ANSI C float types and
6455Scheme numbers.
6456
1be6b49c 6457** New number validation macros:
f3f70257 6458 SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF]
1be6b49c
ML
6459
6460See above.
6461
fc62c86a
ML
6462** New functions: scm_gc_protect_object, scm_gc_unprotect_object
6463
6464These are just nicer-named old scm_protect_object and
6465scm_unprotect_object.
6466
6467** Deprecated functions: scm_protect_object, scm_unprotect_object
6468
6469** New functions: scm_gc_[un]register_root, scm_gc_[un]register_roots
6470
6471These functions can be used to register pointers to locations that
6472hold SCM values.
6473
5b2ad23b
ML
6474** Deprecated function: scm_create_hook.
6475
6476Its sins are: misleading name, non-modularity and lack of general
6477usefulness.
6478
c299f186 6479\f
cc36e791
JB
6480Changes since Guile 1.3.4:
6481
80f27102
JB
6482* Changes to the distribution
6483
ce358662
JB
6484** Trees from nightly snapshots and CVS now require you to run autogen.sh.
6485
6486We've changed the way we handle generated files in the Guile source
6487repository. As a result, the procedure for building trees obtained
6488from the nightly FTP snapshots or via CVS has changed:
6489- You must have appropriate versions of autoconf, automake, and
6490 libtool installed on your system. See README for info on how to
6491 obtain these programs.
6492- Before configuring the tree, you must first run the script
6493 `autogen.sh' at the top of the source tree.
6494
6495The Guile repository used to contain not only source files, written by
6496humans, but also some generated files, like configure scripts and
6497Makefile.in files. Even though the contents of these files could be
6498derived mechanically from other files present, we thought it would
6499make the tree easier to build if we checked them into CVS.
6500
6501However, this approach means that minor differences between
6502developer's installed tools and habits affected the whole team.
6503So we have removed the generated files from the repository, and
6504added the autogen.sh script, which will reconstruct them
6505appropriately.
6506
6507
dc914156
GH
6508** configure now has experimental options to remove support for certain
6509features:
52cfc69b 6510
dc914156
GH
6511--disable-arrays omit array and uniform array support
6512--disable-posix omit posix interfaces
6513--disable-networking omit networking interfaces
6514--disable-regex omit regular expression interfaces
52cfc69b
GH
6515
6516These are likely to become separate modules some day.
6517
9764c29b 6518** New configure option --enable-debug-freelist
e1b0d0ac 6519
38a15cfd
GB
6520This enables a debugging version of SCM_NEWCELL(), and also registers
6521an extra primitive, the setter `gc-set-debug-check-freelist!'.
6522
6523Configure with the --enable-debug-freelist option to enable
6524the gc-set-debug-check-freelist! primitive, and then use:
6525
6526(gc-set-debug-check-freelist! #t) # turn on checking of the freelist
6527(gc-set-debug-check-freelist! #f) # turn off checking
6528
6529Checking of the freelist forces a traversal of the freelist and
6530a garbage collection before each allocation of a cell. This can
6531slow down the interpreter dramatically, so the setter should be used to
6532turn on this extra processing only when necessary.
e1b0d0ac 6533
9764c29b
MD
6534** New configure option --enable-debug-malloc
6535
6536Include code for debugging of calls to scm_must_malloc/realloc/free.
6537
6538Checks that
6539
65401. objects freed by scm_must_free has been mallocated by scm_must_malloc
65412. objects reallocated by scm_must_realloc has been allocated by
6542 scm_must_malloc
65433. reallocated objects are reallocated with the same what string
6544
6545But, most importantly, it records the number of allocated objects of
6546each kind. This is useful when searching for memory leaks.
6547
6548A Guile compiled with this option provides the primitive
6549`malloc-stats' which returns an alist with pairs of kind and the
6550number of objects of that kind.
6551
e415cb06
MD
6552** All includes are now referenced relative to the root directory
6553
6554Since some users have had problems with mixups between Guile and
6555system headers, we have decided to always refer to Guile headers via
6556their parent directories. This essentially creates a "private name
6557space" for Guile headers. This means that the compiler only is given
6558-I options for the root build and root source directory.
6559
341f78c9
MD
6560** Header files kw.h and genio.h have been removed.
6561
6562** The module (ice-9 getopt-gnu-style) has been removed.
6563
e8855f8d
MD
6564** New module (ice-9 documentation)
6565
6566Implements the interface to documentation strings associated with
6567objects.
6568
0c0ffe09
KN
6569** New module (ice-9 time)
6570
6571Provides a macro `time', which displays execution time of a given form.
6572
cf7a5ee5
KN
6573** New module (ice-9 history)
6574
6575Loading this module enables value history in the repl.
6576
0af43c4a 6577* Changes to the stand-alone interpreter
bd9e24b3 6578
67ef2dca
MD
6579** New command line option --debug
6580
6581Start Guile with debugging evaluator and backtraces enabled.
6582
6583This is useful when debugging your .guile init file or scripts.
6584
aa4bb95d
MD
6585** New help facility
6586
341f78c9
MD
6587Usage: (help NAME) gives documentation about objects named NAME (a symbol)
6588 (help REGEXP) ditto for objects with names matching REGEXP (a string)
58e5b910 6589 (help 'NAME) gives documentation for NAME, even if it is not an object
341f78c9 6590 (help ,EXPR) gives documentation for object returned by EXPR
6c0201ad 6591 (help (my module)) gives module commentary for `(my module)'
341f78c9
MD
6592 (help) gives this text
6593
6594`help' searches among bindings exported from loaded modules, while
6595`apropos' searches among bindings visible from the "current" module.
6596
6597Examples: (help help)
6598 (help cons)
6599 (help "output-string")
aa4bb95d 6600
e8855f8d
MD
6601** `help' and `apropos' now prints full module names
6602
0af43c4a 6603** Dynamic linking now uses libltdl from the libtool package.
bd9e24b3 6604
0af43c4a
MD
6605The old system dependent code for doing dynamic linking has been
6606replaced with calls to the libltdl functions which do all the hairy
6607details for us.
bd9e24b3 6608
0af43c4a
MD
6609The major improvement is that you can now directly pass libtool
6610library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
6611will be able to do the best shared library job you can get, via
6612libltdl.
bd9e24b3 6613
0af43c4a
MD
6614The way dynamic libraries are found has changed and is not really
6615portable across platforms, probably. It is therefore recommended to
6616use absolute filenames when possible.
6617
6618If you pass a filename without an extension to `dynamic-link', it will
6619try a few appropriate ones. Thus, the most platform ignorant way is
6620to specify a name like "libfoo", without any directories and
6621extensions.
0573ddae 6622
91163914
MD
6623** Guile COOP threads are now compatible with LinuxThreads
6624
6625Previously, COOP threading wasn't possible in applications linked with
6626Linux POSIX threads due to their use of the stack pointer to find the
6627thread context. This has now been fixed with a workaround which uses
6628the pthreads to allocate the stack.
6629
6c0201ad 6630** New primitives: `pkgdata-dir', `site-dir', `library-dir'
62b82274 6631
9770d235
MD
6632** Positions of erring expression in scripts
6633
6634With version 1.3.4, the location of the erring expression in Guile
6635scipts is no longer automatically reported. (This should have been
6636documented before the 1.3.4 release.)
6637
6638You can get this information by enabling recording of positions of
6639source expressions and running the debugging evaluator. Put this at
6640the top of your script (or in your "site" file):
6641
6642 (read-enable 'positions)
6643 (debug-enable 'debug)
6644
0573ddae
MD
6645** Backtraces in scripts
6646
6647It is now possible to get backtraces in scripts.
6648
6649Put
6650
6651 (debug-enable 'debug 'backtrace)
6652
6653at the top of the script.
6654
6655(The first options enables the debugging evaluator.
6656 The second enables backtraces.)
6657
e8855f8d
MD
6658** Part of module system symbol lookup now implemented in C
6659
6660The eval closure of most modules is now implemented in C. Since this
6661was one of the bottlenecks for loading speed, Guile now loads code
6662substantially faster than before.
6663
f25f761d
GH
6664** Attempting to get the value of an unbound variable now produces
6665an exception with a key of 'unbound-variable instead of 'misc-error.
6666
1a35eadc
GH
6667** The initial default output port is now unbuffered if it's using a
6668tty device. Previously in this situation it was line-buffered.
6669
820920e6
MD
6670** New hook: after-gc-hook
6671
6672after-gc-hook takes over the role of gc-thunk. This hook is run at
6673the first SCM_TICK after a GC. (Thus, the code is run at the same
6674point during evaluation as signal handlers.)
6675
6676Note that this hook should be used only for diagnostic and debugging
6677purposes. It is not certain that it will continue to be well-defined
6678when this hook is run in the future.
6679
6680C programmers: Note the new C level hooks scm_before_gc_c_hook,
6681scm_before_sweep_c_hook, scm_after_gc_c_hook.
6682
b5074b23
MD
6683** Improvements to garbage collector
6684
6685Guile 1.4 has a new policy for triggering heap allocation and
6686determining the sizes of heap segments. It fixes a number of problems
6687in the old GC.
6688
66891. The new policy can handle two separate pools of cells
6690 (2-word/4-word) better. (The old policy would run wild, allocating
6691 more and more memory for certain programs.)
6692
66932. The old code would sometimes allocate far too much heap so that the
6694 Guile process became gigantic. The new code avoids this.
6695
66963. The old code would sometimes allocate too little so that few cells
6697 were freed at GC so that, in turn, too much time was spent in GC.
6698
66994. The old code would often trigger heap allocation several times in a
6700 row. (The new scheme predicts how large the segments needs to be
6701 in order not to need further allocation.)
6702
e8855f8d
MD
6703All in all, the new GC policy will make larger applications more
6704efficient.
6705
b5074b23
MD
6706The new GC scheme also is prepared for POSIX threading. Threads can
6707allocate private pools of cells ("clusters") with just a single
6708function call. Allocation of single cells from such a cluster can
6709then proceed without any need of inter-thread synchronization.
6710
6711** New environment variables controlling GC parameters
6712
6713GUILE_MAX_SEGMENT_SIZE Maximal segment size
6714 (default = 2097000)
6715
6716Allocation of 2-word cell heaps:
6717
6718GUILE_INIT_SEGMENT_SIZE_1 Size of initial heap segment in bytes
6719 (default = 360000)
6720
6721GUILE_MIN_YIELD_1 Minimum number of freed cells at each
6722 GC in percent of total heap size
6723 (default = 40)
6724
6725Allocation of 4-word cell heaps
6726(used for real numbers and misc other objects):
6727
6728GUILE_INIT_SEGMENT_SIZE_2, GUILE_MIN_YIELD_2
6729
6730(See entry "Way for application to customize GC parameters" under
6731 section "Changes to the scm_ interface" below.)
6732
67ef2dca
MD
6733** Guile now implements reals using 4-word cells
6734
6735This speeds up computation with reals. (They were earlier allocated
6736with `malloc'.) There is still some room for optimizations, however.
6737
6738** Some further steps toward POSIX thread support have been taken
6739
6740*** Guile's critical sections (SCM_DEFER/ALLOW_INTS)
6741don't have much effect any longer, and many of them will be removed in
6742next release.
6743
6744*** Signals
6745are only handled at the top of the evaluator loop, immediately after
6746I/O, and in scm_equalp.
6747
6748*** The GC can allocate thread private pools of pairs.
6749
0af43c4a
MD
6750* Changes to Scheme functions and syntax
6751
a0128ebe 6752** close-input-port and close-output-port are now R5RS
7c1e0b12 6753
a0128ebe 6754These procedures have been turned into primitives and have R5RS behaviour.
7c1e0b12 6755
0af43c4a
MD
6756** New procedure: simple-format PORT MESSAGE ARG1 ...
6757
6758(ice-9 boot) makes `format' an alias for `simple-format' until possibly
6759extended by the more sophisticated version in (ice-9 format)
6760
6761(simple-format port message . args)
6762Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
6763MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
6764the escapes are replaced with corresponding members of ARGS:
6765~A formats using `display' and ~S formats using `write'.
6766If DESTINATION is #t, then use the `current-output-port',
6767if DESTINATION is #f, then return a string containing the formatted text.
6768Does not add a trailing newline."
6769
6770** string-ref: the second argument is no longer optional.
6771
6772** string, list->string: no longer accept strings in their arguments,
6773only characters, for compatibility with R5RS.
6774
6775** New procedure: port-closed? PORT
6776Returns #t if PORT is closed or #f if it is open.
6777
0a9e521f
MD
6778** Deprecated: list*
6779
6780The list* functionality is now provided by cons* (SRFI-1 compliant)
6781
b5074b23
MD
6782** New procedure: cons* ARG1 ARG2 ... ARGn
6783
6784Like `list', but the last arg provides the tail of the constructed list,
6785returning (cons ARG1 (cons ARG2 (cons ... ARGn))).
6786
6787Requires at least one argument. If given one argument, that argument
6788is returned as result.
6789
6790This function is called `list*' in some other Schemes and in Common LISP.
6791
341f78c9
MD
6792** Removed deprecated: serial-map, serial-array-copy!, serial-array-map!
6793
e8855f8d
MD
6794** New procedure: object-documentation OBJECT
6795
6796Returns the documentation string associated with OBJECT. The
6797procedure uses a caching mechanism so that subsequent lookups are
6798faster.
6799
6800Exported by (ice-9 documentation).
6801
6802** module-name now returns full names of modules
6803
6804Previously, only the last part of the name was returned (`session' for
6805`(ice-9 session)'). Ex: `(ice-9 session)'.
6806
894a712b
DH
6807* Changes to the gh_ interface
6808
6809** Deprecated: gh_int2scmb
6810
6811Use gh_bool2scm instead.
6812
a2349a28
GH
6813* Changes to the scm_ interface
6814
810e1aec
MD
6815** Guile primitives now carry docstrings!
6816
6817Thanks to Greg Badros!
6818
0a9e521f 6819** Guile primitives are defined in a new way: SCM_DEFINE/SCM_DEFINE1/SCM_PROC
0af43c4a 6820
0a9e521f
MD
6821Now Guile primitives are defined using the SCM_DEFINE/SCM_DEFINE1/SCM_PROC
6822macros and must contain a docstring that is extracted into foo.doc using a new
0af43c4a
MD
6823guile-doc-snarf script (that uses guile-doc-snarf.awk).
6824
0a9e521f
MD
6825However, a major overhaul of these macros is scheduled for the next release of
6826guile.
6827
0af43c4a
MD
6828** Guile primitives use a new technique for validation of arguments
6829
6830SCM_VALIDATE_* macros are defined to ease the redundancy and improve
6831the readability of argument checking.
6832
6833** All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
6834
894a712b 6835** New macros: SCM_PACK, SCM_UNPACK
f8a72ca4
MD
6836
6837Compose/decompose an SCM value.
6838
894a712b
DH
6839The SCM type is now treated as an abstract data type and may be defined as a
6840long, a void* or as a struct, depending on the architecture and compile time
6841options. This makes it easier to find several types of bugs, for example when
6842SCM values are treated as integers without conversion. Values of the SCM type
6843should be treated as "atomic" values. These macros are used when
f8a72ca4
MD
6844composing/decomposing an SCM value, either because you want to access
6845individual bits, or because you want to treat it as an integer value.
6846
6847E.g., in order to set bit 7 in an SCM value x, use the expression
6848
6849 SCM_PACK (SCM_UNPACK (x) | 0x80)
6850
e11f8b42
DH
6851** The name property of hooks is deprecated.
6852Thus, the use of SCM_HOOK_NAME and scm_make_hook_with_name is deprecated.
6853
6854You can emulate this feature by using object properties.
6855
6c0201ad 6856** Deprecated macros: SCM_INPORTP, SCM_OUTPORTP, SCM_CRDY, SCM_ICHRP,
894a712b
DH
6857SCM_ICHR, SCM_MAKICHR, SCM_SETJMPBUF, SCM_NSTRINGP, SCM_NRWSTRINGP,
6858SCM_NVECTORP
f8a72ca4 6859
894a712b 6860These macros will be removed in a future release of Guile.
7c1e0b12 6861
6c0201ad 6862** The following types, functions and macros from numbers.h are deprecated:
0a9e521f
MD
6863scm_dblproc, SCM_UNEGFIXABLE, SCM_FLOBUFLEN, SCM_INEXP, SCM_CPLXP, SCM_REAL,
6864SCM_IMAG, SCM_REALPART, scm_makdbl, SCM_SINGP, SCM_NUM2DBL, SCM_NO_BIGDIG
6865
a2349a28
GH
6866** Port internals: the rw_random variable in the scm_port structure
6867must be set to non-zero in any random access port. In recent Guile
6868releases it was only set for bidirectional random-access ports.
6869
7dcb364d
GH
6870** Port internals: the seek ptob procedure is now responsible for
6871resetting the buffers if required. The change was made so that in the
6872special case of reading the current position (i.e., seek p 0 SEEK_CUR)
6873the fport and strport ptobs can avoid resetting the buffers,
6874in particular to avoid discarding unread chars. An existing port
6875type can be fixed by adding something like the following to the
6876beginning of the ptob seek procedure:
6877
6878 if (pt->rw_active == SCM_PORT_READ)
6879 scm_end_input (object);
6880 else if (pt->rw_active == SCM_PORT_WRITE)
6881 ptob->flush (object);
6882
6883although to actually avoid resetting the buffers and discard unread
6884chars requires further hacking that depends on the characteristics
6885of the ptob.
6886
894a712b
DH
6887** Deprecated functions: scm_fseek, scm_tag
6888
6889These functions are no longer used and will be removed in a future version.
6890
f25f761d
GH
6891** The scm_sysmissing procedure is no longer used in libguile.
6892Unless it turns out to be unexpectedly useful to somebody, it will be
6893removed in a future version.
6894
0af43c4a
MD
6895** The format of error message strings has changed
6896
6897The two C procedures: scm_display_error and scm_error, as well as the
6898primitive `scm-error', now use scm_simple_format to do their work.
6899This means that the message strings of all code must be updated to use
6900~A where %s was used before, and ~S where %S was used before.
6901
6902During the period when there still are a lot of old Guiles out there,
6903you might want to support both old and new versions of Guile.
6904
6905There are basically two methods to achieve this. Both methods use
6906autoconf. Put
6907
6908 AC_CHECK_FUNCS(scm_simple_format)
6909
6910in your configure.in.
6911
6912Method 1: Use the string concatenation features of ANSI C's
6913 preprocessor.
6914
6915In C:
6916
6917#ifdef HAVE_SCM_SIMPLE_FORMAT
6918#define FMT_S "~S"
6919#else
6920#define FMT_S "%S"
6921#endif
6922
6923Then represent each of your error messages using a preprocessor macro:
6924
6925#define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!"
6926
6927In Scheme:
6928
6929(define fmt-s (if (defined? 'simple-format) "~S" "%S"))
6930(define make-message string-append)
6931
6932(define e-spider-error (make-message "There's a spider in your " fmt-s "!!!"))
6933
6934Method 2: Use the oldfmt function found in doc/oldfmt.c.
6935
6936In C:
6937
6938scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"),
6939 ...);
6940
6941In Scheme:
6942
6943(scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!")
6944 ...)
6945
6946
f3b5e185
MD
6947** Deprecated: coop_mutex_init, coop_condition_variable_init
6948
6949Don't use the functions coop_mutex_init and
6950coop_condition_variable_init. They will change.
6951
6952Use scm_mutex_init and scm_cond_init instead.
6953
f3b5e185
MD
6954** New function: int scm_cond_timedwait (scm_cond_t *COND, scm_mutex_t *MUTEX, const struct timespec *ABSTIME)
6955 `scm_cond_timedwait' atomically unlocks MUTEX and waits on
6956 COND, as `scm_cond_wait' does, but it also bounds the duration
6957 of the wait. If COND has not been signaled before time ABSTIME,
6958 the mutex MUTEX is re-acquired and `scm_cond_timedwait'
6959 returns the error code `ETIMEDOUT'.
6960
6961 The ABSTIME parameter specifies an absolute time, with the same
6962 origin as `time' and `gettimeofday': an ABSTIME of 0 corresponds
6963 to 00:00:00 GMT, January 1, 1970.
6964
6965** New function: scm_cond_broadcast (scm_cond_t *COND)
6966 `scm_cond_broadcast' restarts all the threads that are waiting
6967 on the condition variable COND. Nothing happens if no threads are
6968 waiting on COND.
6969
6970** New function: scm_key_create (scm_key_t *KEY, void (*destr_function) (void *))
6971 `scm_key_create' allocates a new TSD key. The key is stored in
6972 the location pointed to by KEY. There is no limit on the number
6973 of keys allocated at a given time. The value initially associated
6974 with the returned key is `NULL' in all currently executing threads.
6975
6976 The DESTR_FUNCTION argument, if not `NULL', specifies a destructor
6977 function associated with the key. When a thread terminates,
6978 DESTR_FUNCTION is called on the value associated with the key in
6979 that thread. The DESTR_FUNCTION is not called if a key is deleted
6980 with `scm_key_delete' or a value is changed with
6981 `scm_setspecific'. The order in which destructor functions are
6982 called at thread termination time is unspecified.
6983
6984 Destructors are not yet implemented.
6985
6986** New function: scm_setspecific (scm_key_t KEY, const void *POINTER)
6987 `scm_setspecific' changes the value associated with KEY in the
6988 calling thread, storing the given POINTER instead.
6989
6990** New function: scm_getspecific (scm_key_t KEY)
6991 `scm_getspecific' returns the value currently associated with
6992 KEY in the calling thread.
6993
6994** New function: scm_key_delete (scm_key_t KEY)
6995 `scm_key_delete' deallocates a TSD key. It does not check
6996 whether non-`NULL' values are associated with that key in the
6997 currently executing threads, nor call the destructor function
6998 associated with the key.
6999
820920e6
MD
7000** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE)
7001
7002Initialize a C level hook HOOK with associated HOOK_DATA and type
7003TYPE. (See scm_c_hook_run ().)
7004
7005** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP)
7006
7007Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP
7008is true, add it last, otherwise first. The same FUNC can be added
7009multiple times if FUNC_DATA differ and vice versa.
7010
7011** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA)
7012
7013Remove hook function FUNC with associated FUNC_DATA from HOOK. A
7014function is only removed if both FUNC and FUNC_DATA matches.
7015
7016** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA)
7017
7018Run hook HOOK passing DATA to the hook functions.
7019
7020If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value
7021returned is undefined.
7022
7023If TYPE is SCM_C_HOOK_OR, hook functions are run until a function
7024returns a non-NULL value. This value is returned as the result of
7025scm_c_hook_run. If all functions return NULL, NULL is returned.
7026
7027If TYPE is SCM_C_HOOK_AND, hook functions are run until a function
7028returns a NULL value, and NULL is returned. If all functions returns
7029a non-NULL value, the last value is returned.
7030
7031** New C level GC hooks
7032
7033Five new C level hooks has been added to the garbage collector.
7034
7035 scm_before_gc_c_hook
7036 scm_after_gc_c_hook
7037
7038are run before locking and after unlocking the heap. The system is
7039thus in a mode where evaluation can take place. (Except that
7040scm_before_gc_c_hook must not allocate new cells.)
7041
7042 scm_before_mark_c_hook
7043 scm_before_sweep_c_hook
7044 scm_after_sweep_c_hook
7045
7046are run when the heap is locked. These are intended for extension of
7047the GC in a modular fashion. Examples are the weaks and guardians
7048modules.
7049
b5074b23
MD
7050** Way for application to customize GC parameters
7051
7052The application can set up other default values for the GC heap
7053allocation parameters
7054
7055 GUILE_INIT_HEAP_SIZE_1, GUILE_MIN_YIELD_1,
7056 GUILE_INIT_HEAP_SIZE_2, GUILE_MIN_YIELD_2,
7057 GUILE_MAX_SEGMENT_SIZE,
7058
7059by setting
7060
7061 scm_default_init_heap_size_1, scm_default_min_yield_1,
7062 scm_default_init_heap_size_2, scm_default_min_yield_2,
7063 scm_default_max_segment_size
7064
7065respectively before callong scm_boot_guile.
7066
7067(See entry "New environment variables ..." in section
7068"Changes to the stand-alone interpreter" above.)
7069
9704841c
MD
7070** scm_protect_object/scm_unprotect_object now nest
7071
67ef2dca
MD
7072This means that you can call scm_protect_object multiple times on an
7073object and count on the object being protected until
7074scm_unprotect_object has been call the same number of times.
7075
7076The functions also have better time complexity.
7077
7078Still, it is usually possible to structure the application in a way
7079that you don't need to use these functions. For example, if you use a
7080protected standard Guile list to keep track of live objects rather
7081than some custom data type, objects will die a natural death when they
7082are no longer needed.
7083
0a9e521f
MD
7084** Deprecated type tags: scm_tc16_flo, scm_tc_flo, scm_tc_dblr, scm_tc_dblc
7085
7086Guile does not provide the float representation for inexact real numbers any
7087more. Now, only doubles are used to represent inexact real numbers. Further,
7088the tag names scm_tc_dblr and scm_tc_dblc have been changed to scm_tc16_real
7089and scm_tc16_complex, respectively.
7090
341f78c9
MD
7091** Removed deprecated type scm_smobfuns
7092
7093** Removed deprecated function scm_newsmob
7094
b5074b23
MD
7095** Warning: scm_make_smob_type_mfpe might become deprecated in a future release
7096
7097There is an ongoing discussion among the developers whether to
7098deprecate `scm_make_smob_type_mfpe' or not. Please use the current
7099standard interface (scm_make_smob_type, scm_set_smob_XXX) in new code
7100until this issue has been settled.
7101
341f78c9
MD
7102** Removed deprecated type tag scm_tc16_kw
7103
2728d7f4
MD
7104** Added type tag scm_tc16_keyword
7105
7106(This was introduced already in release 1.3.4 but was not documented
7107 until now.)
7108
67ef2dca
MD
7109** gdb_print now prints "*** Guile not initialized ***" until Guile initialized
7110
f25f761d
GH
7111* Changes to system call interfaces:
7112
28d77376
GH
7113** The "select" procedure now tests port buffers for the ability to
7114provide input or accept output. Previously only the underlying file
7115descriptors were checked.
7116
bd9e24b3
GH
7117** New variable PIPE_BUF: the maximum number of bytes that can be
7118atomically written to a pipe.
7119
f25f761d
GH
7120** If a facility is not available on the system when Guile is
7121compiled, the corresponding primitive procedure will not be defined.
7122Previously it would have been defined but would throw a system-error
7123exception if called. Exception handlers which catch this case may
7124need minor modification: an error will be thrown with key
7125'unbound-variable instead of 'system-error. Alternatively it's
7126now possible to use `defined?' to check whether the facility is
7127available.
7128
38c1d3c4 7129** Procedures which depend on the timezone should now give the correct
6c0201ad 7130result on systems which cache the TZ environment variable, even if TZ
38c1d3c4
GH
7131is changed without calling tzset.
7132
5c11cc9d
GH
7133* Changes to the networking interfaces:
7134
7135** New functions: htons, ntohs, htonl, ntohl: for converting short and
7136long integers between network and host format. For now, it's not
7137particularly convenient to do this kind of thing, but consider:
7138
7139(define write-network-long
7140 (lambda (value port)
7141 (let ((v (make-uniform-vector 1 1 0)))
7142 (uniform-vector-set! v 0 (htonl value))
7143 (uniform-vector-write v port))))
7144
7145(define read-network-long
7146 (lambda (port)
7147 (let ((v (make-uniform-vector 1 1 0)))
7148 (uniform-vector-read! v port)
7149 (ntohl (uniform-vector-ref v 0)))))
7150
7151** If inet-aton fails, it now throws an error with key 'misc-error
7152instead of 'system-error, since errno is not relevant.
7153
7154** Certain gethostbyname/gethostbyaddr failures now throw errors with
7155specific keys instead of 'system-error. The latter is inappropriate
7156since errno will not have been set. The keys are:
afe5177e 7157'host-not-found, 'try-again, 'no-recovery and 'no-data.
5c11cc9d
GH
7158
7159** sethostent, setnetent, setprotoent, setservent: now take an
7160optional argument STAYOPEN, which specifies whether the database
7161remains open after a database entry is accessed randomly (e.g., using
7162gethostbyname for the hosts database.) The default is #f. Previously
7163#t was always used.
7164
cc36e791 7165\f
43fa9a05
JB
7166Changes since Guile 1.3.2:
7167
0fdcbcaa
MD
7168* Changes to the stand-alone interpreter
7169
7170** Debugger
7171
7172An initial version of the Guile debugger written by Chris Hanson has
7173been added. The debugger is still under development but is included
7174in the distribution anyway since it is already quite useful.
7175
7176Type
7177
7178 (debug)
7179
7180after an error to enter the debugger. Type `help' inside the debugger
7181for a description of available commands.
7182
7183If you prefer to have stack frames numbered and printed in
7184anti-chronological order and prefer up in the stack to be down on the
7185screen as is the case in gdb, you can put
7186
7187 (debug-enable 'backwards)
7188
7189in your .guile startup file. (However, this means that Guile can't
7190use indentation to indicate stack level.)
7191
7192The debugger is autoloaded into Guile at the first use.
7193
7194** Further enhancements to backtraces
7195
7196There is a new debug option `width' which controls the maximum width
7197on the screen of printed stack frames. Fancy printing parameters
7198("level" and "length" as in Common LISP) are adaptively adjusted for
7199each stack frame to give maximum information while still fitting
7200within the bounds. If the stack frame can't be made to fit by
7201adjusting parameters, it is simply cut off at the end. This is marked
7202with a `$'.
7203
7204** Some modules are now only loaded when the repl is started
7205
7206The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
7207regex) are now loaded into (guile-user) only if the repl has been
7208started. The effect is that the startup time for scripts has been
7209reduced to 30% of what it was previously.
7210
7211Correctly written scripts load the modules they require at the top of
7212the file and should not be affected by this change.
7213
ece41168
MD
7214** Hooks are now represented as smobs
7215
6822fe53
MD
7216* Changes to Scheme functions and syntax
7217
0ce204b0
MV
7218** Readline support has changed again.
7219
7220The old (readline-activator) module is gone. Use (ice-9 readline)
7221instead, which now contains all readline functionality. So the code
7222to activate readline is now
7223
7224 (use-modules (ice-9 readline))
7225 (activate-readline)
7226
7227This should work at any time, including from the guile prompt.
7228
5d195868
JB
7229To avoid confusion about the terms of Guile's license, please only
7230enable readline for your personal use; please don't make it the
7231default for others. Here is why we make this rather odd-sounding
7232request:
7233
7234Guile is normally licensed under a weakened form of the GNU General
7235Public License, which allows you to link code with Guile without
7236placing that code under the GPL. This exception is important to some
7237people.
7238
7239However, since readline is distributed under the GNU General Public
7240License, when you link Guile with readline, either statically or
7241dynamically, you effectively change Guile's license to the strict GPL.
7242Whenever you link any strictly GPL'd code into Guile, uses of Guile
7243which are normally permitted become forbidden. This is a rather
7244non-obvious consequence of the licensing terms.
7245
7246So, to make sure things remain clear, please let people choose for
7247themselves whether to link GPL'd libraries like readline with Guile.
7248
25b0654e
JB
7249** regexp-substitute/global has changed slightly, but incompatibly.
7250
7251If you include a function in the item list, the string of the match
7252object it receives is the same string passed to
7253regexp-substitute/global, not some suffix of that string.
7254Correspondingly, the match's positions are relative to the entire
7255string, not the suffix.
7256
7257If the regexp can match the empty string, the way matches are chosen
7258from the string has changed. regexp-substitute/global recognizes the
7259same set of matches that list-matches does; see below.
7260
7261** New function: list-matches REGEXP STRING [FLAGS]
7262
7263Return a list of match objects, one for every non-overlapping, maximal
7264match of REGEXP in STRING. The matches appear in left-to-right order.
7265list-matches only reports matches of the empty string if there are no
7266other matches which begin on, end at, or include the empty match's
7267position.
7268
7269If present, FLAGS is passed as the FLAGS argument to regexp-exec.
7270
7271** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
7272
7273For each match of REGEXP in STRING, apply PROC to the match object,
7274and the last value PROC returned, or INIT for the first call. Return
7275the last value returned by PROC. We apply PROC to the matches as they
7276appear from left to right.
7277
7278This function recognizes matches according to the same criteria as
7279list-matches.
7280
7281Thus, you could define list-matches like this:
7282
7283 (define (list-matches regexp string . flags)
7284 (reverse! (apply fold-matches regexp string '() cons flags)))
7285
7286If present, FLAGS is passed as the FLAGS argument to regexp-exec.
7287
bc848f7f
MD
7288** Hooks
7289
7290*** New function: hook? OBJ
7291
7292Return #t if OBJ is a hook, otherwise #f.
7293
ece41168
MD
7294*** New function: make-hook-with-name NAME [ARITY]
7295
7296Return a hook with name NAME and arity ARITY. The default value for
7297ARITY is 0. The only effect of NAME is that it will appear when the
7298hook object is printed to ease debugging.
7299
bc848f7f
MD
7300*** New function: hook-empty? HOOK
7301
7302Return #t if HOOK doesn't contain any procedures, otherwise #f.
7303
7304*** New function: hook->list HOOK
7305
7306Return a list of the procedures that are called when run-hook is
7307applied to HOOK.
7308
b074884f
JB
7309** `map' signals an error if its argument lists are not all the same length.
7310
7311This is the behavior required by R5RS, so this change is really a bug
7312fix. But it seems to affect a lot of people's code, so we're
7313mentioning it here anyway.
7314
6822fe53
MD
7315** Print-state handling has been made more transparent
7316
7317Under certain circumstances, ports are represented as a port with an
7318associated print state. Earlier, this pair was represented as a pair
7319(see "Some magic has been added to the printer" below). It is now
7320indistinguishable (almost; see `get-print-state') from a port on the
7321user level.
7322
7323*** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
7324
7325Return a new port with the associated print state PRINT-STATE.
7326
7327*** New function: get-print-state OUTPUT-PORT
7328
7329Return the print state associated with this port if it exists,
7330otherwise return #f.
7331
340a8770 7332*** New function: directory-stream? OBJECT
77242ff9 7333
340a8770 7334Returns true iff OBJECT is a directory stream --- the sort of object
77242ff9
GH
7335returned by `opendir'.
7336
0fdcbcaa
MD
7337** New function: using-readline?
7338
7339Return #t if readline is in use in the current repl.
7340
26405bc1
MD
7341** structs will be removed in 1.4
7342
7343Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
7344and use GOOPS objects as the fundamental record type.
7345
49199eaa
MD
7346* Changes to the scm_ interface
7347
26405bc1
MD
7348** structs will be removed in 1.4
7349
7350The entire current struct interface (struct.c, struct.h) will be
7351replaced in Guile 1.4. We will merge GOOPS into libguile and use
7352GOOPS objects as the fundamental record type.
7353
49199eaa
MD
7354** The internal representation of subr's has changed
7355
7356Instead of giving a hint to the subr name, the CAR field of the subr
7357now contains an index to a subr entry in scm_subr_table.
7358
7359*** New variable: scm_subr_table
7360
7361An array of subr entries. A subr entry contains the name, properties
7362and documentation associated with the subr. The properties and
7363documentation slots are not yet used.
7364
7365** A new scheme for "forwarding" calls to a builtin to a generic function
7366
7367It is now possible to extend the functionality of some Guile
7368primitives by letting them defer a call to a GOOPS generic function on
240ed66f 7369argument mismatch. This means that there is no loss of efficiency in
daf516d6 7370normal evaluation.
49199eaa
MD
7371
7372Example:
7373
daf516d6 7374 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
49199eaa
MD
7375 (define-method + ((x <string>) (y <string>))
7376 (string-append x y))
7377
86a4d62e
MD
7378+ will still be as efficient as usual in numerical calculations, but
7379can also be used for concatenating strings.
49199eaa 7380
86a4d62e 7381Who will be the first one to extend Guile's numerical tower to
daf516d6
MD
7382rationals? :) [OK, there a few other things to fix before this can
7383be made in a clean way.]
49199eaa
MD
7384
7385*** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
7386
7387 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
7388
7389 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
7390
d02cafe7 7391These do the same job as SCM_PROC and SCM_PROC1, but they also define
49199eaa
MD
7392a variable GENERIC which can be used by the dispatch macros below.
7393
7394[This is experimental code which may change soon.]
7395
7396*** New macros for forwarding control to a generic on arg type error
7397
7398 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
7399
7400 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
7401
7402These correspond to the scm_wta function call, and have the same
7403behaviour until the user has called the GOOPS primitive
7404`enable-primitive-generic!'. After that, these macros will apply the
7405generic function GENERIC to the argument(s) instead of calling
7406scm_wta.
7407
7408[This is experimental code which may change soon.]
7409
7410*** New macros for argument testing with generic dispatch
7411
7412 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
7413
7414 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
7415
7416These correspond to the SCM_ASSERT macro, but will defer control to
7417GENERIC on error after `enable-primitive-generic!' has been called.
7418
7419[This is experimental code which may change soon.]
7420
7421** New function: SCM scm_eval_body (SCM body, SCM env)
7422
7423Evaluates the body of a special form.
7424
7425** The internal representation of struct's has changed
7426
7427Previously, four slots were allocated for the procedure(s) of entities
7428and operators. The motivation for this representation had to do with
7429the structure of the evaluator, the wish to support tail-recursive
7430generic functions, and efficiency. Since the generic function
7431dispatch mechanism has changed, there is no longer a need for such an
7432expensive representation, and the representation has been simplified.
7433
7434This should not make any difference for most users.
7435
7436** GOOPS support has been cleaned up.
7437
7438Some code has been moved from eval.c to objects.c and code in both of
7439these compilation units has been cleaned up and better structured.
7440
7441*** New functions for applying generic functions
7442
7443 New function: SCM scm_apply_generic (GENERIC, ARGS)
7444 New function: SCM scm_call_generic_0 (GENERIC)
7445 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
7446 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
7447 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
7448
ece41168
MD
7449** Deprecated function: scm_make_named_hook
7450
7451It is now replaced by:
7452
7453** New function: SCM scm_create_hook (const char *name, int arity)
7454
7455Creates a hook in the same way as make-hook above but also
7456binds a variable named NAME to it.
7457
7458This is the typical way of creating a hook from C code.
7459
7460Currently, the variable is created in the "current" module.
7461This might change when we get the new module system.
7462
7463[The behaviour is identical to scm_make_named_hook.]
7464
7465
43fa9a05 7466\f
f3227c7a
JB
7467Changes since Guile 1.3:
7468
6ca345f3
JB
7469* Changes to mailing lists
7470
7471** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
7472
7473See the README file to find current addresses for all the Guile
7474mailing lists.
7475
d77fb593
JB
7476* Changes to the distribution
7477
1d335863
JB
7478** Readline support is no longer included with Guile by default.
7479
7480Based on the different license terms of Guile and Readline, we
7481concluded that Guile should not *by default* cause the linking of
7482Readline into an application program. Readline support is now offered
7483as a separate module, which is linked into an application only when
7484you explicitly specify it.
7485
7486Although Guile is GNU software, its distribution terms add a special
7487exception to the usual GNU General Public License (GPL). Guile's
7488license includes a clause that allows you to link Guile with non-free
7489programs. We add this exception so as not to put Guile at a
7490disadvantage vis-a-vis other extensibility packages that support other
7491languages.
7492
7493In contrast, the GNU Readline library is distributed under the GNU
7494General Public License pure and simple. This means that you may not
7495link Readline, even dynamically, into an application unless it is
7496distributed under a free software license that is compatible the GPL.
7497
7498Because of this difference in distribution terms, an application that
7499can use Guile may not be able to use Readline. Now users will be
7500explicitly offered two independent decisions about the use of these
7501two packages.
d77fb593 7502
0e8a8468
MV
7503You can activate the readline support by issuing
7504
7505 (use-modules (readline-activator))
7506 (activate-readline)
7507
7508from your ".guile" file, for example.
7509
e4eae9b1
MD
7510* Changes to the stand-alone interpreter
7511
67ad463a
MD
7512** All builtins now print as primitives.
7513Previously builtin procedures not belonging to the fundamental subr
7514types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
7515Now, they print as #<primitive-procedure NAME>.
7516
7517** Backtraces slightly more intelligible.
7518gsubr-apply and macro transformer application frames no longer appear
7519in backtraces.
7520
69c6acbb
JB
7521* Changes to Scheme functions and syntax
7522
2a52b429
MD
7523** Guile now correctly handles internal defines by rewriting them into
7524their equivalent letrec. Previously, internal defines would
7525incrementally add to the innermost environment, without checking
7526whether the restrictions specified in RnRS were met. This lead to the
7527correct behaviour when these restriction actually were met, but didn't
7528catch all illegal uses. Such an illegal use could lead to crashes of
b3da54d1 7529the Guile interpreter or other unwanted results. An example of
2a52b429
MD
7530incorrect internal defines that made Guile behave erratically:
7531
7532 (let ()
7533 (define a 1)
7534 (define (b) a)
7535 (define c (1+ (b)))
7536 (define d 3)
7537
7538 (b))
7539
7540 => 2
7541
7542The problem with this example is that the definition of `c' uses the
7543value of `b' directly. This confuses the meoization machine of Guile
7544so that the second call of `b' (this time in a larger environment that
7545also contains bindings for `c' and `d') refers to the binding of `c'
7546instead of `a'. You could also make Guile crash with a variation on
7547this theme:
7548
7549 (define (foo flag)
7550 (define a 1)
7551 (define (b flag) (if flag a 1))
7552 (define c (1+ (b flag)))
7553 (define d 3)
7554
7555 (b #t))
7556
7557 (foo #f)
7558 (foo #t)
7559
7560From now on, Guile will issue an `Unbound variable: b' error message
7561for both examples.
7562
36d3d540
MD
7563** Hooks
7564
7565A hook contains a list of functions which should be called on
7566particular occasions in an existing program. Hooks are used for
7567customization.
7568
7569A window manager might have a hook before-window-map-hook. The window
7570manager uses the function run-hooks to call all functions stored in
7571before-window-map-hook each time a window is mapped. The user can
7572store functions in the hook using add-hook!.
7573
7574In Guile, hooks are first class objects.
7575
7576*** New function: make-hook [N_ARGS]
7577
7578Return a hook for hook functions which can take N_ARGS arguments.
7579The default value for N_ARGS is 0.
7580
ad91d6c3
MD
7581(See also scm_make_named_hook below.)
7582
36d3d540
MD
7583*** New function: add-hook! HOOK PROC [APPEND_P]
7584
7585Put PROC at the beginning of the list of functions stored in HOOK.
7586If APPEND_P is supplied, and non-false, put PROC at the end instead.
7587
7588PROC must be able to take the number of arguments specified when the
7589hook was created.
7590
7591If PROC already exists in HOOK, then remove it first.
7592
7593*** New function: remove-hook! HOOK PROC
7594
7595Remove PROC from the list of functions in HOOK.
7596
7597*** New function: reset-hook! HOOK
7598
7599Clear the list of hook functions stored in HOOK.
7600
7601*** New function: run-hook HOOK ARG1 ...
7602
7603Run all hook functions stored in HOOK with arguments ARG1 ... .
7604The number of arguments supplied must correspond to the number given
7605when the hook was created.
7606
56a19408
MV
7607** The function `dynamic-link' now takes optional keyword arguments.
7608 The only keyword argument that is currently defined is `:global
7609 BOOL'. With it, you can control whether the shared library will be
7610 linked in global mode or not. In global mode, the symbols from the
7611 linked library can be used to resolve references from other
7612 dynamically linked libraries. In non-global mode, the linked
7613 library is essentially invisible and can only be accessed via
7614 `dynamic-func', etc. The default is now to link in global mode.
7615 Previously, the default has been non-global mode.
7616
7617 The `#:global' keyword is only effective on platforms that support
7618 the dlopen family of functions.
7619
ad226f25 7620** New function `provided?'
b7e13f65
JB
7621
7622 - Function: provided? FEATURE
7623 Return true iff FEATURE is supported by this installation of
7624 Guile. FEATURE must be a symbol naming a feature; the global
7625 variable `*features*' is a list of available features.
7626
ad226f25
JB
7627** Changes to the module (ice-9 expect):
7628
7629*** The expect-strings macro now matches `$' in a regular expression
7630 only at a line-break or end-of-file by default. Previously it would
ab711359
JB
7631 match the end of the string accumulated so far. The old behaviour
7632 can be obtained by setting the variable `expect-strings-exec-flags'
7633 to 0.
ad226f25
JB
7634
7635*** The expect-strings macro now uses a variable `expect-strings-exec-flags'
7636 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
7637 in a regular expression will still match before a line-break or
7638 end-of-file. The default is `regexp/noteol'.
7639
6c0201ad 7640*** The expect-strings macro now uses a variable
ad226f25
JB
7641 `expect-strings-compile-flags' for the flags to be supplied to
7642 `make-regexp'. The default is `regexp/newline', which was previously
7643 hard-coded.
7644
7645*** The expect macro now supplies two arguments to a match procedure:
ab711359
JB
7646 the current accumulated string and a flag to indicate whether
7647 end-of-file has been reached. Previously only the string was supplied.
7648 If end-of-file is reached, the match procedure will be called an
7649 additional time with the same accumulated string as the previous call
7650 but with the flag set.
ad226f25 7651
b7e13f65
JB
7652** New module (ice-9 format), implementing the Common Lisp `format' function.
7653
7654This code, and the documentation for it that appears here, was
7655borrowed from SLIB, with minor adaptations for Guile.
7656
7657 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
7658 An almost complete implementation of Common LISP format description
7659 according to the CL reference book `Common LISP' from Guy L.
7660 Steele, Digital Press. Backward compatible to most of the
7661 available Scheme format implementations.
7662
7663 Returns `#t', `#f' or a string; has side effect of printing
7664 according to FORMAT-STRING. If DESTINATION is `#t', the output is
7665 to the current output port and `#t' is returned. If DESTINATION
7666 is `#f', a formatted string is returned as the result of the call.
7667 NEW: If DESTINATION is a string, DESTINATION is regarded as the
7668 format string; FORMAT-STRING is then the first argument and the
7669 output is returned as a string. If DESTINATION is a number, the
7670 output is to the current error port if available by the
7671 implementation. Otherwise DESTINATION must be an output port and
7672 `#t' is returned.
7673
7674 FORMAT-STRING must be a string. In case of a formatting error
7675 format returns `#f' and prints a message on the current output or
7676 error port. Characters are output as if the string were output by
7677 the `display' function with the exception of those prefixed by a
7678 tilde (~). For a detailed description of the FORMAT-STRING syntax
7679 please consult a Common LISP format reference manual. For a test
7680 suite to verify this format implementation load `formatst.scm'.
7681 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
7682
7683 Note: `format' is not reentrant, i.e. only one `format'-call may
7684 be executed at a time.
7685
7686
7687*** Format Specification (Format version 3.0)
7688
7689 Please consult a Common LISP format reference manual for a detailed
7690description of the format string syntax. For a demonstration of the
7691implemented directives see `formatst.scm'.
7692
7693 This implementation supports directive parameters and modifiers (`:'
7694and `@' characters). Multiple parameters must be separated by a comma
7695(`,'). Parameters can be numerical parameters (positive or negative),
7696character parameters (prefixed by a quote character (`''), variable
7697parameters (`v'), number of rest arguments parameter (`#'), empty and
7698default parameters. Directive characters are case independent. The
7699general form of a directive is:
7700
7701DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
7702
7703DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
7704
7705*** Implemented CL Format Control Directives
7706
7707 Documentation syntax: Uppercase characters represent the
7708corresponding control directive characters. Lowercase characters
7709represent control directive parameter descriptions.
7710
7711`~A'
7712 Any (print as `display' does).
7713 `~@A'
7714 left pad.
7715
7716 `~MINCOL,COLINC,MINPAD,PADCHARA'
7717 full padding.
7718
7719`~S'
7720 S-expression (print as `write' does).
7721 `~@S'
7722 left pad.
7723
7724 `~MINCOL,COLINC,MINPAD,PADCHARS'
7725 full padding.
7726
7727`~D'
7728 Decimal.
7729 `~@D'
7730 print number sign always.
7731
7732 `~:D'
7733 print comma separated.
7734
7735 `~MINCOL,PADCHAR,COMMACHARD'
7736 padding.
7737
7738`~X'
7739 Hexadecimal.
7740 `~@X'
7741 print number sign always.
7742
7743 `~:X'
7744 print comma separated.
7745
7746 `~MINCOL,PADCHAR,COMMACHARX'
7747 padding.
7748
7749`~O'
7750 Octal.
7751 `~@O'
7752 print number sign always.
7753
7754 `~:O'
7755 print comma separated.
7756
7757 `~MINCOL,PADCHAR,COMMACHARO'
7758 padding.
7759
7760`~B'
7761 Binary.
7762 `~@B'
7763 print number sign always.
7764
7765 `~:B'
7766 print comma separated.
7767
7768 `~MINCOL,PADCHAR,COMMACHARB'
7769 padding.
7770
7771`~NR'
7772 Radix N.
7773 `~N,MINCOL,PADCHAR,COMMACHARR'
7774 padding.
7775
7776`~@R'
7777 print a number as a Roman numeral.
7778
7779`~:@R'
7780 print a number as an "old fashioned" Roman numeral.
7781
7782`~:R'
7783 print a number as an ordinal English number.
7784
7785`~:@R'
7786 print a number as a cardinal English number.
7787
7788`~P'
7789 Plural.
7790 `~@P'
7791 prints `y' and `ies'.
7792
7793 `~:P'
7794 as `~P but jumps 1 argument backward.'
7795
7796 `~:@P'
7797 as `~@P but jumps 1 argument backward.'
7798
7799`~C'
7800 Character.
7801 `~@C'
7802 prints a character as the reader can understand it (i.e. `#\'
7803 prefixing).
7804
7805 `~:C'
7806 prints a character as emacs does (eg. `^C' for ASCII 03).
7807
7808`~F'
7809 Fixed-format floating-point (prints a flonum like MMM.NNN).
7810 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
7811 `~@F'
7812 If the number is positive a plus sign is printed.
7813
7814`~E'
7815 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
7816 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
7817 `~@E'
7818 If the number is positive a plus sign is printed.
7819
7820`~G'
7821 General floating-point (prints a flonum either fixed or
7822 exponential).
7823 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
7824 `~@G'
7825 If the number is positive a plus sign is printed.
7826
7827`~$'
7828 Dollars floating-point (prints a flonum in fixed with signs
7829 separated).
7830 `~DIGITS,SCALE,WIDTH,PADCHAR$'
7831 `~@$'
7832 If the number is positive a plus sign is printed.
7833
7834 `~:@$'
7835 A sign is always printed and appears before the padding.
7836
7837 `~:$'
7838 The sign appears before the padding.
7839
7840`~%'
7841 Newline.
7842 `~N%'
7843 print N newlines.
7844
7845`~&'
7846 print newline if not at the beginning of the output line.
7847 `~N&'
7848 prints `~&' and then N-1 newlines.
7849
7850`~|'
7851 Page Separator.
7852 `~N|'
7853 print N page separators.
7854
7855`~~'
7856 Tilde.
7857 `~N~'
7858 print N tildes.
7859
7860`~'<newline>
7861 Continuation Line.
7862 `~:'<newline>
7863 newline is ignored, white space left.
7864
7865 `~@'<newline>
7866 newline is left, white space ignored.
7867
7868`~T'
7869 Tabulation.
7870 `~@T'
7871 relative tabulation.
7872
7873 `~COLNUM,COLINCT'
7874 full tabulation.
7875
7876`~?'
7877 Indirection (expects indirect arguments as a list).
7878 `~@?'
7879 extracts indirect arguments from format arguments.
7880
7881`~(STR~)'
7882 Case conversion (converts by `string-downcase').
7883 `~:(STR~)'
7884 converts by `string-capitalize'.
7885
7886 `~@(STR~)'
7887 converts by `string-capitalize-first'.
7888
7889 `~:@(STR~)'
7890 converts by `string-upcase'.
7891
7892`~*'
7893 Argument Jumping (jumps 1 argument forward).
7894 `~N*'
7895 jumps N arguments forward.
7896
7897 `~:*'
7898 jumps 1 argument backward.
7899
7900 `~N:*'
7901 jumps N arguments backward.
7902
7903 `~@*'
7904 jumps to the 0th argument.
7905
7906 `~N@*'
7907 jumps to the Nth argument (beginning from 0)
7908
7909`~[STR0~;STR1~;...~;STRN~]'
7910 Conditional Expression (numerical clause conditional).
7911 `~N['
7912 take argument from N.
7913
7914 `~@['
7915 true test conditional.
7916
7917 `~:['
7918 if-else-then conditional.
7919
7920 `~;'
7921 clause separator.
7922
7923 `~:;'
7924 default clause follows.
7925
7926`~{STR~}'
7927 Iteration (args come from the next argument (a list)).
7928 `~N{'
7929 at most N iterations.
7930
7931 `~:{'
7932 args from next arg (a list of lists).
7933
7934 `~@{'
7935 args from the rest of arguments.
7936
7937 `~:@{'
7938 args from the rest args (lists).
7939
7940`~^'
7941 Up and out.
7942 `~N^'
7943 aborts if N = 0
7944
7945 `~N,M^'
7946 aborts if N = M
7947
7948 `~N,M,K^'
7949 aborts if N <= M <= K
7950
7951*** Not Implemented CL Format Control Directives
7952
7953`~:A'
7954 print `#f' as an empty list (see below).
7955
7956`~:S'
7957 print `#f' as an empty list (see below).
7958
7959`~<~>'
7960 Justification.
7961
7962`~:^'
7963 (sorry I don't understand its semantics completely)
7964
7965*** Extended, Replaced and Additional Control Directives
7966
7967`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
7968`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
7969`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
7970`~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
7971`~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
7972 COMMAWIDTH is the number of characters between two comma
7973 characters.
7974
7975`~I'
7976 print a R4RS complex number as `~F~@Fi' with passed parameters for
7977 `~F'.
7978
7979`~Y'
7980 Pretty print formatting of an argument for scheme code lists.
7981
7982`~K'
7983 Same as `~?.'
7984
7985`~!'
7986 Flushes the output if format DESTINATION is a port.
7987
7988`~_'
7989 Print a `#\space' character
7990 `~N_'
7991 print N `#\space' characters.
7992
7993`~/'
7994 Print a `#\tab' character
7995 `~N/'
7996 print N `#\tab' characters.
7997
7998`~NC'
7999 Takes N as an integer representation for a character. No arguments
8000 are consumed. N is converted to a character by `integer->char'. N
8001 must be a positive decimal number.
8002
8003`~:S'
8004 Print out readproof. Prints out internal objects represented as
8005 `#<...>' as strings `"#<...>"' so that the format output can always
8006 be processed by `read'.
8007
8008`~:A'
8009 Print out readproof. Prints out internal objects represented as
8010 `#<...>' as strings `"#<...>"' so that the format output can always
8011 be processed by `read'.
8012
8013`~Q'
8014 Prints information and a copyright notice on the format
8015 implementation.
8016 `~:Q'
8017 prints format version.
8018
8019`~F, ~E, ~G, ~$'
8020 may also print number strings, i.e. passing a number as a string
8021 and format it accordingly.
8022
8023*** Configuration Variables
8024
8025 The format module exports some configuration variables to suit the
8026systems and users needs. There should be no modification necessary for
8027the configuration that comes with Guile. Format detects automatically
8028if the running scheme system implements floating point numbers and
8029complex numbers.
8030
8031format:symbol-case-conv
8032 Symbols are converted by `symbol->string' so the case type of the
8033 printed symbols is implementation dependent.
8034 `format:symbol-case-conv' is a one arg closure which is either
8035 `#f' (no conversion), `string-upcase', `string-downcase' or
8036 `string-capitalize'. (default `#f')
8037
8038format:iobj-case-conv
8039 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
8040 implementation internal objects. (default `#f')
8041
8042format:expch
8043 The character prefixing the exponent value in `~E' printing.
8044 (default `#\E')
8045
8046*** Compatibility With Other Format Implementations
8047
8048SLIB format 2.x:
8049 See `format.doc'.
8050
8051SLIB format 1.4:
8052 Downward compatible except for padding support and `~A', `~S',
8053 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
8054 `printf' padding support which is completely replaced by the CL
8055 `format' padding style.
8056
8057MIT C-Scheme 7.1:
8058 Downward compatible except for `~', which is not documented
8059 (ignores all characters inside the format string up to a newline
8060 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
8061 numerical and variable parameters and `:/@' modifiers in the CL
8062 sense).
8063
8064Elk 1.5/2.0:
8065 Downward compatible except for `~A' and `~S' which print in
8066 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
8067 directive parameters or modifiers)).
8068
8069Scheme->C 01nov91:
8070 Downward compatible except for an optional destination parameter:
8071 S2C accepts a format call without a destination which returns a
8072 formatted string. This is equivalent to a #f destination in S2C.
8073 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
8074 parameters or modifiers)).
8075
8076
e7d37b0a 8077** Changes to string-handling functions.
b7e13f65 8078
e7d37b0a 8079These functions were added to support the (ice-9 format) module, above.
b7e13f65 8080
e7d37b0a
JB
8081*** New function: string-upcase STRING
8082*** New function: string-downcase STRING
b7e13f65 8083
e7d37b0a
JB
8084These are non-destructive versions of the existing string-upcase! and
8085string-downcase! functions.
b7e13f65 8086
e7d37b0a
JB
8087*** New function: string-capitalize! STRING
8088*** New function: string-capitalize STRING
8089
8090These functions convert the first letter of each word in the string to
8091upper case. Thus:
8092
8093 (string-capitalize "howdy there")
8094 => "Howdy There"
8095
8096As with the other functions, string-capitalize! modifies the string in
8097place, while string-capitalize returns a modified copy of its argument.
8098
8099*** New function: string-ci->symbol STRING
8100
8101Return a symbol whose name is STRING, but having the same case as if
8102the symbol had be read by `read'.
8103
8104Guile can be configured to be sensitive or insensitive to case
8105differences in Scheme identifiers. If Guile is case-insensitive, all
8106symbols are converted to lower case on input. The `string-ci->symbol'
8107function returns a symbol whose name in STRING, transformed as Guile
8108would if STRING were input.
8109
8110*** New function: substring-move! STRING1 START END STRING2 START
8111
8112Copy the substring of STRING1 from START (inclusive) to END
8113(exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
8114string, and the source and destination areas may overlap; in all
8115cases, the function behaves as if all the characters were copied
8116simultanously.
8117
6c0201ad 8118*** Extended functions: substring-move-left! substring-move-right!
e7d37b0a
JB
8119
8120These functions now correctly copy arbitrarily overlapping substrings;
8121they are both synonyms for substring-move!.
b7e13f65 8122
b7e13f65 8123
deaceb4e
JB
8124** New module (ice-9 getopt-long), with the function `getopt-long'.
8125
8126getopt-long is a function for parsing command-line arguments in a
8127manner consistent with other GNU programs.
8128
8129(getopt-long ARGS GRAMMAR)
8130Parse the arguments ARGS according to the argument list grammar GRAMMAR.
8131
8132ARGS should be a list of strings. Its first element should be the
8133name of the program; subsequent elements should be the arguments
8134that were passed to the program on the command line. The
8135`program-arguments' procedure returns a list of this form.
8136
8137GRAMMAR is a list of the form:
8138((OPTION (PROPERTY VALUE) ...) ...)
8139
8140Each OPTION should be a symbol. `getopt-long' will accept a
8141command-line option named `--OPTION'.
8142Each option can have the following (PROPERTY VALUE) pairs:
8143
8144 (single-char CHAR) --- Accept `-CHAR' as a single-character
8145 equivalent to `--OPTION'. This is how to specify traditional
8146 Unix-style flags.
8147 (required? BOOL) --- If BOOL is true, the option is required.
8148 getopt-long will raise an error if it is not found in ARGS.
8149 (value BOOL) --- If BOOL is #t, the option accepts a value; if
8150 it is #f, it does not; and if it is the symbol
8151 `optional', the option may appear in ARGS with or
6c0201ad 8152 without a value.
deaceb4e
JB
8153 (predicate FUNC) --- If the option accepts a value (i.e. you
8154 specified `(value #t)' for this option), then getopt
8155 will apply FUNC to the value, and throw an exception
8156 if it returns #f. FUNC should be a procedure which
8157 accepts a string and returns a boolean value; you may
8158 need to use quasiquotes to get it into GRAMMAR.
8159
8160The (PROPERTY VALUE) pairs may occur in any order, but each
8161property may occur only once. By default, options do not have
8162single-character equivalents, are not required, and do not take
8163values.
8164
8165In ARGS, single-character options may be combined, in the usual
8166Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
8167accepts values, then it must be the last option in the
8168combination; the value is the next argument. So, for example, using
8169the following grammar:
8170 ((apples (single-char #\a))
8171 (blimps (single-char #\b) (value #t))
8172 (catalexis (single-char #\c) (value #t)))
8173the following argument lists would be acceptable:
8174 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
8175 for "blimps" and "catalexis")
8176 ("-ab" "bang" "-c" "couth") (same)
8177 ("-ac" "couth" "-b" "bang") (same)
8178 ("-abc" "couth" "bang") (an error, since `-b' is not the
8179 last option in its combination)
8180
8181If an option's value is optional, then `getopt-long' decides
8182whether it has a value by looking at what follows it in ARGS. If
8183the next element is a string, and it does not appear to be an
8184option itself, then that string is the option's value.
8185
8186The value of a long option can appear as the next element in ARGS,
8187or it can follow the option name, separated by an `=' character.
8188Thus, using the same grammar as above, the following argument lists
8189are equivalent:
8190 ("--apples" "Braeburn" "--blimps" "Goodyear")
8191 ("--apples=Braeburn" "--blimps" "Goodyear")
8192 ("--blimps" "Goodyear" "--apples=Braeburn")
8193
8194If the option "--" appears in ARGS, argument parsing stops there;
8195subsequent arguments are returned as ordinary arguments, even if
8196they resemble options. So, in the argument list:
8197 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
8198`getopt-long' will recognize the `apples' option as having the
8199value "Granny Smith", but it will not recognize the `blimp'
8200option; it will return the strings "--blimp" and "Goodyear" as
8201ordinary argument strings.
8202
8203The `getopt-long' function returns the parsed argument list as an
8204assocation list, mapping option names --- the symbols from GRAMMAR
8205--- onto their values, or #t if the option does not accept a value.
8206Unused options do not appear in the alist.
8207
8208All arguments that are not the value of any option are returned
8209as a list, associated with the empty list.
8210
8211`getopt-long' throws an exception if:
8212- it finds an unrecognized option in ARGS
8213- a required option is omitted
8214- an option that requires an argument doesn't get one
8215- an option that doesn't accept an argument does get one (this can
8216 only happen using the long option `--opt=value' syntax)
8217- an option predicate fails
8218
8219So, for example:
8220
8221(define grammar
8222 `((lockfile-dir (required? #t)
8223 (value #t)
8224 (single-char #\k)
8225 (predicate ,file-is-directory?))
8226 (verbose (required? #f)
8227 (single-char #\v)
8228 (value #f))
8229 (x-includes (single-char #\x))
6c0201ad 8230 (rnet-server (single-char #\y)
deaceb4e
JB
8231 (predicate ,string?))))
8232
6c0201ad 8233(getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
deaceb4e
JB
8234 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
8235 grammar)
8236=> ((() "foo1" "-fred" "foo2" "foo3")
8237 (rnet-server . "lamprod")
8238 (x-includes . "/usr/include")
8239 (lockfile-dir . "/tmp")
8240 (verbose . #t))
8241
8242** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
8243
8244It will be removed in a few releases.
8245
08394899
MS
8246** New syntax: lambda*
8247** New syntax: define*
6c0201ad 8248** New syntax: define*-public
08394899
MS
8249** New syntax: defmacro*
8250** New syntax: defmacro*-public
6c0201ad 8251Guile now supports optional arguments.
08394899
MS
8252
8253`lambda*', `define*', `define*-public', `defmacro*' and
8254`defmacro*-public' are identical to the non-* versions except that
8255they use an extended type of parameter list that has the following BNF
8256syntax (parentheses are literal, square brackets indicate grouping,
8257and `*', `+' and `?' have the usual meaning):
8258
8259 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
6c0201ad 8260 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
08394899
MS
8261 [[#&rest identifier]|[. identifier]]? ) | [identifier]
8262
6c0201ad 8263 ext-var-decl ::= identifier | ( identifier expression )
08394899
MS
8264
8265The semantics are best illustrated with the following documentation
8266and examples for `lambda*':
8267
8268 lambda* args . body
8269 lambda extended for optional and keyword arguments
6c0201ad 8270
08394899
MS
8271 lambda* creates a procedure that takes optional arguments. These
8272 are specified by putting them inside brackets at the end of the
8273 paramater list, but before any dotted rest argument. For example,
8274 (lambda* (a b #&optional c d . e) '())
8275 creates a procedure with fixed arguments a and b, optional arguments c
8276 and d, and rest argument e. If the optional arguments are omitted
8277 in a call, the variables for them are unbound in the procedure. This
8278 can be checked with the bound? macro.
8279
8280 lambda* can also take keyword arguments. For example, a procedure
8281 defined like this:
8282 (lambda* (#&key xyzzy larch) '())
8283 can be called with any of the argument lists (#:xyzzy 11)
8284 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
8285 are given as keywords are bound to values.
8286
8287 Optional and keyword arguments can also be given default values
8288 which they take on when they are not present in a call, by giving a
8289 two-item list in place of an optional argument, for example in:
6c0201ad 8290 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
08394899
MS
8291 foo is a fixed argument, bar is an optional argument with default
8292 value 42, and baz is a keyword argument with default value 73.
8293 Default value expressions are not evaluated unless they are needed
6c0201ad 8294 and until the procedure is called.
08394899
MS
8295
8296 lambda* now supports two more special parameter list keywords.
8297
8298 lambda*-defined procedures now throw an error by default if a
8299 keyword other than one of those specified is found in the actual
8300 passed arguments. However, specifying #&allow-other-keys
8301 immediately after the kyword argument declarations restores the
8302 previous behavior of ignoring unknown keywords. lambda* also now
8303 guarantees that if the same keyword is passed more than once, the
8304 last one passed is the one that takes effect. For example,
8305 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
8306 #:heads 37 #:tails 42 #:heads 99)
8307 would result in (99 47) being displayed.
8308
8309 #&rest is also now provided as a synonym for the dotted syntax rest
8310 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
8311 all respects to lambda*. This is provided for more similarity to DSSSL,
8312 MIT-Scheme and Kawa among others, as well as for refugees from other
8313 Lisp dialects.
8314
8315Further documentation may be found in the optargs.scm file itself.
8316
8317The optional argument module also exports the macros `let-optional',
8318`let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
8319are not documented here because they may be removed in the future, but
8320full documentation is still available in optargs.scm.
8321
2e132553
JB
8322** New syntax: and-let*
8323Guile now supports the `and-let*' form, described in the draft SRFI-2.
8324
8325Syntax: (land* (<clause> ...) <body> ...)
8326Each <clause> should have one of the following forms:
8327 (<variable> <expression>)
8328 (<expression>)
8329 <bound-variable>
8330Each <variable> or <bound-variable> should be an identifier. Each
8331<expression> should be a valid expression. The <body> should be a
8332possibly empty sequence of expressions, like the <body> of a
8333lambda form.
8334
8335Semantics: A LAND* expression is evaluated by evaluating the
8336<expression> or <bound-variable> of each of the <clause>s from
8337left to right. The value of the first <expression> or
8338<bound-variable> that evaluates to a false value is returned; the
8339remaining <expression>s and <bound-variable>s are not evaluated.
8340The <body> forms are evaluated iff all the <expression>s and
8341<bound-variable>s evaluate to true values.
8342
8343The <expression>s and the <body> are evaluated in an environment
8344binding each <variable> of the preceding (<variable> <expression>)
8345clauses to the value of the <expression>. Later bindings
8346shadow earlier bindings.
8347
8348Guile's and-let* macro was contributed by Michael Livshin.
8349
36d3d540
MD
8350** New sorting functions
8351
8352*** New function: sorted? SEQUENCE LESS?
ed8c8636
MD
8353Returns `#t' when the sequence argument is in non-decreasing order
8354according to LESS? (that is, there is no adjacent pair `... x y
8355...' for which `(less? y x)').
8356
8357Returns `#f' when the sequence contains at least one out-of-order
8358pair. It is an error if the sequence is neither a list nor a
8359vector.
8360
36d3d540 8361*** New function: merge LIST1 LIST2 LESS?
ed8c8636
MD
8362LIST1 and LIST2 are sorted lists.
8363Returns the sorted list of all elements in LIST1 and LIST2.
8364
8365Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
8366in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
8367and that a < b1 in LIST1. Then a < b1 < b2 in the result.
8368(Here "<" should read "comes before".)
8369
36d3d540 8370*** New procedure: merge! LIST1 LIST2 LESS?
ed8c8636
MD
8371Merges two lists, re-using the pairs of LIST1 and LIST2 to build
8372the result. If the code is compiled, and LESS? constructs no new
8373pairs, no pairs at all will be allocated. The first pair of the
8374result will be either the first pair of LIST1 or the first pair of
8375LIST2.
8376
36d3d540 8377*** New function: sort SEQUENCE LESS?
ed8c8636
MD
8378Accepts either a list or a vector, and returns a new sequence
8379which is sorted. The new sequence is the same type as the input.
8380Always `(sorted? (sort sequence less?) less?)'. The original
8381sequence is not altered in any way. The new sequence shares its
8382elements with the old one; no elements are copied.
8383
36d3d540 8384*** New procedure: sort! SEQUENCE LESS
ed8c8636
MD
8385Returns its sorted result in the original boxes. No new storage is
8386allocated at all. Proper usage: (set! slist (sort! slist <))
8387
36d3d540 8388*** New function: stable-sort SEQUENCE LESS?
ed8c8636
MD
8389Similar to `sort' but stable. That is, if "equal" elements are
8390ordered a < b in the original sequence, they will have the same order
8391in the result.
8392
36d3d540 8393*** New function: stable-sort! SEQUENCE LESS?
ed8c8636
MD
8394Similar to `sort!' but stable.
8395Uses temporary storage when sorting vectors.
8396
36d3d540 8397*** New functions: sort-list, sort-list!
ed8c8636
MD
8398Added for compatibility with scsh.
8399
36d3d540
MD
8400** New built-in random number support
8401
8402*** New function: random N [STATE]
3e8370c3
MD
8403Accepts a positive integer or real N and returns a number of the
8404same type between zero (inclusive) and N (exclusive). The values
8405returned have a uniform distribution.
8406
8407The optional argument STATE must be of the type produced by
416075f1
MD
8408`copy-random-state' or `seed->random-state'. It defaults to the value
8409of the variable `*random-state*'. This object is used to maintain the
8410state of the pseudo-random-number generator and is altered as a side
8411effect of the `random' operation.
3e8370c3 8412
36d3d540 8413*** New variable: *random-state*
3e8370c3
MD
8414Holds a data structure that encodes the internal state of the
8415random-number generator that `random' uses by default. The nature
8416of this data structure is implementation-dependent. It may be
8417printed out and successfully read back in, but may or may not
8418function correctly as a random-number state object in another
8419implementation.
8420
36d3d540 8421*** New function: copy-random-state [STATE]
3e8370c3
MD
8422Returns a new object of type suitable for use as the value of the
8423variable `*random-state*' and as a second argument to `random'.
8424If argument STATE is given, a copy of it is returned. Otherwise a
8425copy of `*random-state*' is returned.
416075f1 8426
36d3d540 8427*** New function: seed->random-state SEED
416075f1
MD
8428Returns a new object of type suitable for use as the value of the
8429variable `*random-state*' and as a second argument to `random'.
8430SEED is a string or a number. A new state is generated and
8431initialized using SEED.
3e8370c3 8432
36d3d540 8433*** New function: random:uniform [STATE]
3e8370c3
MD
8434Returns an uniformly distributed inexact real random number in the
8435range between 0 and 1.
8436
36d3d540 8437*** New procedure: random:solid-sphere! VECT [STATE]
3e8370c3
MD
8438Fills VECT with inexact real random numbers the sum of whose
8439squares is less than 1.0. Thinking of VECT as coordinates in
8440space of dimension N = `(vector-length VECT)', the coordinates are
8441uniformly distributed within the unit N-shere. The sum of the
8442squares of the numbers is returned. VECT can be either a vector
8443or a uniform vector of doubles.
8444
36d3d540 8445*** New procedure: random:hollow-sphere! VECT [STATE]
3e8370c3
MD
8446Fills VECT with inexact real random numbers the sum of whose squares
8447is equal to 1.0. Thinking of VECT as coordinates in space of
8448dimension n = `(vector-length VECT)', the coordinates are uniformly
8449distributed over the surface of the unit n-shere. VECT can be either
8450a vector or a uniform vector of doubles.
8451
36d3d540 8452*** New function: random:normal [STATE]
3e8370c3
MD
8453Returns an inexact real in a normal distribution with mean 0 and
8454standard deviation 1. For a normal distribution with mean M and
8455standard deviation D use `(+ M (* D (random:normal)))'.
8456
36d3d540 8457*** New procedure: random:normal-vector! VECT [STATE]
3e8370c3
MD
8458Fills VECT with inexact real random numbers which are independent and
8459standard normally distributed (i.e., with mean 0 and variance 1).
8460VECT can be either a vector or a uniform vector of doubles.
8461
36d3d540 8462*** New function: random:exp STATE
3e8370c3
MD
8463Returns an inexact real in an exponential distribution with mean 1.
8464For an exponential distribution with mean U use (* U (random:exp)).
8465
69c6acbb
JB
8466** The range of logand, logior, logxor, logtest, and logbit? have changed.
8467
8468These functions now operate on numbers in the range of a C unsigned
8469long.
8470
8471These functions used to operate on numbers in the range of a C signed
8472long; however, this seems inappropriate, because Guile integers don't
8473overflow.
8474
ba4ee0d6
MD
8475** New function: make-guardian
8476This is an implementation of guardians as described in
8477R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
8478Generation-Based Garbage Collector" ACM SIGPLAN Conference on
8479Programming Language Design and Implementation, June 1993
8480ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
8481
88ceea5c
MD
8482** New functions: delq1!, delv1!, delete1!
8483These procedures behave similar to delq! and friends but delete only
8484one object if at all.
8485
55254a6a
MD
8486** New function: unread-string STRING PORT
8487Unread STRING to PORT, that is, push it back onto the port so that
8488next read operation will work on the pushed back characters.
8489
8490** unread-char can now be called multiple times
8491If unread-char is called multiple times, the unread characters will be
8492read again in last-in first-out order.
8493
9e97c52d
GH
8494** the procedures uniform-array-read! and uniform-array-write! now
8495work on any kind of port, not just ports which are open on a file.
8496
b074884f 8497** Now 'l' in a port mode requests line buffering.
9e97c52d 8498
69bc9ff3
GH
8499** The procedure truncate-file now works on string ports as well
8500as file ports. If the size argument is omitted, the current
1b9c3dae 8501file position is used.
9e97c52d 8502
c94577b4 8503** new procedure: seek PORT/FDES OFFSET WHENCE
9e97c52d
GH
8504The arguments are the same as for the old fseek procedure, but it
8505works on string ports as well as random-access file ports.
8506
8507** the fseek procedure now works on string ports, since it has been
c94577b4 8508redefined using seek.
9e97c52d
GH
8509
8510** the setvbuf procedure now uses a default size if mode is _IOFBF and
8511size is not supplied.
8512
8513** the newline procedure no longer flushes the port if it's not
8514line-buffered: previously it did if it was the current output port.
8515
8516** open-pipe and close-pipe are no longer primitive procedures, but
8517an emulation can be obtained using `(use-modules (ice-9 popen))'.
8518
8519** the freopen procedure has been removed.
8520
8521** new procedure: drain-input PORT
8522Drains PORT's read buffers (including any pushed-back characters)
8523and returns the contents as a single string.
8524
67ad463a 8525** New function: map-in-order PROC LIST1 LIST2 ...
d41b3904
MD
8526Version of `map' which guarantees that the procedure is applied to the
8527lists in serial order.
8528
67ad463a
MD
8529** Renamed `serial-array-copy!' and `serial-array-map!' to
8530`array-copy-in-order!' and `array-map-in-order!'. The old names are
8531now obsolete and will go away in release 1.5.
8532
cf7132b3 8533** New syntax: collect BODY1 ...
d41b3904
MD
8534Version of `begin' which returns a list of the results of the body
8535forms instead of the result of the last body form. In contrast to
cf7132b3 8536`begin', `collect' allows an empty body.
d41b3904 8537
e4eae9b1
MD
8538** New functions: read-history FILENAME, write-history FILENAME
8539Read/write command line history from/to file. Returns #t on success
8540and #f if an error occured.
8541
d21ffe26
JB
8542** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
8543
8544These procedures return a list of definitions available in the specified
8545argument, a relative module reference. In the case of no argument,
8546`(current-module)' is now consulted for definitions to return, instead
8547of simply returning #f, the former behavior.
8548
f8c9d497
JB
8549** The #/ syntax for lists is no longer supported.
8550
8551Earlier versions of Scheme accepted this syntax, but printed a
8552warning.
8553
8554** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
8555
8556Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
8557modules.
8558
3ffc7a36
MD
8559* Changes to the gh_ interface
8560
8561** gh_scm2doubles
8562
8563Now takes a second argument which is the result array. If this
8564pointer is NULL, a new array is malloced (the old behaviour).
8565
8566** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
8567 gh_scm2shorts, gh_scm2longs, gh_scm2floats
8568
8569New functions.
8570
3e8370c3
MD
8571* Changes to the scm_ interface
8572
ad91d6c3
MD
8573** Function: scm_make_named_hook (char* name, int n_args)
8574
8575Creates a hook in the same way as make-hook above but also
8576binds a variable named NAME to it.
8577
8578This is the typical way of creating a hook from C code.
8579
ece41168
MD
8580Currently, the variable is created in the "current" module. This
8581might change when we get the new module system.
ad91d6c3 8582
16a5a9a4
MD
8583** The smob interface
8584
8585The interface for creating smobs has changed. For documentation, see
8586data-rep.info (made from guile-core/doc/data-rep.texi).
8587
8588*** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
8589
8590>>> This function will be removed in 1.3.4. <<<
8591
8592It is replaced by:
8593
8594*** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
8595This function adds a new smob type, named NAME, with instance size
8596SIZE to the system. The return value is a tag that is used in
8597creating instances of the type. If SIZE is 0, then no memory will
8598be allocated when instances of the smob are created, and nothing
8599will be freed by the default free function.
6c0201ad 8600
16a5a9a4
MD
8601*** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
8602This function sets the smob marking procedure for the smob type
8603specified by the tag TC. TC is the tag returned by
8604`scm_make_smob_type'.
8605
8606*** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
8607This function sets the smob freeing procedure for the smob type
8608specified by the tag TC. TC is the tag returned by
8609`scm_make_smob_type'.
8610
8611*** Function: void scm_set_smob_print (tc, print)
8612
8613 - Function: void scm_set_smob_print (long tc,
8614 scm_sizet (*print) (SCM,
8615 SCM,
8616 scm_print_state *))
8617
8618This function sets the smob printing procedure for the smob type
8619specified by the tag TC. TC is the tag returned by
8620`scm_make_smob_type'.
8621
8622*** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
8623This function sets the smob equality-testing predicate for the
8624smob type specified by the tag TC. TC is the tag returned by
8625`scm_make_smob_type'.
8626
8627*** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
8628Make VALUE contain a smob instance of the type with type code TC and
8629smob data DATA. VALUE must be previously declared as C type `SCM'.
8630
8631*** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
8632This macro expands to a block of code that creates a smob instance
8633of the type with type code TC and smob data DATA, and returns that
8634`SCM' value. It should be the last piece of code in a block.
8635
9e97c52d
GH
8636** The interfaces for using I/O ports and implementing port types
8637(ptobs) have changed significantly. The new interface is based on
8638shared access to buffers and a new set of ptob procedures.
8639
16a5a9a4
MD
8640*** scm_newptob has been removed
8641
8642It is replaced by:
8643
8644*** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
8645
8646- Function: SCM scm_make_port_type (char *type_name,
8647 int (*fill_buffer) (SCM port),
8648 void (*write_flush) (SCM port));
8649
8650Similarly to the new smob interface, there is a set of function
8651setters by which the user can customize the behaviour of his port
544e9093 8652type. See ports.h (scm_set_port_XXX).
16a5a9a4 8653
9e97c52d
GH
8654** scm_strport_to_string: New function: creates a new string from
8655a string port's buffer.
8656
3e8370c3
MD
8657** Plug in interface for random number generators
8658The variable `scm_the_rng' in random.c contains a value and three
8659function pointers which together define the current random number
8660generator being used by the Scheme level interface and the random
8661number library functions.
8662
8663The user is free to replace the default generator with the generator
8664of his own choice.
8665
8666*** Variable: size_t scm_the_rng.rstate_size
8667The size of the random state type used by the current RNG
8668measured in chars.
8669
8670*** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
8671Given the random STATE, return 32 random bits.
8672
8673*** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
8674Seed random state STATE using string S of length N.
8675
8676*** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
8677Given random state STATE, return a malloced copy.
8678
8679** Default RNG
8680The default RNG is the MWC (Multiply With Carry) random number
8681generator described by George Marsaglia at the Department of
8682Statistics and Supercomputer Computations Research Institute, The
8683Florida State University (http://stat.fsu.edu/~geo).
8684
8685It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
8686passes all tests in the DIEHARD test suite
8687(http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
8688costs one multiply and one add on platforms which either supports long
8689longs (gcc does this on most systems) or have 64 bit longs. The cost
8690is four multiply on other systems but this can be optimized by writing
8691scm_i_uniform32 in assembler.
8692
8693These functions are provided through the scm_the_rng interface for use
8694by libguile and the application.
8695
8696*** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
8697Given the random STATE, return 32 random bits.
8698Don't use this function directly. Instead go through the plugin
8699interface (see "Plug in interface" above).
8700
8701*** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
8702Initialize STATE using SEED of length N.
8703
8704*** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
8705Return a malloc:ed copy of STATE. This function can easily be re-used
8706in the interfaces to other RNGs.
8707
8708** Random number library functions
8709These functions use the current RNG through the scm_the_rng interface.
8710It might be a good idea to use these functions from your C code so
8711that only one random generator is used by all code in your program.
8712
259529f2 8713The default random state is stored in:
3e8370c3
MD
8714
8715*** Variable: SCM scm_var_random_state
8716Contains the vcell of the Scheme variable "*random-state*" which is
8717used as default state by all random number functions in the Scheme
8718level interface.
8719
8720Example:
8721
259529f2 8722 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
3e8370c3 8723
259529f2
MD
8724*** Function: scm_rstate *scm_c_default_rstate (void)
8725This is a convenience function which returns the value of
8726scm_var_random_state. An error message is generated if this value
8727isn't a random state.
8728
8729*** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
8730Make a new random state from the string SEED of length LENGTH.
8731
8732It is generally not a good idea to use multiple random states in a
8733program. While subsequent random numbers generated from one random
8734state are guaranteed to be reasonably independent, there is no such
8735guarantee for numbers generated from different random states.
8736
8737*** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
8738Return 32 random bits.
8739
8740*** Function: double scm_c_uniform01 (scm_rstate *STATE)
3e8370c3
MD
8741Return a sample from the uniform(0,1) distribution.
8742
259529f2 8743*** Function: double scm_c_normal01 (scm_rstate *STATE)
3e8370c3
MD
8744Return a sample from the normal(0,1) distribution.
8745
259529f2 8746*** Function: double scm_c_exp1 (scm_rstate *STATE)
3e8370c3
MD
8747Return a sample from the exp(1) distribution.
8748
259529f2
MD
8749*** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
8750Return a sample from the discrete uniform(0,M) distribution.
8751
8752*** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
3e8370c3 8753Return a sample from the discrete uniform(0,M) distribution.
259529f2 8754M must be a bignum object. The returned value may be an INUM.
3e8370c3 8755
9e97c52d 8756
f3227c7a 8757\f
d23bbf3e 8758Changes in Guile 1.3 (released Monday, October 19, 1998):
c484bf7f
JB
8759
8760* Changes to the distribution
8761
e2d6569c
JB
8762** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
8763To avoid conflicts, programs should name environment variables after
8764themselves, except when there's a common practice establishing some
8765other convention.
8766
8767For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
8768giving the former precedence, and printing a warning message if the
8769latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
8770
8771** The header files related to multi-byte characters have been removed.
8772They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
8773which referred to these explicitly will probably need to be rewritten,
8774since the support for the variant string types has been removed; see
8775below.
8776
8777** The header files append.h and sequences.h have been removed. These
8778files implemented non-R4RS operations which would encourage
8779non-portable programming style and less easy-to-read code.
3a97e020 8780
c484bf7f
JB
8781* Changes to the stand-alone interpreter
8782
2e368582 8783** New procedures have been added to implement a "batch mode":
ec4ab4fd 8784
2e368582 8785*** Function: batch-mode?
ec4ab4fd
GH
8786
8787 Returns a boolean indicating whether the interpreter is in batch
8788 mode.
8789
2e368582 8790*** Function: set-batch-mode?! ARG
ec4ab4fd
GH
8791
8792 If ARG is true, switches the interpreter to batch mode. The `#f'
8793 case has not been implemented.
8794
2e368582
JB
8795** Guile now provides full command-line editing, when run interactively.
8796To use this feature, you must have the readline library installed.
8797The Guile build process will notice it, and automatically include
8798support for it.
8799
8800The readline library is available via anonymous FTP from any GNU
8801mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
8802
a5d6d578
MD
8803** the-last-stack is now a fluid.
8804
c484bf7f
JB
8805* Changes to the procedure for linking libguile with your programs
8806
71f20534 8807** You can now use the `guile-config' utility to build programs that use Guile.
2e368582 8808
2adfe1c0 8809Guile now includes a command-line utility called `guile-config', which
71f20534
JB
8810can provide information about how to compile and link programs that
8811use Guile.
8812
8813*** `guile-config compile' prints any C compiler flags needed to use Guile.
8814You should include this command's output on the command line you use
8815to compile C or C++ code that #includes the Guile header files. It's
8816usually just a `-I' flag to help the compiler find the Guile headers.
8817
8818
8819*** `guile-config link' prints any linker flags necessary to link with Guile.
8aa5c148 8820
71f20534 8821This command writes to its standard output a list of flags which you
8aa5c148
JB
8822must pass to the linker to link your code against the Guile library.
8823The flags include '-lguile' itself, any other libraries the Guile
8824library depends upon, and any `-L' flags needed to help the linker
8825find those libraries.
2e368582
JB
8826
8827For example, here is a Makefile rule that builds a program named 'foo'
8828from the object files ${FOO_OBJECTS}, and links them against Guile:
8829
8830 foo: ${FOO_OBJECTS}
2adfe1c0 8831 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
2e368582 8832
e2d6569c
JB
8833Previous Guile releases recommended that you use autoconf to detect
8834which of a predefined set of libraries were present on your system.
2adfe1c0 8835It is more robust to use `guile-config', since it records exactly which
e2d6569c
JB
8836libraries the installed Guile library requires.
8837
2adfe1c0
JB
8838This was originally called `build-guile', but was renamed to
8839`guile-config' before Guile 1.3 was released, to be consistent with
8840the analogous script for the GTK+ GUI toolkit, which is called
8841`gtk-config'.
8842
2e368582 8843
8aa5c148
JB
8844** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
8845
8846If you are using the GNU autoconf package to configure your program,
8847you can use the GUILE_FLAGS autoconf macro to call `guile-config'
8848(described above) and gather the necessary values for use in your
8849Makefiles.
8850
8851The GUILE_FLAGS macro expands to configure script code which runs the
8852`guile-config' script, to find out where Guile's header files and
8853libraries are installed. It sets two variables, marked for
8854substitution, as by AC_SUBST.
8855
8856 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
8857 code that uses Guile header files. This is almost always just a
8858 -I flag.
8859
8860 GUILE_LDFLAGS --- flags to pass to the linker to link a
8861 program against Guile. This includes `-lguile' for the Guile
8862 library itself, any libraries that Guile itself requires (like
8863 -lqthreads), and so on. It may also include a -L flag to tell the
8864 compiler where to find the libraries.
8865
8866GUILE_FLAGS is defined in the file guile.m4, in the top-level
8867directory of the Guile distribution. You can copy it into your
8868package's aclocal.m4 file, and then use it in your configure.in file.
8869
8870If you are using the `aclocal' program, distributed with GNU automake,
8871to maintain your aclocal.m4 file, the Guile installation process
8872installs guile.m4 where aclocal will find it. All you need to do is
8873use GUILE_FLAGS in your configure.in file, and then run `aclocal';
8874this will copy the definition of GUILE_FLAGS into your aclocal.m4
8875file.
8876
8877
c484bf7f 8878* Changes to Scheme functions and syntax
7ad3c1e7 8879
02755d59 8880** Multi-byte strings have been removed, as have multi-byte and wide
e2d6569c
JB
8881ports. We felt that these were the wrong approach to
8882internationalization support.
02755d59 8883
2e368582
JB
8884** New function: readline [PROMPT]
8885Read a line from the terminal, and allow the user to edit it,
8886prompting with PROMPT. READLINE provides a large set of Emacs-like
8887editing commands, lets the user recall previously typed lines, and
8888works on almost every kind of terminal, including dumb terminals.
8889
8890READLINE assumes that the cursor is at the beginning of the line when
8891it is invoked. Thus, you can't print a prompt yourself, and then call
8892READLINE; you need to package up your prompt as a string, pass it to
8893the function, and let READLINE print the prompt itself. This is
8894because READLINE needs to know the prompt's screen width.
8895
8cd57bd0
JB
8896For Guile to provide this function, you must have the readline
8897library, version 2.1 or later, installed on your system. Readline is
8898available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
8899any GNU mirror site.
2e368582
JB
8900
8901See also ADD-HISTORY function.
8902
8903** New function: add-history STRING
8904Add STRING as the most recent line in the history used by the READLINE
8905command. READLINE does not add lines to the history itself; you must
8906call ADD-HISTORY to make previous input available to the user.
8907
8cd57bd0
JB
8908** The behavior of the read-line function has changed.
8909
8910This function now uses standard C library functions to read the line,
8911for speed. This means that it doesn not respect the value of
8912scm-line-incrementors; it assumes that lines are delimited with
8913#\newline.
8914
8915(Note that this is read-line, the function that reads a line of text
8916from a port, not readline, the function that reads a line from a
8917terminal, providing full editing capabilities.)
8918
1a0106ef
JB
8919** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
8920
8921This module provides some simple argument parsing. It exports one
8922function:
8923
8924Function: getopt-gnu-style ARG-LS
8925 Parse a list of program arguments into an alist of option
8926 descriptions.
8927
8928 Each item in the list of program arguments is examined to see if
8929 it meets the syntax of a GNU long-named option. An argument like
8930 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
8931 returned alist, where MUMBLE is a keyword object with the same
8932 name as the argument. An argument like `--MUMBLE=FROB' produces
8933 an element of the form (MUMBLE . FROB), where FROB is a string.
8934
8935 As a special case, the returned alist also contains a pair whose
8936 car is the symbol `rest'. The cdr of this pair is a list
8937 containing all the items in the argument list that are not options
8938 of the form mentioned above.
8939
8940 The argument `--' is treated specially: all items in the argument
8941 list appearing after such an argument are not examined, and are
8942 returned in the special `rest' list.
8943
8944 This function does not parse normal single-character switches.
8945 You will need to parse them out of the `rest' list yourself.
8946
8cd57bd0
JB
8947** The read syntax for byte vectors and short vectors has changed.
8948
8949Instead of #bytes(...), write #y(...).
8950
8951Instead of #short(...), write #h(...).
8952
8953This may seem nutty, but, like the other uniform vectors, byte vectors
8954and short vectors want to have the same print and read syntax (and,
8955more basic, want to have read syntax!). Changing the read syntax to
8956use multiple characters after the hash sign breaks with the
8957conventions used in R5RS and the conventions used for the other
8958uniform vectors. It also introduces complexity in the current reader,
8959both on the C and Scheme levels. (The Right solution is probably to
8960change the syntax and prototypes for uniform vectors entirely.)
8961
8962
8963** The new module (ice-9 session) provides useful interactive functions.
8964
8965*** New procedure: (apropos REGEXP OPTION ...)
8966
8967Display a list of top-level variables whose names match REGEXP, and
8968the modules they are imported from. Each OPTION should be one of the
8969following symbols:
8970
8971 value --- Show the value of each matching variable.
8972 shadow --- Show bindings shadowed by subsequently imported modules.
8973 full --- Same as both `shadow' and `value'.
8974
8975For example:
8976
8977 guile> (apropos "trace" 'full)
8978 debug: trace #<procedure trace args>
8979 debug: untrace #<procedure untrace args>
8980 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
8981 the-scm-module: before-backtrace-hook ()
8982 the-scm-module: backtrace #<primitive-procedure backtrace>
8983 the-scm-module: after-backtrace-hook ()
8984 the-scm-module: has-shown-backtrace-hint? #f
6c0201ad 8985 guile>
8cd57bd0
JB
8986
8987** There are new functions and syntax for working with macros.
8988
8989Guile implements macros as a special object type. Any variable whose
8990top-level binding is a macro object acts as a macro. The macro object
8991specifies how the expression should be transformed before evaluation.
8992
8993*** Macro objects now print in a reasonable way, resembling procedures.
8994
8995*** New function: (macro? OBJ)
8996True iff OBJ is a macro object.
8997
8998*** New function: (primitive-macro? OBJ)
8999Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
9000macro transformers, implemented in eval.c rather than Scheme code.
9001
dbdd0c16
JB
9002Why do we have this function?
9003- For symmetry with procedure? and primitive-procedure?,
9004- to allow custom print procedures to tell whether a macro is
9005 primitive, and display it differently, and
9006- to allow compilers and user-written evaluators to distinguish
9007 builtin special forms from user-defined ones, which could be
9008 compiled.
9009
8cd57bd0
JB
9010*** New function: (macro-type OBJ)
9011Return a value indicating what kind of macro OBJ is. Possible return
9012values are:
9013
9014 The symbol `syntax' --- a macro created by procedure->syntax.
9015 The symbol `macro' --- a macro created by procedure->macro.
9016 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
6c0201ad 9017 The boolean #f --- if OBJ is not a macro object.
8cd57bd0
JB
9018
9019*** New function: (macro-name MACRO)
9020Return the name of the macro object MACRO's procedure, as returned by
9021procedure-name.
9022
9023*** New function: (macro-transformer MACRO)
9024Return the transformer procedure for MACRO.
9025
9026*** New syntax: (use-syntax MODULE ... TRANSFORMER)
9027
9028Specify a new macro expander to use in the current module. Each
9029MODULE is a module name, with the same meaning as in the `use-modules'
9030form; each named module's exported bindings are added to the current
9031top-level environment. TRANSFORMER is an expression evaluated in the
9032resulting environment which must yield a procedure to use as the
9033module's eval transformer: every expression evaluated in this module
9034is passed to this function, and the result passed to the Guile
6c0201ad 9035interpreter.
8cd57bd0
JB
9036
9037*** macro-eval! is removed. Use local-eval instead.
29521173 9038
8d9dcb3c
MV
9039** Some magic has been added to the printer to better handle user
9040written printing routines (like record printers, closure printers).
9041
9042The problem is that these user written routines must have access to
7fbd77df 9043the current `print-state' to be able to handle fancy things like
8d9dcb3c
MV
9044detection of circular references. These print-states have to be
9045passed to the builtin printing routines (display, write, etc) to
9046properly continue the print chain.
9047
9048We didn't want to change all existing print code so that it
8cd57bd0 9049explicitly passes thru a print state in addition to a port. Instead,
8d9dcb3c
MV
9050we extented the possible values that the builtin printing routines
9051accept as a `port'. In addition to a normal port, they now also take
9052a pair of a normal port and a print-state. Printing will go to the
9053port and the print-state will be used to control the detection of
9054circular references, etc. If the builtin function does not care for a
9055print-state, it is simply ignored.
9056
9057User written callbacks are now called with such a pair as their
9058`port', but because every function now accepts this pair as a PORT
9059argument, you don't have to worry about that. In fact, it is probably
9060safest to not check for these pairs.
9061
9062However, it is sometimes necessary to continue a print chain on a
9063different port, for example to get a intermediate string
9064representation of the printed value, mangle that string somehow, and
9065then to finally print the mangled string. Use the new function
9066
9067 inherit-print-state OLD-PORT NEW-PORT
9068
9069for this. It constructs a new `port' that prints to NEW-PORT but
9070inherits the print-state of OLD-PORT.
9071
ef1ea498
MD
9072** struct-vtable-offset renamed to vtable-offset-user
9073
9074** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
9075
e478dffa
MD
9076** There is now a third optional argument to make-vtable-vtable
9077 (and fourth to make-struct) when constructing new types (vtables).
9078 This argument initializes field vtable-index-printer of the vtable.
ef1ea498 9079
4851dc57
MV
9080** The detection of circular references has been extended to structs.
9081That is, a structure that -- in the process of being printed -- prints
9082itself does not lead to infinite recursion.
9083
9084** There is now some basic support for fluids. Please read
9085"libguile/fluid.h" to find out more. It is accessible from Scheme with
9086the following functions and macros:
9087
9c3fb66f
MV
9088Function: make-fluid
9089
9090 Create a new fluid object. Fluids are not special variables or
9091 some other extension to the semantics of Scheme, but rather
9092 ordinary Scheme objects. You can store them into variables (that
9093 are still lexically scoped, of course) or into any other place you
9094 like. Every fluid has a initial value of `#f'.
04c76b58 9095
9c3fb66f 9096Function: fluid? OBJ
04c76b58 9097
9c3fb66f 9098 Test whether OBJ is a fluid.
04c76b58 9099
9c3fb66f
MV
9100Function: fluid-ref FLUID
9101Function: fluid-set! FLUID VAL
04c76b58
MV
9102
9103 Access/modify the fluid FLUID. Modifications are only visible
9104 within the current dynamic root (that includes threads).
9105
9c3fb66f
MV
9106Function: with-fluids* FLUIDS VALUES THUNK
9107
9108 FLUIDS is a list of fluids and VALUES a corresponding list of
9109 values for these fluids. Before THUNK gets called the values are
6c0201ad 9110 installed in the fluids and the old values of the fluids are
9c3fb66f
MV
9111 saved in the VALUES list. When the flow of control leaves THUNK
9112 or reenters it, the values get swapped again. You might think of
9113 this as a `safe-fluid-excursion'. Note that the VALUES list is
9114 modified by `with-fluids*'.
9115
9116Macro: with-fluids ((FLUID VALUE) ...) FORM ...
9117
9118 The same as `with-fluids*' but with a different syntax. It looks
9119 just like `let', but both FLUID and VALUE are evaluated. Remember,
9120 fluids are not special variables but ordinary objects. FLUID
9121 should evaluate to a fluid.
04c76b58 9122
e2d6569c 9123** Changes to system call interfaces:
64d01d13 9124
e2d6569c 9125*** close-port, close-input-port and close-output-port now return a
64d01d13
GH
9126boolean instead of an `unspecified' object. #t means that the port
9127was successfully closed, while #f means it was already closed. It is
9128also now possible for these procedures to raise an exception if an
9129error occurs (some errors from write can be delayed until close.)
9130
e2d6569c 9131*** the first argument to chmod, fcntl, ftell and fseek can now be a
6afcd3b2
GH
9132file descriptor.
9133
e2d6569c 9134*** the third argument to fcntl is now optional.
6afcd3b2 9135
e2d6569c 9136*** the first argument to chown can now be a file descriptor or a port.
6afcd3b2 9137
e2d6569c 9138*** the argument to stat can now be a port.
6afcd3b2 9139
e2d6569c 9140*** The following new procedures have been added (most use scsh
64d01d13
GH
9141interfaces):
9142
e2d6569c 9143*** procedure: close PORT/FD
ec4ab4fd
GH
9144 Similar to close-port (*note close-port: Closing Ports.), but also
9145 works on file descriptors. A side effect of closing a file
9146 descriptor is that any ports using that file descriptor are moved
9147 to a different file descriptor and have their revealed counts set
9148 to zero.
9149
e2d6569c 9150*** procedure: port->fdes PORT
ec4ab4fd
GH
9151 Returns the integer file descriptor underlying PORT. As a side
9152 effect the revealed count of PORT is incremented.
9153
e2d6569c 9154*** procedure: fdes->ports FDES
ec4ab4fd
GH
9155 Returns a list of existing ports which have FDES as an underlying
9156 file descriptor, without changing their revealed counts.
9157
e2d6569c 9158*** procedure: fdes->inport FDES
ec4ab4fd
GH
9159 Returns an existing input port which has FDES as its underlying
9160 file descriptor, if one exists, and increments its revealed count.
9161 Otherwise, returns a new input port with a revealed count of 1.
9162
e2d6569c 9163*** procedure: fdes->outport FDES
ec4ab4fd
GH
9164 Returns an existing output port which has FDES as its underlying
9165 file descriptor, if one exists, and increments its revealed count.
9166 Otherwise, returns a new output port with a revealed count of 1.
9167
9168 The next group of procedures perform a `dup2' system call, if NEWFD
9169(an integer) is supplied, otherwise a `dup'. The file descriptor to be
9170duplicated can be supplied as an integer or contained in a port. The
64d01d13
GH
9171type of value returned varies depending on which procedure is used.
9172
ec4ab4fd
GH
9173 All procedures also have the side effect when performing `dup2' that
9174any ports using NEWFD are moved to a different file descriptor and have
64d01d13
GH
9175their revealed counts set to zero.
9176
e2d6569c 9177*** procedure: dup->fdes PORT/FD [NEWFD]
ec4ab4fd 9178 Returns an integer file descriptor.
64d01d13 9179
e2d6569c 9180*** procedure: dup->inport PORT/FD [NEWFD]
ec4ab4fd 9181 Returns a new input port using the new file descriptor.
64d01d13 9182
e2d6569c 9183*** procedure: dup->outport PORT/FD [NEWFD]
ec4ab4fd 9184 Returns a new output port using the new file descriptor.
64d01d13 9185
e2d6569c 9186*** procedure: dup PORT/FD [NEWFD]
ec4ab4fd
GH
9187 Returns a new port if PORT/FD is a port, with the same mode as the
9188 supplied port, otherwise returns an integer file descriptor.
64d01d13 9189
e2d6569c 9190*** procedure: dup->port PORT/FD MODE [NEWFD]
ec4ab4fd
GH
9191 Returns a new port using the new file descriptor. MODE supplies a
9192 mode string for the port (*note open-file: File Ports.).
64d01d13 9193
e2d6569c 9194*** procedure: setenv NAME VALUE
ec4ab4fd
GH
9195 Modifies the environment of the current process, which is also the
9196 default environment inherited by child processes.
64d01d13 9197
ec4ab4fd
GH
9198 If VALUE is `#f', then NAME is removed from the environment.
9199 Otherwise, the string NAME=VALUE is added to the environment,
9200 replacing any existing string with name matching NAME.
64d01d13 9201
ec4ab4fd 9202 The return value is unspecified.
956055a9 9203
e2d6569c 9204*** procedure: truncate-file OBJ SIZE
6afcd3b2
GH
9205 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
9206 can be a string containing a file name or an integer file
9207 descriptor or port open for output on the file. The underlying
9208 system calls are `truncate' and `ftruncate'.
9209
9210 The return value is unspecified.
9211
e2d6569c 9212*** procedure: setvbuf PORT MODE [SIZE]
7a6f1ffa
GH
9213 Set the buffering mode for PORT. MODE can be:
9214 `_IONBF'
9215 non-buffered
9216
9217 `_IOLBF'
9218 line buffered
9219
9220 `_IOFBF'
9221 block buffered, using a newly allocated buffer of SIZE bytes.
9222 However if SIZE is zero or unspecified, the port will be made
9223 non-buffered.
9224
9225 This procedure should not be used after I/O has been performed with
9226 the port.
9227
9228 Ports are usually block buffered by default, with a default buffer
9229 size. Procedures e.g., *Note open-file: File Ports, which accept a
9230 mode string allow `0' to be added to request an unbuffered port.
9231
e2d6569c 9232*** procedure: fsync PORT/FD
6afcd3b2
GH
9233 Copies any unwritten data for the specified output file descriptor
9234 to disk. If PORT/FD is a port, its buffer is flushed before the
9235 underlying file descriptor is fsync'd. The return value is
9236 unspecified.
9237
e2d6569c 9238*** procedure: open-fdes PATH FLAGS [MODES]
6afcd3b2
GH
9239 Similar to `open' but returns a file descriptor instead of a port.
9240
e2d6569c 9241*** procedure: execle PATH ENV [ARG] ...
6afcd3b2
GH
9242 Similar to `execl', but the environment of the new process is
9243 specified by ENV, which must be a list of strings as returned by
9244 the `environ' procedure.
9245
9246 This procedure is currently implemented using the `execve' system
9247 call, but we call it `execle' because of its Scheme calling
9248 interface.
9249
e2d6569c 9250*** procedure: strerror ERRNO
ec4ab4fd
GH
9251 Returns the Unix error message corresponding to ERRNO, an integer.
9252
e2d6569c 9253*** procedure: primitive-exit [STATUS]
6afcd3b2
GH
9254 Terminate the current process without unwinding the Scheme stack.
9255 This is would typically be useful after a fork. The exit status
9256 is STATUS if supplied, otherwise zero.
9257
e2d6569c 9258*** procedure: times
6afcd3b2
GH
9259 Returns an object with information about real and processor time.
9260 The following procedures accept such an object as an argument and
9261 return a selected component:
9262
9263 `tms:clock'
9264 The current real time, expressed as time units relative to an
9265 arbitrary base.
9266
9267 `tms:utime'
9268 The CPU time units used by the calling process.
9269
9270 `tms:stime'
9271 The CPU time units used by the system on behalf of the
9272 calling process.
9273
9274 `tms:cutime'
9275 The CPU time units used by terminated child processes of the
9276 calling process, whose status has been collected (e.g., using
9277 `waitpid').
9278
9279 `tms:cstime'
9280 Similarly, the CPU times units used by the system on behalf of
9281 terminated child processes.
7ad3c1e7 9282
e2d6569c
JB
9283** Removed: list-length
9284** Removed: list-append, list-append!
9285** Removed: list-reverse, list-reverse!
9286
9287** array-map renamed to array-map!
9288
9289** serial-array-map renamed to serial-array-map!
9290
660f41fa
MD
9291** catch doesn't take #f as first argument any longer
9292
9293Previously, it was possible to pass #f instead of a key to `catch'.
9294That would cause `catch' to pass a jump buffer object to the procedure
9295passed as second argument. The procedure could then use this jump
9296buffer objekt as an argument to throw.
9297
9298This mechanism has been removed since its utility doesn't motivate the
9299extra complexity it introduces.
9300
332d00f6
JB
9301** The `#/' notation for lists now provokes a warning message from Guile.
9302This syntax will be removed from Guile in the near future.
9303
9304To disable the warning message, set the GUILE_HUSH environment
9305variable to any non-empty value.
9306
8cd57bd0
JB
9307** The newline character now prints as `#\newline', following the
9308normal Scheme notation, not `#\nl'.
9309
c484bf7f
JB
9310* Changes to the gh_ interface
9311
8986901b
JB
9312** The gh_enter function now takes care of loading the Guile startup files.
9313gh_enter works by calling scm_boot_guile; see the remarks below.
9314
5424b4f7
MD
9315** Function: void gh_write (SCM x)
9316
9317Write the printed representation of the scheme object x to the current
9318output port. Corresponds to the scheme level `write'.
9319
3a97e020
MD
9320** gh_list_length renamed to gh_length.
9321
8d6787b6
MG
9322** vector handling routines
9323
9324Several major changes. In particular, gh_vector() now resembles
9325(vector ...) (with a caveat -- see manual), and gh_make_vector() now
956328d2
MG
9326exists and behaves like (make-vector ...). gh_vset() and gh_vref()
9327have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
8d6787b6
MG
9328vector-related gh_ functions have been implemented.
9329
7fee59bd
MG
9330** pair and list routines
9331
9332Implemented several of the R4RS pair and list functions that were
9333missing.
9334
171422a9
MD
9335** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
9336
9337New function. Converts double arrays back and forth between Scheme
9338and C.
9339
c484bf7f
JB
9340* Changes to the scm_ interface
9341
8986901b
JB
9342** The function scm_boot_guile now takes care of loading the startup files.
9343
9344Guile's primary initialization function, scm_boot_guile, now takes
9345care of loading `boot-9.scm', in the `ice-9' module, to initialize
9346Guile, define the module system, and put together some standard
9347bindings. It also loads `init.scm', which is intended to hold
9348site-specific initialization code.
9349
9350Since Guile cannot operate properly until boot-9.scm is loaded, there
9351is no reason to separate loading boot-9.scm from Guile's other
9352initialization processes.
9353
9354This job used to be done by scm_compile_shell_switches, which didn't
9355make much sense; in particular, it meant that people using Guile for
9356non-shell-like applications had to jump through hoops to get Guile
9357initialized properly.
9358
9359** The function scm_compile_shell_switches no longer loads the startup files.
9360Now, Guile always loads the startup files, whenever it is initialized;
9361see the notes above for scm_boot_guile and scm_load_startup_files.
9362
9363** Function: scm_load_startup_files
9364This new function takes care of loading Guile's initialization file
9365(`boot-9.scm'), and the site initialization file, `init.scm'. Since
9366this is always called by the Guile initialization process, it's
9367probably not too useful to call this yourself, but it's there anyway.
9368
87148d9e
JB
9369** The semantics of smob marking have changed slightly.
9370
9371The smob marking function (the `mark' member of the scm_smobfuns
9372structure) is no longer responsible for setting the mark bit on the
9373smob. The generic smob handling code in the garbage collector will
9374set this bit. The mark function need only ensure that any other
9375objects the smob refers to get marked.
9376
9377Note that this change means that the smob's GC8MARK bit is typically
9378already set upon entry to the mark function. Thus, marking functions
9379which look like this:
9380
9381 {
9382 if (SCM_GC8MARKP (ptr))
9383 return SCM_BOOL_F;
9384 SCM_SETGC8MARK (ptr);
9385 ... mark objects to which the smob refers ...
9386 }
9387
9388are now incorrect, since they will return early, and fail to mark any
9389other objects the smob refers to. Some code in the Guile library used
9390to work this way.
9391
1cf84ea5
JB
9392** The semantics of the I/O port functions in scm_ptobfuns have changed.
9393
9394If you have implemented your own I/O port type, by writing the
9395functions required by the scm_ptobfuns and then calling scm_newptob,
9396you will need to change your functions slightly.
9397
9398The functions in a scm_ptobfuns structure now expect the port itself
9399as their argument; they used to expect the `stream' member of the
9400port's scm_port_table structure. This allows functions in an
9401scm_ptobfuns structure to easily access the port's cell (and any flags
9402it its CAR), and the port's scm_port_table structure.
9403
9404Guile now passes the I/O port itself as the `port' argument in the
9405following scm_ptobfuns functions:
9406
9407 int (*free) (SCM port);
9408 int (*fputc) (int, SCM port);
9409 int (*fputs) (char *, SCM port);
9410 scm_sizet (*fwrite) SCM_P ((char *ptr,
9411 scm_sizet size,
9412 scm_sizet nitems,
9413 SCM port));
9414 int (*fflush) (SCM port);
9415 int (*fgetc) (SCM port);
9416 int (*fclose) (SCM port);
9417
9418The interfaces to the `mark', `print', `equalp', and `fgets' methods
9419are unchanged.
9420
9421If you have existing code which defines its own port types, it is easy
9422to convert your code to the new interface; simply apply SCM_STREAM to
9423the port argument to yield the value you code used to expect.
9424
9425Note that since both the port and the stream have the same type in the
9426C code --- they are both SCM values --- the C compiler will not remind
9427you if you forget to update your scm_ptobfuns functions.
9428
9429
933a7411
MD
9430** Function: int scm_internal_select (int fds,
9431 SELECT_TYPE *rfds,
9432 SELECT_TYPE *wfds,
9433 SELECT_TYPE *efds,
9434 struct timeval *timeout);
9435
9436This is a replacement for the `select' function provided by the OS.
9437It enables I/O blocking and sleeping to happen for one cooperative
9438thread without blocking other threads. It also avoids busy-loops in
9439these situations. It is intended that all I/O blocking and sleeping
9440will finally go through this function. Currently, this function is
9441only available on systems providing `gettimeofday' and `select'.
9442
5424b4f7
MD
9443** Function: SCM scm_internal_stack_catch (SCM tag,
9444 scm_catch_body_t body,
9445 void *body_data,
9446 scm_catch_handler_t handler,
9447 void *handler_data)
9448
9449A new sibling to the other two C level `catch' functions
9450scm_internal_catch and scm_internal_lazy_catch. Use it if you want
9451the stack to be saved automatically into the variable `the-last-stack'
9452(scm_the_last_stack_var) on error. This is necessary if you want to
9453use advanced error reporting, such as calling scm_display_error and
9454scm_display_backtrace. (They both take a stack object as argument.)
9455
df366c26
MD
9456** Function: SCM scm_spawn_thread (scm_catch_body_t body,
9457 void *body_data,
9458 scm_catch_handler_t handler,
9459 void *handler_data)
9460
9461Spawns a new thread. It does a job similar to
9462scm_call_with_new_thread but takes arguments more suitable when
9463spawning threads from application C code.
9464
88482b31
MD
9465** The hook scm_error_callback has been removed. It was originally
9466intended as a way for the user to install his own error handler. But
9467that method works badly since it intervenes between throw and catch,
9468thereby changing the semantics of expressions like (catch #t ...).
9469The correct way to do it is to use one of the C level catch functions
9470in throw.c: scm_internal_catch/lazy_catch/stack_catch.
9471
3a97e020
MD
9472** Removed functions:
9473
9474scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
9475scm_list_reverse, scm_list_reverse_x
9476
9477** New macros: SCM_LISTn where n is one of the integers 0-9.
9478
9479These can be used for pretty list creation from C. The idea is taken
9480from Erick Gallesio's STk.
9481
298aa6e3
MD
9482** scm_array_map renamed to scm_array_map_x
9483
527da704
MD
9484** mbstrings are now removed
9485
9486This means that the type codes scm_tc7_mb_string and
9487scm_tc7_mb_substring has been removed.
9488
8cd57bd0
JB
9489** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
9490
9491Since we no longer support multi-byte strings, these I/O functions
9492have been simplified, and renamed. Here are their old names, and
9493their new names and arguments:
9494
9495scm_gen_putc -> void scm_putc (int c, SCM port);
9496scm_gen_puts -> void scm_puts (char *s, SCM port);
9497scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
9498scm_gen_getc -> void scm_getc (SCM port);
9499
9500
527da704
MD
9501** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
9502
9503** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
9504
9505SCM_TYP7S now masks away the bit which distinguishes substrings from
9506strings.
9507
660f41fa
MD
9508** scm_catch_body_t: Backward incompatible change!
9509
9510Body functions to scm_internal_catch and friends do not any longer
9511take a second argument. This is because it is no longer possible to
9512pass a #f arg to catch.
9513
a8e05009
JB
9514** Calls to scm_protect_object and scm_unprotect now nest properly.
9515
9516The function scm_protect_object protects its argument from being freed
9517by the garbage collector. scm_unprotect_object removes that
9518protection.
9519
9520These functions now nest properly. That is, for every object O, there
9521is a counter which scm_protect_object(O) increments and
9522scm_unprotect_object(O) decrements, if the counter is greater than
9523zero. Every object's counter is zero when it is first created. If an
9524object's counter is greater than zero, the garbage collector will not
9525reclaim its storage.
9526
9527This allows you to use scm_protect_object in your code without
9528worrying that some other function you call will call
9529scm_unprotect_object, and allow it to be freed. Assuming that the
9530functions you call are well-behaved, and unprotect only those objects
9531they protect, you can follow the same rule and have confidence that
9532objects will be freed only at appropriate times.
9533
c484bf7f
JB
9534\f
9535Changes in Guile 1.2 (released Tuesday, June 24 1997):
cf78e9e8 9536
737c9113
JB
9537* Changes to the distribution
9538
832b09ed
JB
9539** Nightly snapshots are now available from ftp.red-bean.com.
9540The old server, ftp.cyclic.com, has been relinquished to its rightful
9541owner.
9542
9543Nightly snapshots of the Guile development sources are now available via
9544anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
9545
9546Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
9547For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
9548
0fcab5ed
JB
9549** To run Guile without installing it, the procedure has changed a bit.
9550
9551If you used a separate build directory to compile Guile, you'll need
9552to include the build directory in SCHEME_LOAD_PATH, as well as the
9553source directory. See the `INSTALL' file for examples.
9554
737c9113
JB
9555* Changes to the procedure for linking libguile with your programs
9556
94982a4e
JB
9557** The standard Guile load path for Scheme code now includes
9558$(datadir)/guile (usually /usr/local/share/guile). This means that
9559you can install your own Scheme files there, and Guile will find them.
9560(Previous versions of Guile only checked a directory whose name
9561contained the Guile version number, so you had to re-install or move
9562your Scheme sources each time you installed a fresh version of Guile.)
9563
9564The load path also includes $(datadir)/guile/site; we recommend
9565putting individual Scheme files there. If you want to install a
9566package with multiple source files, create a directory for them under
9567$(datadir)/guile.
9568
9569** Guile 1.2 will now use the Rx regular expression library, if it is
9570installed on your system. When you are linking libguile into your own
9571programs, this means you will have to link against -lguile, -lqt (if
9572you configured Guile with thread support), and -lrx.
27590f82
JB
9573
9574If you are using autoconf to generate configuration scripts for your
9575application, the following lines should suffice to add the appropriate
9576libraries to your link command:
9577
9578### Find Rx, quickthreads and libguile.
9579AC_CHECK_LIB(rx, main)
9580AC_CHECK_LIB(qt, main)
9581AC_CHECK_LIB(guile, scm_shell)
9582
94982a4e
JB
9583The Guile 1.2 distribution does not contain sources for the Rx
9584library, as Guile 1.0 did. If you want to use Rx, you'll need to
9585retrieve it from a GNU FTP site and install it separately.
9586
b83b8bee
JB
9587* Changes to Scheme functions and syntax
9588
e035e7e6
MV
9589** The dynamic linking features of Guile are now enabled by default.
9590You can disable them by giving the `--disable-dynamic-linking' option
9591to configure.
9592
e035e7e6
MV
9593 (dynamic-link FILENAME)
9594
9595 Find the object file denoted by FILENAME (a string) and link it
9596 into the running Guile application. When everything works out,
9597 return a Scheme object suitable for representing the linked object
9598 file. Otherwise an error is thrown. How object files are
9599 searched is system dependent.
9600
9601 (dynamic-object? VAL)
9602
9603 Determine whether VAL represents a dynamically linked object file.
9604
9605 (dynamic-unlink DYNOBJ)
9606
9607 Unlink the indicated object file from the application. DYNOBJ
9608 should be one of the values returned by `dynamic-link'.
9609
9610 (dynamic-func FUNCTION DYNOBJ)
9611
9612 Search the C function indicated by FUNCTION (a string or symbol)
9613 in DYNOBJ and return some Scheme object that can later be used
9614 with `dynamic-call' to actually call this function. Right now,
9615 these Scheme objects are formed by casting the address of the
9616 function to `long' and converting this number to its Scheme
9617 representation.
9618
9619 (dynamic-call FUNCTION DYNOBJ)
9620
9621 Call the C function indicated by FUNCTION and DYNOBJ. The
9622 function is passed no arguments and its return value is ignored.
9623 When FUNCTION is something returned by `dynamic-func', call that
9624 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
9625 etc.), look it up in DYNOBJ; this is equivalent to
9626
9627 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
9628
9629 Interrupts are deferred while the C function is executing (with
9630 SCM_DEFER_INTS/SCM_ALLOW_INTS).
9631
9632 (dynamic-args-call FUNCTION DYNOBJ ARGS)
9633
9634 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
9635 some arguments and return its return value. The C function is
9636 expected to take two arguments and return an `int', just like
9637 `main':
9638
9639 int c_func (int argc, char **argv);
9640
9641 ARGS must be a list of strings and is converted into an array of
9642 `char *'. The array is passed in ARGV and its size in ARGC. The
9643 return value is converted to a Scheme number and returned from the
9644 call to `dynamic-args-call'.
9645
0fcab5ed
JB
9646When dynamic linking is disabled or not supported on your system,
9647the above functions throw errors, but they are still available.
9648
e035e7e6
MV
9649Here is a small example that works on GNU/Linux:
9650
9651 (define libc-obj (dynamic-link "libc.so"))
9652 (dynamic-args-call 'rand libc-obj '())
9653
9654See the file `libguile/DYNAMIC-LINKING' for additional comments.
9655
27590f82 9656** The #/ syntax for module names is depreciated, and will be removed
6c0201ad 9657in a future version of Guile. Instead of
27590f82
JB
9658
9659 #/foo/bar/baz
9660
9661instead write
9662
9663 (foo bar baz)
9664
9665The latter syntax is more consistent with existing Lisp practice.
9666
5dade857
MV
9667** Guile now does fancier printing of structures. Structures are the
9668underlying implementation for records, which in turn are used to
9669implement modules, so all of these object now print differently and in
9670a more informative way.
9671
161029df
JB
9672The Scheme printer will examine the builtin variable *struct-printer*
9673whenever it needs to print a structure object. When this variable is
9674not `#f' it is deemed to be a procedure and will be applied to the
9675structure object and the output port. When *struct-printer* is `#f'
9676or the procedure return `#f' the structure object will be printed in
9677the boring #<struct 80458270> form.
5dade857
MV
9678
9679This hook is used by some routines in ice-9/boot-9.scm to implement
9680type specific printing routines. Please read the comments there about
9681"printing structs".
9682
9683One of the more specific uses of structs are records. The printing
9684procedure that could be passed to MAKE-RECORD-TYPE is now actually
9685called. It should behave like a *struct-printer* procedure (described
9686above).
9687
b83b8bee
JB
9688** Guile now supports a new R4RS-compliant syntax for keywords. A
9689token of the form #:NAME, where NAME has the same syntax as a Scheme
9690symbol, is the external representation of the keyword named NAME.
9691Keyword objects print using this syntax as well, so values containing
1e5afba0
JB
9692keyword objects can be read back into Guile. When used in an
9693expression, keywords are self-quoting objects.
b83b8bee
JB
9694
9695Guile suports this read syntax, and uses this print syntax, regardless
9696of the current setting of the `keyword' read option. The `keyword'
9697read option only controls whether Guile recognizes the `:NAME' syntax,
9698which is incompatible with R4RS. (R4RS says such token represent
9699symbols.)
737c9113
JB
9700
9701** Guile has regular expression support again. Guile 1.0 included
9702functions for matching regular expressions, based on the Rx library.
9703In Guile 1.1, the Guile/Rx interface was removed to simplify the
9704distribution, and thus Guile had no regular expression support. Guile
94982a4e
JB
97051.2 again supports the most commonly used functions, and supports all
9706of SCSH's regular expression functions.
2409cdfa 9707
94982a4e
JB
9708If your system does not include a POSIX regular expression library,
9709and you have not linked Guile with a third-party regexp library such as
9710Rx, these functions will not be available. You can tell whether your
9711Guile installation includes regular expression support by checking
9712whether the `*features*' list includes the `regex' symbol.
737c9113 9713
94982a4e 9714*** regexp functions
161029df 9715
94982a4e
JB
9716By default, Guile supports POSIX extended regular expressions. That
9717means that the characters `(', `)', `+' and `?' are special, and must
9718be escaped if you wish to match the literal characters.
e1a191a8 9719
94982a4e
JB
9720This regular expression interface was modeled after that implemented
9721by SCSH, the Scheme Shell. It is intended to be upwardly compatible
9722with SCSH regular expressions.
9723
9724**** Function: string-match PATTERN STR [START]
9725 Compile the string PATTERN into a regular expression and compare
9726 it with STR. The optional numeric argument START specifies the
9727 position of STR at which to begin matching.
9728
9729 `string-match' returns a "match structure" which describes what,
9730 if anything, was matched by the regular expression. *Note Match
9731 Structures::. If STR does not match PATTERN at all,
9732 `string-match' returns `#f'.
9733
9734 Each time `string-match' is called, it must compile its PATTERN
9735argument into a regular expression structure. This operation is
9736expensive, which makes `string-match' inefficient if the same regular
9737expression is used several times (for example, in a loop). For better
9738performance, you can compile a regular expression in advance and then
9739match strings against the compiled regexp.
9740
9741**** Function: make-regexp STR [FLAGS]
9742 Compile the regular expression described by STR, and return the
9743 compiled regexp structure. If STR does not describe a legal
9744 regular expression, `make-regexp' throws a
9745 `regular-expression-syntax' error.
9746
9747 FLAGS may be the bitwise-or of one or more of the following:
9748
9749**** Constant: regexp/extended
9750 Use POSIX Extended Regular Expression syntax when interpreting
9751 STR. If not set, POSIX Basic Regular Expression syntax is used.
9752 If the FLAGS argument is omitted, we assume regexp/extended.
9753
9754**** Constant: regexp/icase
9755 Do not differentiate case. Subsequent searches using the
9756 returned regular expression will be case insensitive.
9757
9758**** Constant: regexp/newline
9759 Match-any-character operators don't match a newline.
9760
9761 A non-matching list ([^...]) not containing a newline matches a
9762 newline.
9763
9764 Match-beginning-of-line operator (^) matches the empty string
9765 immediately after a newline, regardless of whether the FLAGS
9766 passed to regexp-exec contain regexp/notbol.
9767
9768 Match-end-of-line operator ($) matches the empty string
9769 immediately before a newline, regardless of whether the FLAGS
9770 passed to regexp-exec contain regexp/noteol.
9771
9772**** Function: regexp-exec REGEXP STR [START [FLAGS]]
9773 Match the compiled regular expression REGEXP against `str'. If
9774 the optional integer START argument is provided, begin matching
9775 from that position in the string. Return a match structure
9776 describing the results of the match, or `#f' if no match could be
9777 found.
9778
9779 FLAGS may be the bitwise-or of one or more of the following:
9780
9781**** Constant: regexp/notbol
9782 The match-beginning-of-line operator always fails to match (but
9783 see the compilation flag regexp/newline above) This flag may be
9784 used when different portions of a string are passed to
9785 regexp-exec and the beginning of the string should not be
9786 interpreted as the beginning of the line.
9787
9788**** Constant: regexp/noteol
9789 The match-end-of-line operator always fails to match (but see the
9790 compilation flag regexp/newline above)
9791
9792**** Function: regexp? OBJ
9793 Return `#t' if OBJ is a compiled regular expression, or `#f'
9794 otherwise.
9795
9796 Regular expressions are commonly used to find patterns in one string
9797and replace them with the contents of another string.
9798
9799**** Function: regexp-substitute PORT MATCH [ITEM...]
9800 Write to the output port PORT selected contents of the match
9801 structure MATCH. Each ITEM specifies what should be written, and
9802 may be one of the following arguments:
9803
9804 * A string. String arguments are written out verbatim.
9805
9806 * An integer. The submatch with that number is written.
9807
9808 * The symbol `pre'. The portion of the matched string preceding
9809 the regexp match is written.
9810
9811 * The symbol `post'. The portion of the matched string
9812 following the regexp match is written.
9813
9814 PORT may be `#f', in which case nothing is written; instead,
9815 `regexp-substitute' constructs a string from the specified ITEMs
9816 and returns that.
9817
9818**** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
9819 Similar to `regexp-substitute', but can be used to perform global
9820 substitutions on STR. Instead of taking a match structure as an
9821 argument, `regexp-substitute/global' takes two string arguments: a
9822 REGEXP string describing a regular expression, and a TARGET string
9823 which should be matched against this regular expression.
9824
9825 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
9826 exceptions:
9827
9828 * A function may be supplied. When this function is called, it
9829 will be passed one argument: a match structure for a given
9830 regular expression match. It should return a string to be
9831 written out to PORT.
9832
9833 * The `post' symbol causes `regexp-substitute/global' to recurse
9834 on the unmatched portion of STR. This *must* be supplied in
9835 order to perform global search-and-replace on STR; if it is
9836 not present among the ITEMs, then `regexp-substitute/global'
9837 will return after processing a single match.
9838
9839*** Match Structures
9840
9841 A "match structure" is the object returned by `string-match' and
9842`regexp-exec'. It describes which portion of a string, if any, matched
9843the given regular expression. Match structures include: a reference to
9844the string that was checked for matches; the starting and ending
9845positions of the regexp match; and, if the regexp included any
9846parenthesized subexpressions, the starting and ending positions of each
9847submatch.
9848
9849 In each of the regexp match functions described below, the `match'
9850argument must be a match structure returned by a previous call to
9851`string-match' or `regexp-exec'. Most of these functions return some
9852information about the original target string that was matched against a
9853regular expression; we will call that string TARGET for easy reference.
9854
9855**** Function: regexp-match? OBJ
9856 Return `#t' if OBJ is a match structure returned by a previous
9857 call to `regexp-exec', or `#f' otherwise.
9858
9859**** Function: match:substring MATCH [N]
9860 Return the portion of TARGET matched by subexpression number N.
9861 Submatch 0 (the default) represents the entire regexp match. If
9862 the regular expression as a whole matched, but the subexpression
9863 number N did not match, return `#f'.
9864
9865**** Function: match:start MATCH [N]
9866 Return the starting position of submatch number N.
9867
9868**** Function: match:end MATCH [N]
9869 Return the ending position of submatch number N.
9870
9871**** Function: match:prefix MATCH
9872 Return the unmatched portion of TARGET preceding the regexp match.
9873
9874**** Function: match:suffix MATCH
9875 Return the unmatched portion of TARGET following the regexp match.
9876
9877**** Function: match:count MATCH
9878 Return the number of parenthesized subexpressions from MATCH.
9879 Note that the entire regular expression match itself counts as a
9880 subexpression, and failed submatches are included in the count.
9881
9882**** Function: match:string MATCH
9883 Return the original TARGET string.
9884
9885*** Backslash Escapes
9886
9887 Sometimes you will want a regexp to match characters like `*' or `$'
9888exactly. For example, to check whether a particular string represents
9889a menu entry from an Info node, it would be useful to match it against
9890a regexp like `^* [^:]*::'. However, this won't work; because the
9891asterisk is a metacharacter, it won't match the `*' at the beginning of
9892the string. In this case, we want to make the first asterisk un-magic.
9893
9894 You can do this by preceding the metacharacter with a backslash
9895character `\'. (This is also called "quoting" the metacharacter, and
9896is known as a "backslash escape".) When Guile sees a backslash in a
9897regular expression, it considers the following glyph to be an ordinary
9898character, no matter what special meaning it would ordinarily have.
9899Therefore, we can make the above example work by changing the regexp to
9900`^\* [^:]*::'. The `\*' sequence tells the regular expression engine
9901to match only a single asterisk in the target string.
9902
9903 Since the backslash is itself a metacharacter, you may force a
9904regexp to match a backslash in the target string by preceding the
9905backslash with itself. For example, to find variable references in a
9906TeX program, you might want to find occurrences of the string `\let\'
9907followed by any number of alphabetic characters. The regular expression
9908`\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
9909each match a single backslash in the target string.
9910
9911**** Function: regexp-quote STR
9912 Quote each special character found in STR with a backslash, and
9913 return the resulting string.
9914
9915 *Very important:* Using backslash escapes in Guile source code (as
9916in Emacs Lisp or C) can be tricky, because the backslash character has
9917special meaning for the Guile reader. For example, if Guile encounters
9918the character sequence `\n' in the middle of a string while processing
9919Scheme code, it replaces those characters with a newline character.
9920Similarly, the character sequence `\t' is replaced by a horizontal tab.
9921Several of these "escape sequences" are processed by the Guile reader
9922before your code is executed. Unrecognized escape sequences are
9923ignored: if the characters `\*' appear in a string, they will be
9924translated to the single character `*'.
9925
9926 This translation is obviously undesirable for regular expressions,
9927since we want to be able to include backslashes in a string in order to
9928escape regexp metacharacters. Therefore, to make sure that a backslash
9929is preserved in a string in your Guile program, you must use *two*
9930consecutive backslashes:
9931
9932 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
9933
9934 The string in this example is preprocessed by the Guile reader before
9935any code is executed. The resulting argument to `make-regexp' is the
9936string `^\* [^:]*', which is what we really want.
9937
9938 This also means that in order to write a regular expression that
9939matches a single backslash character, the regular expression string in
9940the source code must include *four* backslashes. Each consecutive pair
9941of backslashes gets translated by the Guile reader to a single
9942backslash, and the resulting double-backslash is interpreted by the
9943regexp engine as matching a single backslash character. Hence:
9944
9945 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
9946
9947 The reason for the unwieldiness of this syntax is historical. Both
9948regular expression pattern matchers and Unix string processing systems
9949have traditionally used backslashes with the special meanings described
9950above. The POSIX regular expression specification and ANSI C standard
9951both require these semantics. Attempting to abandon either convention
9952would cause other kinds of compatibility problems, possibly more severe
9953ones. Therefore, without extending the Scheme reader to support
9954strings with different quoting conventions (an ungainly and confusing
9955extension when implemented in other languages), we must adhere to this
9956cumbersome escape syntax.
9957
7ad3c1e7
GH
9958* Changes to the gh_ interface
9959
9960* Changes to the scm_ interface
9961
9962* Changes to system call interfaces:
94982a4e 9963
7ad3c1e7 9964** The value returned by `raise' is now unspecified. It throws an exception
e1a191a8
GH
9965if an error occurs.
9966
94982a4e 9967*** A new procedure `sigaction' can be used to install signal handlers
115b09a5
GH
9968
9969(sigaction signum [action] [flags])
9970
9971signum is the signal number, which can be specified using the value
9972of SIGINT etc.
9973
9974If action is omitted, sigaction returns a pair: the CAR is the current
9975signal hander, which will be either an integer with the value SIG_DFL
9976(default action) or SIG_IGN (ignore), or the Scheme procedure which
9977handles the signal, or #f if a non-Scheme procedure handles the
9978signal. The CDR contains the current sigaction flags for the handler.
9979
9980If action is provided, it is installed as the new handler for signum.
9981action can be a Scheme procedure taking one argument, or the value of
9982SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
9983whatever signal handler was installed before sigaction was first used.
9984Flags can optionally be specified for the new handler (SA_RESTART is
9985always used if the system provides it, so need not be specified.) The
9986return value is a pair with information about the old handler as
9987described above.
9988
9989This interface does not provide access to the "signal blocking"
9990facility. Maybe this is not needed, since the thread support may
9991provide solutions to the problem of consistent access to data
9992structures.
e1a191a8 9993
94982a4e 9994*** A new procedure `flush-all-ports' is equivalent to running
89ea5b7c
GH
9995`force-output' on every port open for output.
9996
94982a4e
JB
9997** Guile now provides information on how it was built, via the new
9998global variable, %guile-build-info. This variable records the values
9999of the standard GNU makefile directory variables as an assocation
10000list, mapping variable names (symbols) onto directory paths (strings).
10001For example, to find out where the Guile link libraries were
10002installed, you can say:
10003
10004guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
10005
10006
10007* Changes to the scm_ interface
10008
10009** The new function scm_handle_by_message_noexit is just like the
10010existing scm_handle_by_message function, except that it doesn't call
10011exit to terminate the process. Instead, it prints a message and just
10012returns #f. This might be a more appropriate catch-all handler for
10013new dynamic roots and threads.
10014
cf78e9e8 10015\f
c484bf7f 10016Changes in Guile 1.1 (released Friday, May 16 1997):
f3b1485f
JB
10017
10018* Changes to the distribution.
10019
10020The Guile 1.0 distribution has been split up into several smaller
10021pieces:
10022guile-core --- the Guile interpreter itself.
10023guile-tcltk --- the interface between the Guile interpreter and
10024 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
10025 is a toolkit for building graphical user interfaces.
10026guile-rgx-ctax --- the interface between Guile and the Rx regular
10027 expression matcher, and the translator for the Ctax
10028 programming language. These are packaged together because the
10029 Ctax translator uses Rx to parse Ctax source code.
10030
095936d2
JB
10031This NEWS file describes the changes made to guile-core since the 1.0
10032release.
10033
48d224d7
JB
10034We no longer distribute the documentation, since it was either out of
10035date, or incomplete. As soon as we have current documentation, we
10036will distribute it.
10037
0fcab5ed
JB
10038
10039
f3b1485f
JB
10040* Changes to the stand-alone interpreter
10041
48d224d7
JB
10042** guile now accepts command-line arguments compatible with SCSH, Olin
10043Shivers' Scheme Shell.
10044
10045In general, arguments are evaluated from left to right, but there are
10046exceptions. The following switches stop argument processing, and
10047stash all remaining command-line arguments as the value returned by
10048the (command-line) function.
10049 -s SCRIPT load Scheme source code from FILE, and exit
10050 -c EXPR evalute Scheme expression EXPR, and exit
10051 -- stop scanning arguments; run interactively
10052
10053The switches below are processed as they are encountered.
10054 -l FILE load Scheme source code from FILE
10055 -e FUNCTION after reading script, apply FUNCTION to
10056 command line arguments
10057 -ds do -s script at this point
10058 --emacs enable Emacs protocol (experimental)
10059 -h, --help display this help and exit
10060 -v, --version display version information and exit
10061 \ read arguments from following script lines
10062
10063So, for example, here is a Guile script named `ekko' (thanks, Olin)
10064which re-implements the traditional "echo" command:
10065
10066#!/usr/local/bin/guile -s
10067!#
10068(define (main args)
10069 (map (lambda (arg) (display arg) (display " "))
10070 (cdr args))
10071 (newline))
10072
10073(main (command-line))
10074
10075Suppose we invoke this script as follows:
10076
10077 ekko a speckled gecko
10078
10079Through the magic of Unix script processing (triggered by the `#!'
10080token at the top of the file), /usr/local/bin/guile receives the
10081following list of command-line arguments:
10082
10083 ("-s" "./ekko" "a" "speckled" "gecko")
10084
10085Unix inserts the name of the script after the argument specified on
10086the first line of the file (in this case, "-s"), and then follows that
10087with the arguments given to the script. Guile loads the script, which
10088defines the `main' function, and then applies it to the list of
10089remaining command-line arguments, ("a" "speckled" "gecko").
10090
095936d2
JB
10091In Unix, the first line of a script file must take the following form:
10092
10093#!INTERPRETER ARGUMENT
10094
10095where INTERPRETER is the absolute filename of the interpreter
10096executable, and ARGUMENT is a single command-line argument to pass to
10097the interpreter.
10098
10099You may only pass one argument to the interpreter, and its length is
10100limited. These restrictions can be annoying to work around, so Guile
10101provides a general mechanism (borrowed from, and compatible with,
10102SCSH) for circumventing them.
10103
10104If the ARGUMENT in a Guile script is a single backslash character,
10105`\', Guile will open the script file, parse arguments from its second
10106and subsequent lines, and replace the `\' with them. So, for example,
10107here is another implementation of the `ekko' script:
10108
10109#!/usr/local/bin/guile \
10110-e main -s
10111!#
10112(define (main args)
10113 (for-each (lambda (arg) (display arg) (display " "))
10114 (cdr args))
10115 (newline))
10116
10117If the user invokes this script as follows:
10118
10119 ekko a speckled gecko
10120
10121Unix expands this into
10122
10123 /usr/local/bin/guile \ ekko a speckled gecko
10124
10125When Guile sees the `\' argument, it replaces it with the arguments
10126read from the second line of the script, producing:
10127
10128 /usr/local/bin/guile -e main -s ekko a speckled gecko
10129
10130This tells Guile to load the `ekko' script, and apply the function
10131`main' to the argument list ("a" "speckled" "gecko").
10132
10133Here is how Guile parses the command-line arguments:
10134- Each space character terminates an argument. This means that two
10135 spaces in a row introduce an empty-string argument.
10136- The tab character is not permitted (unless you quote it with the
10137 backslash character, as described below), to avoid confusion.
10138- The newline character terminates the sequence of arguments, and will
10139 also terminate a final non-empty argument. (However, a newline
10140 following a space will not introduce a final empty-string argument;
10141 it only terminates the argument list.)
10142- The backslash character is the escape character. It escapes
10143 backslash, space, tab, and newline. The ANSI C escape sequences
10144 like \n and \t are also supported. These produce argument
10145 constituents; the two-character combination \n doesn't act like a
10146 terminating newline. The escape sequence \NNN for exactly three
10147 octal digits reads as the character whose ASCII code is NNN. As
10148 above, characters produced this way are argument constituents.
10149 Backslash followed by other characters is not allowed.
10150
48d224d7
JB
10151* Changes to the procedure for linking libguile with your programs
10152
10153** Guile now builds and installs a shared guile library, if your
10154system support shared libraries. (It still builds a static library on
10155all systems.) Guile automatically detects whether your system
10156supports shared libraries. To prevent Guile from buildisg shared
10157libraries, pass the `--disable-shared' flag to the configure script.
10158
10159Guile takes longer to compile when it builds shared libraries, because
10160it must compile every file twice --- once to produce position-
10161independent object code, and once to produce normal object code.
10162
10163** The libthreads library has been merged into libguile.
10164
10165To link a program against Guile, you now need only link against
10166-lguile and -lqt; -lthreads is no longer needed. If you are using
10167autoconf to generate configuration scripts for your application, the
10168following lines should suffice to add the appropriate libraries to
10169your link command:
10170
10171### Find quickthreads and libguile.
10172AC_CHECK_LIB(qt, main)
10173AC_CHECK_LIB(guile, scm_shell)
f3b1485f
JB
10174
10175* Changes to Scheme functions
10176
095936d2
JB
10177** Guile Scheme's special syntax for keyword objects is now optional,
10178and disabled by default.
10179
10180The syntax variation from R4RS made it difficult to port some
10181interesting packages to Guile. The routines which accepted keyword
10182arguments (mostly in the module system) have been modified to also
10183accept symbols whose names begin with `:'.
10184
10185To change the keyword syntax, you must first import the (ice-9 debug)
10186module:
10187 (use-modules (ice-9 debug))
10188
10189Then you can enable the keyword syntax as follows:
10190 (read-set! keywords 'prefix)
10191
10192To disable keyword syntax, do this:
10193 (read-set! keywords #f)
10194
10195** Many more primitive functions accept shared substrings as
10196arguments. In the past, these functions required normal, mutable
10197strings as arguments, although they never made use of this
10198restriction.
10199
10200** The uniform array functions now operate on byte vectors. These
10201functions are `array-fill!', `serial-array-copy!', `array-copy!',
10202`serial-array-map', `array-map', `array-for-each', and
10203`array-index-map!'.
10204
10205** The new functions `trace' and `untrace' implement simple debugging
10206support for Scheme functions.
10207
10208The `trace' function accepts any number of procedures as arguments,
10209and tells the Guile interpreter to display each procedure's name and
10210arguments each time the procedure is invoked. When invoked with no
10211arguments, `trace' returns the list of procedures currently being
10212traced.
10213
10214The `untrace' function accepts any number of procedures as arguments,
10215and tells the Guile interpreter not to trace them any more. When
10216invoked with no arguments, `untrace' untraces all curretly traced
10217procedures.
10218
10219The tracing in Guile has an advantage over most other systems: we
10220don't create new procedure objects, but mark the procedure objects
10221themselves. This means that anonymous and internal procedures can be
10222traced.
10223
10224** The function `assert-repl-prompt' has been renamed to
10225`set-repl-prompt!'. It takes one argument, PROMPT.
10226- If PROMPT is #f, the Guile read-eval-print loop will not prompt.
10227- If PROMPT is a string, we use it as a prompt.
10228- If PROMPT is a procedure accepting no arguments, we call it, and
10229 display the result as a prompt.
10230- Otherwise, we display "> ".
10231
10232** The new function `eval-string' reads Scheme expressions from a
10233string and evaluates them, returning the value of the last expression
10234in the string. If the string contains no expressions, it returns an
10235unspecified value.
10236
10237** The new function `thunk?' returns true iff its argument is a
10238procedure of zero arguments.
10239
10240** `defined?' is now a builtin function, instead of syntax. This
10241means that its argument should be quoted. It returns #t iff its
10242argument is bound in the current module.
10243
10244** The new syntax `use-modules' allows you to add new modules to your
10245environment without re-typing a complete `define-module' form. It
10246accepts any number of module names as arguments, and imports their
10247public bindings into the current module.
10248
10249** The new function (module-defined? NAME MODULE) returns true iff
10250NAME, a symbol, is defined in MODULE, a module object.
10251
10252** The new function `builtin-bindings' creates and returns a hash
10253table containing copies of all the root module's bindings.
10254
10255** The new function `builtin-weak-bindings' does the same as
10256`builtin-bindings', but creates a doubly-weak hash table.
10257
10258** The `equal?' function now considers variable objects to be
10259equivalent if they have the same name and the same value.
10260
10261** The new function `command-line' returns the command-line arguments
10262given to Guile, as a list of strings.
10263
10264When using guile as a script interpreter, `command-line' returns the
10265script's arguments; those processed by the interpreter (like `-s' or
10266`-c') are omitted. (In other words, you get the normal, expected
10267behavior.) Any application that uses scm_shell to process its
10268command-line arguments gets this behavior as well.
10269
10270** The new function `load-user-init' looks for a file called `.guile'
10271in the user's home directory, and loads it if it exists. This is
10272mostly for use by the code generated by scm_compile_shell_switches,
10273but we thought it might also be useful in other circumstances.
10274
10275** The new function `log10' returns the base-10 logarithm of its
10276argument.
10277
10278** Changes to I/O functions
10279
6c0201ad 10280*** The functions `read', `primitive-load', `read-and-eval!', and
095936d2
JB
10281`primitive-load-path' no longer take optional arguments controlling
10282case insensitivity and a `#' parser.
10283
10284Case sensitivity is now controlled by a read option called
10285`case-insensitive'. The user can add new `#' syntaxes with the
10286`read-hash-extend' function (see below).
10287
10288*** The new function `read-hash-extend' allows the user to change the
10289syntax of Guile Scheme in a somewhat controlled way.
10290
10291(read-hash-extend CHAR PROC)
10292 When parsing S-expressions, if we read a `#' character followed by
10293 the character CHAR, use PROC to parse an object from the stream.
10294 If PROC is #f, remove any parsing procedure registered for CHAR.
10295
10296 The reader applies PROC to two arguments: CHAR and an input port.
10297
6c0201ad 10298*** The new functions read-delimited and read-delimited! provide a
095936d2
JB
10299general mechanism for doing delimited input on streams.
10300
10301(read-delimited DELIMS [PORT HANDLE-DELIM])
10302 Read until we encounter one of the characters in DELIMS (a string),
10303 or end-of-file. PORT is the input port to read from; it defaults to
10304 the current input port. The HANDLE-DELIM parameter determines how
10305 the terminating character is handled; it should be one of the
10306 following symbols:
10307
10308 'trim omit delimiter from result
10309 'peek leave delimiter character in input stream
10310 'concat append delimiter character to returned value
10311 'split return a pair: (RESULT . TERMINATOR)
10312
10313 HANDLE-DELIM defaults to 'peek.
10314
10315(read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
10316 A side-effecting variant of `read-delimited'.
10317
10318 The data is written into the string BUF at the indices in the
10319 half-open interval [START, END); the default interval is the whole
10320 string: START = 0 and END = (string-length BUF). The values of
10321 START and END must specify a well-defined interval in BUF, i.e.
10322 0 <= START <= END <= (string-length BUF).
10323
10324 It returns NBYTES, the number of bytes read. If the buffer filled
10325 up without a delimiter character being found, it returns #f. If the
10326 port is at EOF when the read starts, it returns the EOF object.
10327
10328 If an integer is returned (i.e., the read is successfully terminated
10329 by reading a delimiter character), then the HANDLE-DELIM parameter
10330 determines how to handle the terminating character. It is described
10331 above, and defaults to 'peek.
10332
10333(The descriptions of these functions were borrowed from the SCSH
10334manual, by Olin Shivers and Brian Carlstrom.)
10335
10336*** The `%read-delimited!' function is the primitive used to implement
10337`read-delimited' and `read-delimited!'.
10338
10339(%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
10340
10341This returns a pair of values: (TERMINATOR . NUM-READ).
10342- TERMINATOR describes why the read was terminated. If it is a
10343 character or the eof object, then that is the value that terminated
10344 the read. If it is #f, the function filled the buffer without finding
10345 a delimiting character.
10346- NUM-READ is the number of characters read into BUF.
10347
10348If the read is successfully terminated by reading a delimiter
10349character, then the gobble? parameter determines what to do with the
10350terminating character. If true, the character is removed from the
10351input stream; if false, the character is left in the input stream
10352where a subsequent read operation will retrieve it. In either case,
10353the character is also the first value returned by the procedure call.
10354
10355(The descriptions of this function was borrowed from the SCSH manual,
10356by Olin Shivers and Brian Carlstrom.)
10357
10358*** The `read-line' and `read-line!' functions have changed; they now
10359trim the terminator by default; previously they appended it to the
10360returned string. For the old behavior, use (read-line PORT 'concat).
10361
10362*** The functions `uniform-array-read!' and `uniform-array-write!' now
10363take new optional START and END arguments, specifying the region of
10364the array to read and write.
10365
f348c807
JB
10366*** The `ungetc-char-ready?' function has been removed. We feel it's
10367inappropriate for an interface to expose implementation details this
10368way.
095936d2
JB
10369
10370** Changes to the Unix library and system call interface
10371
10372*** The new fcntl function provides access to the Unix `fcntl' system
10373call.
10374
10375(fcntl PORT COMMAND VALUE)
10376 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
10377 Values for COMMAND are:
10378
10379 F_DUPFD duplicate a file descriptor
10380 F_GETFD read the descriptor's close-on-exec flag
10381 F_SETFD set the descriptor's close-on-exec flag to VALUE
10382 F_GETFL read the descriptor's flags, as set on open
10383 F_SETFL set the descriptor's flags, as set on open to VALUE
10384 F_GETOWN return the process ID of a socket's owner, for SIGIO
10385 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
10386 FD_CLOEXEC not sure what this is
10387
10388For details, see the documentation for the fcntl system call.
10389
10390*** The arguments to `select' have changed, for compatibility with
10391SCSH. The TIMEOUT parameter may now be non-integral, yielding the
10392expected behavior. The MILLISECONDS parameter has been changed to
10393MICROSECONDS, to more closely resemble the underlying system call.
10394The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
10395corresponding return set will be the same.
10396
10397*** The arguments to the `mknod' system call have changed. They are
10398now:
10399
10400(mknod PATH TYPE PERMS DEV)
10401 Create a new file (`node') in the file system. PATH is the name of
10402 the file to create. TYPE is the kind of file to create; it should
10403 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
10404 permission bits to give the newly created file. If TYPE is
10405 'block-special or 'char-special, DEV specifies which device the
10406 special file refers to; its interpretation depends on the kind of
10407 special file being created.
10408
10409*** The `fork' function has been renamed to `primitive-fork', to avoid
10410clashing with various SCSH forks.
10411
10412*** The `recv' and `recvfrom' functions have been renamed to `recv!'
10413and `recvfrom!'. They no longer accept a size for a second argument;
10414you must pass a string to hold the received value. They no longer
10415return the buffer. Instead, `recv' returns the length of the message
10416received, and `recvfrom' returns a pair containing the packet's length
6c0201ad 10417and originating address.
095936d2
JB
10418
10419*** The file descriptor datatype has been removed, as have the
10420`read-fd', `write-fd', `close', `lseek', and `dup' functions.
10421We plan to replace these functions with a SCSH-compatible interface.
10422
10423*** The `create' function has been removed; it's just a special case
10424of `open'.
10425
10426*** There are new functions to break down process termination status
10427values. In the descriptions below, STATUS is a value returned by
10428`waitpid'.
10429
10430(status:exit-val STATUS)
10431 If the child process exited normally, this function returns the exit
10432 code for the child process (i.e., the value passed to exit, or
10433 returned from main). If the child process did not exit normally,
10434 this function returns #f.
10435
10436(status:stop-sig STATUS)
10437 If the child process was suspended by a signal, this function
10438 returns the signal that suspended the child. Otherwise, it returns
10439 #f.
10440
10441(status:term-sig STATUS)
10442 If the child process terminated abnormally, this function returns
10443 the signal that terminated the child. Otherwise, this function
10444 returns false.
10445
10446POSIX promises that exactly one of these functions will return true on
10447a valid STATUS value.
10448
10449These functions are compatible with SCSH.
10450
10451*** There are new accessors and setters for the broken-out time vectors
48d224d7
JB
10452returned by `localtime', `gmtime', and that ilk. They are:
10453
10454 Component Accessor Setter
10455 ========================= ============ ============
10456 seconds tm:sec set-tm:sec
10457 minutes tm:min set-tm:min
10458 hours tm:hour set-tm:hour
10459 day of the month tm:mday set-tm:mday
10460 month tm:mon set-tm:mon
10461 year tm:year set-tm:year
10462 day of the week tm:wday set-tm:wday
10463 day in the year tm:yday set-tm:yday
10464 daylight saving time tm:isdst set-tm:isdst
10465 GMT offset, seconds tm:gmtoff set-tm:gmtoff
10466 name of time zone tm:zone set-tm:zone
10467
095936d2
JB
10468*** There are new accessors for the vectors returned by `uname',
10469describing the host system:
48d224d7
JB
10470
10471 Component Accessor
10472 ============================================== ================
10473 name of the operating system implementation utsname:sysname
10474 network name of this machine utsname:nodename
10475 release level of the operating system utsname:release
10476 version level of the operating system utsname:version
10477 machine hardware platform utsname:machine
10478
095936d2
JB
10479*** There are new accessors for the vectors returned by `getpw',
10480`getpwnam', `getpwuid', and `getpwent', describing entries from the
10481system's user database:
10482
10483 Component Accessor
10484 ====================== =================
10485 user name passwd:name
10486 user password passwd:passwd
10487 user id passwd:uid
10488 group id passwd:gid
10489 real name passwd:gecos
10490 home directory passwd:dir
10491 shell program passwd:shell
10492
10493*** There are new accessors for the vectors returned by `getgr',
10494`getgrnam', `getgrgid', and `getgrent', describing entries from the
10495system's group database:
10496
10497 Component Accessor
10498 ======================= ============
10499 group name group:name
10500 group password group:passwd
10501 group id group:gid
10502 group members group:mem
10503
10504*** There are new accessors for the vectors returned by `gethost',
10505`gethostbyaddr', `gethostbyname', and `gethostent', describing
10506internet hosts:
10507
10508 Component Accessor
10509 ========================= ===============
10510 official name of host hostent:name
10511 alias list hostent:aliases
10512 host address type hostent:addrtype
10513 length of address hostent:length
10514 list of addresses hostent:addr-list
10515
10516*** There are new accessors for the vectors returned by `getnet',
10517`getnetbyaddr', `getnetbyname', and `getnetent', describing internet
10518networks:
10519
10520 Component Accessor
10521 ========================= ===============
10522 official name of net netent:name
10523 alias list netent:aliases
10524 net number type netent:addrtype
10525 net number netent:net
10526
10527*** There are new accessors for the vectors returned by `getproto',
10528`getprotobyname', `getprotobynumber', and `getprotoent', describing
10529internet protocols:
10530
10531 Component Accessor
10532 ========================= ===============
10533 official protocol name protoent:name
10534 alias list protoent:aliases
10535 protocol number protoent:proto
10536
10537*** There are new accessors for the vectors returned by `getserv',
10538`getservbyname', `getservbyport', and `getservent', describing
10539internet protocols:
10540
10541 Component Accessor
10542 ========================= ===============
6c0201ad 10543 official service name servent:name
095936d2 10544 alias list servent:aliases
6c0201ad
TTN
10545 port number servent:port
10546 protocol to use servent:proto
095936d2
JB
10547
10548*** There are new accessors for the sockaddr structures returned by
10549`accept', `getsockname', `getpeername', `recvfrom!':
10550
10551 Component Accessor
10552 ======================================== ===============
6c0201ad 10553 address format (`family') sockaddr:fam
095936d2
JB
10554 path, for file domain addresses sockaddr:path
10555 address, for internet domain addresses sockaddr:addr
10556 TCP or UDP port, for internet sockaddr:port
10557
10558*** The `getpwent', `getgrent', `gethostent', `getnetent',
10559`getprotoent', and `getservent' functions now return #f at the end of
10560the user database. (They used to throw an exception.)
10561
10562Note that calling MUMBLEent function is equivalent to calling the
10563corresponding MUMBLE function with no arguments.
10564
10565*** The `setpwent', `setgrent', `sethostent', `setnetent',
10566`setprotoent', and `setservent' routines now take no arguments.
10567
10568*** The `gethost', `getproto', `getnet', and `getserv' functions now
10569provide more useful information when they throw an exception.
10570
10571*** The `lnaof' function has been renamed to `inet-lnaof'.
10572
10573*** Guile now claims to have the `current-time' feature.
10574
10575*** The `mktime' function now takes an optional second argument ZONE,
10576giving the time zone to use for the conversion. ZONE should be a
10577string, in the same format as expected for the "TZ" environment variable.
10578
10579*** The `strptime' function now returns a pair (TIME . COUNT), where
10580TIME is the parsed time as a vector, and COUNT is the number of
10581characters from the string left unparsed. This function used to
10582return the remaining characters as a string.
10583
10584*** The `gettimeofday' function has replaced the old `time+ticks' function.
10585The return value is now (SECONDS . MICROSECONDS); the fractional
10586component is no longer expressed in "ticks".
10587
10588*** The `ticks/sec' constant has been removed, in light of the above change.
6685dc83 10589
ea00ecba
MG
10590* Changes to the gh_ interface
10591
10592** gh_eval_str() now returns an SCM object which is the result of the
10593evaluation
10594
aaef0d2a
MG
10595** gh_scm2str() now copies the Scheme data to a caller-provided C
10596array
10597
10598** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
10599and returns the array
10600
10601** gh_scm2str0() is gone: there is no need to distinguish
10602null-terminated from non-null-terminated, since gh_scm2newstr() allows
10603the user to interpret the data both ways.
10604
f3b1485f
JB
10605* Changes to the scm_ interface
10606
095936d2
JB
10607** The new function scm_symbol_value0 provides an easy way to get a
10608symbol's value from C code:
10609
10610SCM scm_symbol_value0 (char *NAME)
10611 Return the value of the symbol named by the null-terminated string
10612 NAME in the current module. If the symbol named NAME is unbound in
10613 the current module, return SCM_UNDEFINED.
10614
10615** The new function scm_sysintern0 creates new top-level variables,
10616without assigning them a value.
10617
10618SCM scm_sysintern0 (char *NAME)
10619 Create a new Scheme top-level variable named NAME. NAME is a
10620 null-terminated string. Return the variable's value cell.
10621
10622** The function scm_internal_catch is the guts of catch. It handles
10623all the mechanics of setting up a catch target, invoking the catch
10624body, and perhaps invoking the handler if the body does a throw.
10625
10626The function is designed to be usable from C code, but is general
10627enough to implement all the semantics Guile Scheme expects from throw.
10628
10629TAG is the catch tag. Typically, this is a symbol, but this function
10630doesn't actually care about that.
10631
10632BODY is a pointer to a C function which runs the body of the catch;
10633this is the code you can throw from. We call it like this:
10634 BODY (BODY_DATA, JMPBUF)
10635where:
10636 BODY_DATA is just the BODY_DATA argument we received; we pass it
10637 through to BODY as its first argument. The caller can make
10638 BODY_DATA point to anything useful that BODY might need.
10639 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
10640 which we have just created and initialized.
10641
10642HANDLER is a pointer to a C function to deal with a throw to TAG,
10643should one occur. We call it like this:
10644 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
10645where
10646 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
10647 same idea as BODY_DATA above.
10648 THROWN_TAG is the tag that the user threw to; usually this is
10649 TAG, but it could be something else if TAG was #t (i.e., a
10650 catch-all), or the user threw to a jmpbuf.
10651 THROW_ARGS is the list of arguments the user passed to the THROW
10652 function.
10653
10654BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
10655is just a pointer we pass through to HANDLER. We don't actually
10656use either of those pointers otherwise ourselves. The idea is
10657that, if our caller wants to communicate something to BODY or
10658HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
10659HANDLER can then use. Think of it as a way to make BODY and
10660HANDLER closures, not just functions; MUMBLE_DATA points to the
10661enclosed variables.
10662
10663Of course, it's up to the caller to make sure that any data a
10664MUMBLE_DATA needs is protected from GC. A common way to do this is
10665to make MUMBLE_DATA a pointer to data stored in an automatic
10666structure variable; since the collector must scan the stack for
10667references anyway, this assures that any references in MUMBLE_DATA
10668will be found.
10669
10670** The new function scm_internal_lazy_catch is exactly like
10671scm_internal_catch, except:
10672
10673- It does not unwind the stack (this is the major difference).
10674- If handler returns, its value is returned from the throw.
10675- BODY always receives #f as its JMPBUF argument (since there's no
10676 jmpbuf associated with a lazy catch, because we don't unwind the
10677 stack.)
10678
10679** scm_body_thunk is a new body function you can pass to
10680scm_internal_catch if you want the body to be like Scheme's `catch'
10681--- a thunk, or a function of one argument if the tag is #f.
10682
10683BODY_DATA is a pointer to a scm_body_thunk_data structure, which
10684contains the Scheme procedure to invoke as the body, and the tag
10685we're catching. If the tag is #f, then we pass JMPBUF (created by
10686scm_internal_catch) to the body procedure; otherwise, the body gets
10687no arguments.
10688
10689** scm_handle_by_proc is a new handler function you can pass to
10690scm_internal_catch if you want the handler to act like Scheme's catch
10691--- call a procedure with the tag and the throw arguments.
10692
10693If the user does a throw to this catch, this function runs a handler
10694procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
10695variable holding the Scheme procedure object to invoke. It ought to
10696be a pointer to an automatic variable (i.e., one living on the stack),
10697or the procedure object should be otherwise protected from GC.
10698
10699** scm_handle_by_message is a new handler function to use with
10700`scm_internal_catch' if you want Guile to print a message and die.
10701It's useful for dealing with throws to uncaught keys at the top level.
10702
10703HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
10704message header to print; if zero, we use "guile" instead. That
10705text is followed by a colon, then the message described by ARGS.
10706
10707** The return type of scm_boot_guile is now void; the function does
10708not return a value, and indeed, never returns at all.
10709
f3b1485f
JB
10710** The new function scm_shell makes it easy for user applications to
10711process command-line arguments in a way that is compatible with the
10712stand-alone guile interpreter (which is in turn compatible with SCSH,
10713the Scheme shell).
10714
10715To use the scm_shell function, first initialize any guile modules
10716linked into your application, and then call scm_shell with the values
7ed46dc8 10717of ARGC and ARGV your `main' function received. scm_shell will add
f3b1485f
JB
10718any SCSH-style meta-arguments from the top of the script file to the
10719argument vector, and then process the command-line arguments. This
10720generally means loading a script file or starting up an interactive
10721command interpreter. For details, see "Changes to the stand-alone
10722interpreter" above.
10723
095936d2 10724** The new functions scm_get_meta_args and scm_count_argv help you
6c0201ad 10725implement the SCSH-style meta-argument, `\'.
095936d2
JB
10726
10727char **scm_get_meta_args (int ARGC, char **ARGV)
10728 If the second element of ARGV is a string consisting of a single
10729 backslash character (i.e. "\\" in Scheme notation), open the file
10730 named by the following argument, parse arguments from it, and return
10731 the spliced command line. The returned array is terminated by a
10732 null pointer.
6c0201ad 10733
095936d2
JB
10734 For details of argument parsing, see above, under "guile now accepts
10735 command-line arguments compatible with SCSH..."
10736
10737int scm_count_argv (char **ARGV)
10738 Count the arguments in ARGV, assuming it is terminated by a null
10739 pointer.
10740
10741For an example of how these functions might be used, see the source
10742code for the function scm_shell in libguile/script.c.
10743
10744You will usually want to use scm_shell instead of calling this
10745function yourself.
10746
10747** The new function scm_compile_shell_switches turns an array of
10748command-line arguments into Scheme code to carry out the actions they
10749describe. Given ARGC and ARGV, it returns a Scheme expression to
10750evaluate, and calls scm_set_program_arguments to make any remaining
10751command-line arguments available to the Scheme code. For example,
10752given the following arguments:
10753
10754 -e main -s ekko a speckled gecko
10755
10756scm_set_program_arguments will return the following expression:
10757
10758 (begin (load "ekko") (main (command-line)) (quit))
10759
10760You will usually want to use scm_shell instead of calling this
10761function yourself.
10762
10763** The function scm_shell_usage prints a usage message appropriate for
10764an interpreter that uses scm_compile_shell_switches to handle its
10765command-line arguments.
10766
10767void scm_shell_usage (int FATAL, char *MESSAGE)
10768 Print a usage message to the standard error output. If MESSAGE is
10769 non-zero, write it before the usage message, followed by a newline.
10770 If FATAL is non-zero, exit the process, using FATAL as the
10771 termination status. (If you want to be compatible with Guile,
10772 always use 1 as the exit status when terminating due to command-line
10773 usage problems.)
10774
10775You will usually want to use scm_shell instead of calling this
10776function yourself.
48d224d7
JB
10777
10778** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
095936d2
JB
10779expressions. It used to return SCM_EOL. Earth-shattering.
10780
10781** The macros for declaring scheme objects in C code have been
10782rearranged slightly. They are now:
10783
10784SCM_SYMBOL (C_NAME, SCHEME_NAME)
10785 Declare a static SCM variable named C_NAME, and initialize it to
10786 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
10787 be a C identifier, and SCHEME_NAME should be a C string.
10788
10789SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
10790 Just like SCM_SYMBOL, but make C_NAME globally visible.
10791
10792SCM_VCELL (C_NAME, SCHEME_NAME)
10793 Create a global variable at the Scheme level named SCHEME_NAME.
10794 Declare a static SCM variable named C_NAME, and initialize it to
10795 point to the Scheme variable's value cell.
10796
10797SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
10798 Just like SCM_VCELL, but make C_NAME globally visible.
10799
10800The `guile-snarf' script writes initialization code for these macros
10801to its standard output, given C source code as input.
10802
10803The SCM_GLOBAL macro is gone.
10804
10805** The scm_read_line and scm_read_line_x functions have been replaced
10806by Scheme code based on the %read-delimited! procedure (known to C
10807code as scm_read_delimited_x). See its description above for more
10808information.
48d224d7 10809
095936d2
JB
10810** The function scm_sys_open has been renamed to scm_open. It now
10811returns a port instead of an FD object.
ea00ecba 10812
095936d2
JB
10813* The dynamic linking support has changed. For more information, see
10814libguile/DYNAMIC-LINKING.
ea00ecba 10815
f7b47737
JB
10816\f
10817Guile 1.0b3
3065a62a 10818
f3b1485f
JB
10819User-visible changes from Thursday, September 5, 1996 until Guile 1.0
10820(Sun 5 Jan 1997):
3065a62a 10821
4b521edb 10822* Changes to the 'guile' program:
3065a62a 10823
4b521edb
JB
10824** Guile now loads some new files when it starts up. Guile first
10825searches the load path for init.scm, and loads it if found. Then, if
10826Guile is not being used to execute a script, and the user's home
10827directory contains a file named `.guile', Guile loads that.
c6486f8a 10828
4b521edb 10829** You can now use Guile as a shell script interpreter.
3065a62a
JB
10830
10831To paraphrase the SCSH manual:
10832
10833 When Unix tries to execute an executable file whose first two
10834 characters are the `#!', it treats the file not as machine code to
10835 be directly executed by the native processor, but as source code
10836 to be executed by some interpreter. The interpreter to use is
10837 specified immediately after the #! sequence on the first line of
10838 the source file. The kernel reads in the name of the interpreter,
10839 and executes that instead. It passes the interpreter the source
10840 filename as its first argument, with the original arguments
10841 following. Consult the Unix man page for the `exec' system call
10842 for more information.
10843
1a1945be
JB
10844Now you can use Guile as an interpreter, using a mechanism which is a
10845compatible subset of that provided by SCSH.
10846
3065a62a
JB
10847Guile now recognizes a '-s' command line switch, whose argument is the
10848name of a file of Scheme code to load. It also treats the two
10849characters `#!' as the start of a comment, terminated by `!#'. Thus,
10850to make a file of Scheme code directly executable by Unix, insert the
10851following two lines at the top of the file:
10852
10853#!/usr/local/bin/guile -s
10854!#
10855
10856Guile treats the argument of the `-s' command-line switch as the name
10857of a file of Scheme code to load, and treats the sequence `#!' as the
10858start of a block comment, terminated by `!#'.
10859
10860For example, here's a version of 'echo' written in Scheme:
10861
10862#!/usr/local/bin/guile -s
10863!#
10864(let loop ((args (cdr (program-arguments))))
10865 (if (pair? args)
10866 (begin
10867 (display (car args))
10868 (if (pair? (cdr args))
10869 (display " "))
10870 (loop (cdr args)))))
10871(newline)
10872
10873Why does `#!' start a block comment terminated by `!#', instead of the
10874end of the line? That is the notation SCSH uses, and although we
10875don't yet support the other SCSH features that motivate that choice,
10876we would like to be backward-compatible with any existing Guile
3763761c
JB
10877scripts once we do. Furthermore, if the path to Guile on your system
10878is too long for your kernel, you can start the script with this
10879horrible hack:
10880
10881#!/bin/sh
10882exec /really/long/path/to/guile -s "$0" ${1+"$@"}
10883!#
3065a62a
JB
10884
10885Note that some very old Unix systems don't support the `#!' syntax.
10886
c6486f8a 10887
4b521edb 10888** You can now run Guile without installing it.
6685dc83
JB
10889
10890Previous versions of the interactive Guile interpreter (`guile')
10891couldn't start up unless Guile's Scheme library had been installed;
10892they used the value of the environment variable `SCHEME_LOAD_PATH'
10893later on in the startup process, but not to find the startup code
10894itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
10895code.
10896
10897To run Guile without installing it, build it in the normal way, and
10898then set the environment variable `SCHEME_LOAD_PATH' to a
10899colon-separated list of directories, including the top-level directory
10900of the Guile sources. For example, if you unpacked Guile so that the
10901full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
10902you might say
10903
10904 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
10905
c6486f8a 10906
4b521edb
JB
10907** Guile's read-eval-print loop no longer prints #<unspecified>
10908results. If the user wants to see this, she can evaluate the
10909expression (assert-repl-print-unspecified #t), perhaps in her startup
48d224d7 10910file.
6685dc83 10911
4b521edb
JB
10912** Guile no longer shows backtraces by default when an error occurs;
10913however, it does display a message saying how to get one, and how to
10914request that they be displayed by default. After an error, evaluate
10915 (backtrace)
10916to see a backtrace, and
10917 (debug-enable 'backtrace)
10918to see them by default.
6685dc83 10919
6685dc83 10920
d9fb83d9 10921
4b521edb
JB
10922* Changes to Guile Scheme:
10923
10924** Guile now distinguishes between #f and the empty list.
10925
10926This is for compatibility with the IEEE standard, the (possibly)
10927upcoming Revised^5 Report on Scheme, and many extant Scheme
10928implementations.
10929
10930Guile used to have #f and '() denote the same object, to make Scheme's
10931type system more compatible with Emacs Lisp's. However, the change
10932caused too much trouble for Scheme programmers, and we found another
10933way to reconcile Emacs Lisp with Scheme that didn't require this.
10934
10935
10936** Guile's delq, delv, delete functions, and their destructive
c6486f8a
JB
10937counterparts, delq!, delv!, and delete!, now remove all matching
10938elements from the list, not just the first. This matches the behavior
10939of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
10940functions which inspired them.
10941
10942I recognize that this change may break code in subtle ways, but it
10943seems best to make the change before the FSF's first Guile release,
10944rather than after.
10945
10946
4b521edb 10947** The compiled-library-path function has been deleted from libguile.
6685dc83 10948
4b521edb 10949** The facilities for loading Scheme source files have changed.
c6486f8a 10950
4b521edb 10951*** The variable %load-path now tells Guile which directories to search
6685dc83
JB
10952for Scheme code. Its value is a list of strings, each of which names
10953a directory.
10954
4b521edb
JB
10955*** The variable %load-extensions now tells Guile which extensions to
10956try appending to a filename when searching the load path. Its value
10957is a list of strings. Its default value is ("" ".scm").
10958
10959*** (%search-load-path FILENAME) searches the directories listed in the
10960value of the %load-path variable for a Scheme file named FILENAME,
10961with all the extensions listed in %load-extensions. If it finds a
10962match, then it returns its full filename. If FILENAME is absolute, it
10963returns it unchanged. Otherwise, it returns #f.
6685dc83 10964
4b521edb
JB
10965%search-load-path will not return matches that refer to directories.
10966
10967*** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
10968uses %seach-load-path to find a file named FILENAME, and loads it if
10969it finds it. If it can't read FILENAME for any reason, it throws an
10970error.
6685dc83
JB
10971
10972The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4b521edb
JB
10973`read' function.
10974
10975*** load uses the same searching semantics as primitive-load.
10976
10977*** The functions %try-load, try-load-with-path, %load, load-with-path,
10978basic-try-load-with-path, basic-load-with-path, try-load-module-with-
10979path, and load-module-with-path have been deleted. The functions
10980above should serve their purposes.
10981
10982*** If the value of the variable %load-hook is a procedure,
10983`primitive-load' applies its value to the name of the file being
10984loaded (without the load path directory name prepended). If its value
10985is #f, it is ignored. Otherwise, an error occurs.
10986
10987This is mostly useful for printing load notification messages.
10988
10989
10990** The function `eval!' is no longer accessible from the scheme level.
10991We can't allow operations which introduce glocs into the scheme level,
10992because Guile's type system can't handle these as data. Use `eval' or
10993`read-and-eval!' (see below) as replacement.
10994
10995** The new function read-and-eval! reads an expression from PORT,
10996evaluates it, and returns the result. This is more efficient than
10997simply calling `read' and `eval', since it is not necessary to make a
10998copy of the expression for the evaluator to munge.
10999
11000Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
11001for the `read' function.
11002
11003
11004** The function `int?' has been removed; its definition was identical
11005to that of `integer?'.
11006
11007** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
11008use the R4RS names for these functions.
11009
11010** The function object-properties no longer returns the hash handle;
11011it simply returns the object's property list.
11012
11013** Many functions have been changed to throw errors, instead of
11014returning #f on failure. The point of providing exception handling in
11015the language is to simplify the logic of user code, but this is less
11016useful if Guile's primitives don't throw exceptions.
11017
11018** The function `fileno' has been renamed from `%fileno'.
11019
11020** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
11021
11022
11023* Changes to Guile's C interface:
11024
11025** The library's initialization procedure has been simplified.
11026scm_boot_guile now has the prototype:
11027
11028void scm_boot_guile (int ARGC,
11029 char **ARGV,
11030 void (*main_func) (),
11031 void *closure);
11032
11033scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
11034MAIN_FUNC should do all the work of the program (initializing other
11035packages, reading user input, etc.) before returning. When MAIN_FUNC
11036returns, call exit (0); this function never returns. If you want some
11037other exit value, MAIN_FUNC may call exit itself.
11038
11039scm_boot_guile arranges for program-arguments to return the strings
11040given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
11041scm_set_program_arguments with the final list, so Scheme code will
11042know which arguments have been processed.
11043
11044scm_boot_guile establishes a catch-all catch handler which prints an
11045error message and exits the process. This means that Guile exits in a
11046coherent way when system errors occur and the user isn't prepared to
11047handle it. If the user doesn't like this behavior, they can establish
11048their own universal catcher in MAIN_FUNC to shadow this one.
11049
11050Why must the caller do all the real work from MAIN_FUNC? The garbage
11051collector assumes that all local variables of type SCM will be above
11052scm_boot_guile's stack frame on the stack. If you try to manipulate
11053SCM values after this function returns, it's the luck of the draw
11054whether the GC will be able to find the objects you allocate. So,
11055scm_boot_guile function exits, rather than returning, to discourage
11056people from making that mistake.
11057
11058The IN, OUT, and ERR arguments were removed; there are other
11059convenient ways to override these when desired.
11060
11061The RESULT argument was deleted; this function should never return.
11062
11063The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
11064general.
11065
11066
11067** Guile's header files should no longer conflict with your system's
11068header files.
11069
11070In order to compile code which #included <libguile.h>, previous
11071versions of Guile required you to add a directory containing all the
11072Guile header files to your #include path. This was a problem, since
11073Guile's header files have names which conflict with many systems'
11074header files.
11075
11076Now only <libguile.h> need appear in your #include path; you must
11077refer to all Guile's other header files as <libguile/mumble.h>.
11078Guile's installation procedure puts libguile.h in $(includedir), and
11079the rest in $(includedir)/libguile.
11080
11081
11082** Two new C functions, scm_protect_object and scm_unprotect_object,
11083have been added to the Guile library.
11084
11085scm_protect_object (OBJ) protects OBJ from the garbage collector.
11086OBJ will not be freed, even if all other references are dropped,
11087until someone does scm_unprotect_object (OBJ). Both functions
11088return OBJ.
11089
11090Note that calls to scm_protect_object do not nest. You can call
11091scm_protect_object any number of times on a given object, and the
11092next call to scm_unprotect_object will unprotect it completely.
11093
11094Basically, scm_protect_object and scm_unprotect_object just
11095maintain a list of references to things. Since the GC knows about
11096this list, all objects it mentions stay alive. scm_protect_object
11097adds its argument to the list; scm_unprotect_object remove its
11098argument from the list.
11099
11100
11101** scm_eval_0str now returns the value of the last expression
11102evaluated.
11103
11104** The new function scm_read_0str reads an s-expression from a
11105null-terminated string, and returns it.
11106
11107** The new function `scm_stdio_to_port' converts a STDIO file pointer
11108to a Scheme port object.
11109
11110** The new function `scm_set_program_arguments' allows C code to set
e80c8fea 11111the value returned by the Scheme `program-arguments' function.
6685dc83 11112
6685dc83 11113\f
1a1945be
JB
11114Older changes:
11115
11116* Guile no longer includes sophisticated Tcl/Tk support.
11117
11118The old Tcl/Tk support was unsatisfying to us, because it required the
11119user to link against the Tcl library, as well as Tk and Guile. The
11120interface was also un-lispy, in that it preserved Tcl/Tk's practice of
11121referring to widgets by names, rather than exporting widgets to Scheme
11122code as a special datatype.
11123
11124In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
11125maintainers described some very interesting changes in progress to the
11126Tcl/Tk internals, which would facilitate clean interfaces between lone
11127Tk and other interpreters --- even for garbage-collected languages
11128like Scheme. They expected the new Tk to be publicly available in the
11129fall of 1996.
11130
11131Since it seems that Guile might soon have a new, cleaner interface to
11132lone Tk, and that the old Guile/Tk glue code would probably need to be
11133completely rewritten, we (Jim Blandy and Richard Stallman) have
11134decided not to support the old code. We'll spend the time instead on
11135a good interface to the newer Tk, as soon as it is available.
5c54da76 11136
8512dea6 11137Until then, gtcltk-lib provides trivial, low-maintenance functionality.
deb95d71 11138
5c54da76
JB
11139\f
11140Copyright information:
11141
4f416616 11142Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
5c54da76
JB
11143
11144 Permission is granted to anyone to make or distribute verbatim copies
11145 of this document as received, in any medium, provided that the
11146 copyright notice and this permission notice are preserved,
11147 thus giving the recipient permission to redistribute in turn.
11148
11149 Permission is granted to distribute modified versions
11150 of this document, or of portions of it,
11151 under the above conditions, provided also that they
11152 carry prominent notices stating who last changed them.
11153
48d224d7
JB
11154\f
11155Local variables:
11156mode: outline
11157paragraph-separate: "[ \f]*$"
11158end: