Debian Codegraph @

NEWS

raw
1 Guile NEWS --- history of user-visible changes.
2 Copyright (C) 1996-2020 Free Software Foundation, Inc.
3 See the end for copying conditions.
4
5 Please send Guile bug reports to [email protected].
6
7
8
9 Changes in 2.2.7 (since 2.2.6)
10
11 * New interfaces and functionality
12
13 ** (texinfo plain-text) now exports '*line-width*' fluid
14
15 The new '*line-width*' fluid allows users to specify the width of a line
16 for the purposes of line wrapping. See "texinfo plain-text" in the
17 manual.
18
19 * Bug fixes
20
21 ** Reduce GC pressure when using bignums
22
23 Guile no longer installs a finalizer on each bignum (large integer) it
24 creates. This significantly improves speed and memory usage on
25 applications that make heavy use of bignums, such as the compiler
26 itself.
27
28 ** Fix peval bug that ignored excess arguments
29
30 In an expression like:
31
32 ((lambda ()
33 (define (add1 n)(+ 1 n))
34 (add1 1 2)))
35
36 the compiler (specifically 'peval') would silently ignore the excess
37 argument to 'add1'.
38
39 ** Respect thread local fluid defaults
40
41 Previously (fluid-ref (make-thread-local-fluid #t)) would return #f.
42 This is now fixed.
43
44 ** Fix non-deterministic crash in 'finalization_thread_proc'
45 (<https://bugs.gnu.org/37757>)
46
47 ** texinfo properly renders @acronym in plain text
48 (<https://bugs.gnu.org/37846>)
49
50 ** 'scm_port_poll' honors "w" flags
51 (<https://bugs.gnu.org/36709>)
52
53 ** Do not record LDFLAGS in .pc file
54 (<https://bugs.gnu.org/36339>)
55
56 ** Fix Readline configure check for the sake of libedit
57
58 This fixes builds on macOS against the system-provided libedit.
59
60 ** Fix build on platforms where the stack grows upwards
61
62
63
64 Changes in 2.2.6 (since 2.2.5)
65
66 * Bug fixes
67
68 ** Fix regression introduced in 2.2.5 that would break HTTP servers
69
70 Guile 2.2.5 introduced a bug that would break the built-in HTTP server
71 provided by the (web server) module. Specifically, HTTP servers would
72 hang while reading requests. See <https://bugs.gnu.org/36350>.
73
74 ** 'strftime' and 'strptime' honor the current locale encoding
75
76 Until now these procedures would wrongfully assume that the locale
77 encoding is always UTF-8. See <https://bugs.gnu.org/35920>.
78
79 ** Re-export 'current-load-port'
80
81 This procedure was erroneously removed in the 2.2 series but was still
82 documented.
83
84 ** Minor documentation mistakes were fixed
85
86
87
88 Changes in 2.2.5 (since 2.2.4):
89
90 * Notable improvements
91
92 ** Greatly improved performance of bidirectional pipes.
93
94 The performance of bidirectional pipes, as created using 'open-pipe' or
95 'open-pipe*' in OPEN_BOTH mode, has been greatly improved. When reading
96 large blocks of binary data from a bidirectional pipe, the maximum
97 bandwidth has been increased by a factor of ~10^3 in some cases.
98
99 ** New 'get-bytevector-some!' I/O primitive.
100
101 This new I/O primitive is similar to 'get-bytevector-some' from the
102 R6RS, except that it writes its data to a user-specified range of
103 indices in an existing bytevector. As a corollary, it is also now
104 possible to specify a maximum number of bytes to read. Note that
105 'get-bytevector-some', and now 'get-bytevector-some!', are unique among
106 Guile's I/O primitives in their support of efficient binary reads of
107 potentially large blocks while also allowing for short reads, to avoid
108 undesired blocking. Now these operations can be performed while also
109 avoiding heap-allocation.
110
111 'get-bytevector-some!' is needed to efficiently implement the new
112 bidirectional pipes, which are built upon R6RS custom binary
113 input/output ports.
114
115 ** get-bytevector-{n!,some,some!} now support suspendable I/O.
116
117 Scheme implementations of 'get-bytevector-n!', 'get-bytevector-some',
118 and 'get-bytevector-some!' have been added to (ice-9 suspendable-ports).
119 As a result, these I/O operations now support suspendable I/O.
120
121 * Compiler improvements
122
123 ** guild compile: Add -Wshadowed-toplevel.
124
125 Top-level definitions that shadow previous top-level definitions from
126 the same compilation unit will now trigger a compile-time warning, if
127 -Wshadowed-toplevel is enabled. It is enabled by default.
128
129 ** guild compile: Add '-x' flag.
130
131 Passing "-x EXT" to 'guild compile' will now cause EXT to be recognized
132 as a valid source file name extension. For example, to compile R6RS
133 code, you might want to pass "-x .sls" so that files ending in ".sls"
134 can be found.
135
136 * Miscellaneous improvements
137
138 ** Bootstrap optimization
139
140 eval.go and psyntax-pp.go are now built before the rest of the .go files
141 so that they are processed by a fast macro expander. This saves time
142 when using parallel builds.
143
144 ** put-u8 now always writes a single byte, regardless of the port encoding.
145
146 Previously, (put-u8 PORT OCTET) worked as expected only when writing to
147 binary ports, i.e. those with port encoding "ISO-8859-1" a.k.a. Latin-1.
148 Strictly speaking, this meets the requirements of the R6RS 'put-u8',
149 which need only support binary ports. However, Guile in fact allows
150 binary I/O to be performed on any port, and yet 'put-u8' behaved in a
151 surprising way with other port encodings: it would perform a _textual_
152 I/O operation, writing the character with Unicode scalar value OCTET.
153 Now, 'put-u8' always writes a single byte with value OCTET, regardless
154 of the port encoding.
155
156 ** Optimize fixnum exact integer square roots.
157
158 'exact-integer-sqrt' now avoids heap allocation when applied to a
159 fixnum. 'sqrt' now avoids heap allocation when applied to a fixnum
160 that's a perfect square. Fewer heap allocations are now required when
161 applying 'sqrt' to a square of an exact rational whose numerator or
162 denominator are fixnums.
163
164 ** scm_mkstrport: Optimize the POS -> BYTE_POS conversion.
165
166 scm_mkstrport now avoids an unnecessary heap allocation and conversion
167 to UTF-8, when STR is provided and POS is non-zero.
168
169 ** SRFI-19: Support ~N in string->date.
170
171 Support for the ~N escape, which allows fractions of a second to be
172 parsed, is now supported in SRFI-19 'string->date'.
173
174 ** SRFI-19: Update the leap second table.
175
176 The leap on 1 January 2017 was added to SRFI-19's leap second table.
177
178 ** stexi->shtml: Add support for @i, @math, @tie and @dots.
179
180 stexi->shtml is now able to convert @i, @math, @tie and @dots to HTML.
181
182 ** Define AT_SYMLINK_NOFOLLOW, AT_NO_AUTOMOUNT, and AT_EMPTY_PATH.
183
184 AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, and AT_EMPTY_PATH are now available
185 from Scheme, if supported on the platform.
186
187 ** Improvements to the 'time' macro from (ice-9 time).
188
189 The 'time' macro now supports expressions that return multiple values.
190 It has also been rewritten as a hygienic 'syntax-rules' macro.
191 Previously, it was built using 'define-macro', and was therefore
192 unhygienic. This is not merely an internal implementation detail, but
193 is potentially relevant to any user of the 'time' macro, since it could
194 lead to unintended variable capture and other problems.
195
196 ** Clarify the documentation for 'nil?'.
197 See commit b44f505f1571fc9c42e58982f161a9cfc81fb7f4.
198 ** Clarify the manual's "Processes" section.
199 See commit 8cdd3a0773930ca872a13aada7a1344f03bb382b.
200 ** Avoid 'with-latin1-locale' in binary I/O tests.
201 See commit 162a031e5f2c64cd23fcf069fb7b5071196f9527.
202 ** Update user-visible copyright years.
203
204 * Bug fixes
205
206 ** Avoid regexp ranges in HTTP inter-protocol exploitation check.
207
208 The regular expression used to check for HTTP inter-protocol
209 exploitation attacks previously used a character range '0-9', whose
210 meaning depends on the current locale. This has now been fixed.
211
212 ** Fixes to the SRFI-19 time/date library.
213
214 *** TAI-to-UTC conversion leaps at the wrong time.
215 <https://bugs.gnu.org/21911>
216 *** time-utc->date shows bogus zone-dependent leap second.
217 <https://bugs.gnu.org/22034>
218 *** Manual incorrectly describes Julian Date.
219 <https://bugs.gnu.org/21902>
220 *** date->string duff ISO 8601 negative years.
221 <https://bugs.gnu.org/21903>
222 *** date->string duff ISO 8601 format for non-4-digit years.
223 <https://bugs.gnu.org/21904>
224 *** julian-day->date negative input breakage.
225 <https://bugs.gnu.org/21906>
226 *** time-duration screws up negative durations.
227 <https://bugs.gnu.org/26162>
228 *** time-difference doesn't detect error of differing time types.
229 <https://bugs.gnu.org/26163>
230
231 ** Improve overflow checks in bytevector, string, and I/O operations.
232
233 Several numerical computations, performed using primitive C arithmetic
234 in Guile's core bytevector, string, and I/O operations, have been
235 rewritten to avoid overflows.
236
237 ** Fix type inferencing for 'nil?' and 'null?' predicates.
238
239 Previously, the compiler would sometimes miscompile certain combinations
240 of 'nil?' and 'null?' predicates present within the same top-level form.
241 See <https://bugs.gnu.org/33036>.
242
243 ** Fix 'atomic-box-compare-and-swap!'.
244
245 Previously, 'atomic-box-compare-and-swap!' would sometimes spuriously
246 fail on architectures based on Load-Linked/Store-Conditional (LL/SC)
247 synchronication primitives (e.g. ARM, PowerPC, and MIPS) in a way that
248 was undetectable by the caller. See <https://bugs.gnu.org/32786>.
249
250 ** Make URI handling locale independent.
251
252 Previously, procedures in (web uri) would misbehave in some locales
253 including sv_SE. See <https://bugs.gnu.org/35785>.
254
255 ** Strings, i18n: Limit the use of alloca to approximately 8 kilobytes.
256
257 Previously, 'string-locale-ci=?', 'string-locale-ci<?',
258 'string-locale<?', 'string-locale-{downcase,upcase,titlecase}' and
259 'string-normalize-{nfd,nfc,nfkd,nfkc}' would overflow the C stack when
260 applied to very large strings.
261
262 ** Fix documentation of R6RS 'binary-port?' to reflect reality.
263
264 Previously, the documentation incorrectly stated that 'binary-port?'
265 always returns #t. In fact, it returns #t if and only if the port
266 encoding is "ISO-8859-1". The documentation for 'binary-port?' and
267 'textual-port?' has been rewritten to reflect the current reality, and
268 also to leave open the possibility of changing the behavior of these
269 predicates in a future version of Guile.
270
271 ** Avoid passing NULL to 'memcpy' and 'memcmp'.
272
273 Previously, NULL was sometimes passed to 'memcpy' or 'memcmp' when the
274 size argument was 0.
275
276 ** Save and restore errno in the signal handler.
277
278 Previously, Guile's synchronous C signal handler failed to save and
279 restore 'errno', although it might change its value. This could
280 potentially lead to spurious corruptions of 'errno' within threads
281 interrupted by signals.
282
283 ** scm_to_stringn: Avoid passing NULL to c_strcasecmp.
284 <https://lists.gnu.org/archive/html/guile-user/2019-05/msg00070.html>
285 ** r6rs-ports: Accept 'port-position' values greater than 2^32.
286 <https://bugs.gnu.org/32161>
287 ** r6rs-ports: 'put-bytevector' accepts 64-bit integers.
288 Fixed in commit 741c45458da0831a12a4f8d729814bf9f2cb6571.
289 ** Fix R6RS call-with-{input,output}-file to open textual ports.
290 <https://bugs.gnu.org/32329>
291 ** Update (ice-9 match) to include selected bug fixes from upstream.
292 *** ice-9/match named match-let is not working
293 <https://bugs.gnu.org/22925>
294 ** open-process: Fix dup(2) and execvp(2) error handling.
295 Fixed in commit 521f1ab4709217407496004019c00005d2a82f78.
296 ** bytevectors: Support large indices in integer accessors.
297 Fixed in commit b9cf3517efd4643670d970d2692bc7bede9a85e8.
298 ** bytevectors: Fix list validation of *list->bytevector procedures.
299 <https://bugs.gnu.org/32938>
300 ** Gracefully handle huge shift counts in 'ash' and 'round-ash'.
301 <https://bugs.gnu.org/32644>
302 ** In 'ash' and 'round-ash', handle right shift count of LONG_MIN.
303 <https://bugs.gnu.org/21901>
304 ** Use 'scm_from_utf8_{string,symbol,keyword}' for C string literals.
305 <https://bugs.gnu.org/33044>
306 ** web: Add support for HTTP header continuation lines.
307 Fixed in commit 73cde5ed7218a090ecee888870908af5445796f0.
308 ** scm_seed_to_random_state: Support wide string arguments.
309 <https://bugs.gnu.org/33044>
310 ** Do not warn the user when 'madvise' returns ENOSYS.
311 Fixed in commit 45e4ace6603e00b297e6542362273041aebe7305.
312 ** Add 'texinfo' as a dependency in the README.
313 Fixed in commit 1bbce71501198c3c7abdf07941f5cdc1434858c2.
314 ** Don't mutate read-only string in ports test.
315 Fixed in commit 552f007e91a97f136aad1b22918688b61d03a4a3.
316 ** Remove redefinition of when & unless in snarf-check-and-output-texi.
317 Fixed in commit 1ba5d6f47a54dceee4452a1e7726d2635e5b3449.
318 ** Fix strftime when Guile is built without threading support.
319 Fixed in commit 139c702fc8b61fdeb813c3428fef3701ea8677f9.
320 ** Avoid leaking a file descriptor in test-unwind.
321 Fixed in commit 1437b76777e576b3d000e2f80c5ecdb33a74ac33.
322 ** Fix binary output on files created by mkstemp!.
323 Fixed in commit 78468baa118d316050a27e43250966e52ffd3d54.
324 ** Fix crypt-on-glibc test error.
325 Fixed in commit 27ffbfb0235de466016ea5a6421508f6548971b6.
326 ** Fix race when expanding syntax-parameterize and define-syntax-parameter.
327 <https://bugs.gnu.org/27476#102>
328 ** Add a fallback value for the locale-monetary-decimal-point.
329 Fixed in commit 9ba449643d4c2ac1d2174befca7d765af222bcc0.
330 ** Handle newlib C library's langinfo constant names.
331 Fixed in commit 92105d13ad1363b511214589b7d62d95304beb17.
332 ** Make locale monetary conversion tests be less strict on terminal whitespace.
333 Fixed in commit 2a3ccfb66714efc1c081ea6e921336f80b756d3c.
334 ** Disable test for current value of setitimer on Cygwin.
335 Fixed in commit 3a64c504caaf83e9faf2ec9b7d0e031e1a6a09b9.
336 ** Fix gc.test "after-gc-hook gets called" failures.
337 <https://bugs.gnu.org/31776#17>
338 ** Update iconv.m4 from gnulib, to fix an iconv leak during configure.
339 <https://lists.gnu.org/archive/html/guile-devel/2019-05/msg00011.html>
340 ** guild compile: Add missing newline in "unrecognized option" error message.
341 Fixed in commit 85c5bae4fd94f8686d26fd792b7c0f588c23bd94.
342 ** 'basename' now correctly handles "/" and "//".
343 Fixed in commit 36ad1d24b3d2c174a64c445502a36f19605dbd65.
344 ** Make srfi-71 visible through 'cond-expand'.
345 Fixed in commit 59a06d8392234fbec8b3605cec266a7a0a7b7a56.
346
347
348
349 Changes in 2.2.4 (since 2.2.3):
350
351 * New interfaces and functionality
352
353 ** SRFI-71 (Extended LET-syntax for multiple values)
354
355 Guile now includes SRFI-71, which extends let, let*, and letrec to
356 support assigning multiple values. See "SRFI-71" in the manual for
357 details.
358
359 ** (web client) export 'http-request' procedure
360
361 The 'http-request' procedure is the generalized procedure underneath
362 'http-get', 'http-post', etc.
363
364 ** GDB support now registers the 'guile-backtrace' GDB command
365
366 The 'guile-backtrace' GDB command displays a backtrace of the VM stack
367 for the current thread.
368
369 ** Recognize RISC-V compilation targets in (system base target)
370
371 * Bug fixes
372
373 ** Fix stack-marking bug affecting multi-threaded programs
374 (<https://bugs.gnu.org/28211>)
375
376 ** Add missing SYNC_IP calls in the VM
377
378 These could cause multi-threaded code to crash.
379
380 ** Fix multi-threaded access to modules
381 (<https://bugs.gnu.org/30602>, <https://bugs.gnu.org/31879>,
382 and <https://bugs.gnu.org/31878>)
383
384 ** (ice-9 match) now has better documentation
385
386 ** 'get-bytevector-n' and 'get-bytevector-n!' can now read more than 4 GB
387
388 ** Fix cross-compilation support for elisp
389
390 ** Fix error reporting in 'load-thunk-from-memory'
391
392 ** Fix GOOPS 'instance?' to work on objects that aren't structs
393 (<https://bugs.gnu.org/31606>)
394
395 ** Fix type inference for bitwise logical operators
396 (<https://bugs.gnu.org/31474>)
397
398 ** Avoid inexact arithmetic in the type inferrer for 'sqrt'
399
400 ** Fix floating point unboxing regression in 2.2.3
401 (<https://bugs.gnu.org/30020>)
402
403 ** Fix eta-conversion edge cases in peval (<https://bugs.gnu.org/29520>)
404
405 ** Correctly interpret SRFI-18 timeout parameters
406 (<https://bugs.gnu.org/29704>)
407
408 ** 'select' returns empty sets upon EINTR and EAGAIN
409 (<https://bugs.gnu.org/30368>)
410
411 ** Restore pre-2.2.3 '%fresh-auto-compile' behavior
412
413 This reverts an incorrect fix for <https://bugs.gnu.org/29226>.
414
415
416
417 Changes in 2.2.3 (since 2.2.2):
418
419 * New interfaces and functionality
420
421 ** (web uri) module has better support for RFC 3986
422
423 The URI standard, RFC 3986, defines additional "relative-ref" and
424 "URI-reference" data types. Thanks to Daniel Hartwig, Guile's support
425 for these URI subtypes has been improved. See "Universal Resource
426 Identifiers" in the manual, for more.
427
428 ** `struct-ref/unboxed' and `struct-set!/unboxed'
429
430 These procedures should be used when accessing struct fields with type
431 `u' (unboxed). See "Structure Basics" in the manual, for full details.
432
433 ** Improved support for arrays with non-zero lower bounds
434
435 Thanks to work by Daniel Llorens, Guile no longer exhibits buggy
436 behavior in "sort" or "sort!" on arrays with non-zero lower dimension
437 bounds. Arrays with non-zero lower dimension bounds are now allowed for
438 array-slice-for-each, and truncated-print now supports bitvectors and
439 arrays with non-zero lower bounds. General arrays are now supported as
440 well for random:hollow-sphere!.
441
442 ** Add `uintptr_t' and `intptr_t' to FFI types.
443
444 See "Foreign Types" in the manual for full details.
445
446 * Compiler improvements
447
448 ** Improve speed of compiler backend for functions without loops
449
450 This is a marginal speed improvement, especially for code compiled with
451 optimization level "-O1" or below.
452
453 ** Disable slot pre-coloring for optimization level "-O1" or below
454
455 This improves the speed of the compiler backend.
456
457 ** Improve complexity of constant subexpression elimination pass
458
459 This is a large speed improvement when compiling large files with the
460 default "-O2" pass.
461
462 ** CPS conversion avoids generating return arity adapters if possible
463
464 In Guile, the expression in (define a EXP) may return 1 or more values.
465 This value elision in "value" context is implicit earlier in the Guile
466 compiler, in Tree-IL, but is made explicit in the CPS middle-end
467 language by the addition of the equivalent of explicit call-with-values
468 continuations that ignore additional values. However in many cases we
469 can avoid generating these extra continuations if we know that EXP is
470 single-valued, as is the case for example for constants or variable
471 references or the like.
472
473 Although these "arity-adapting continuations" would be removed by dead
474 code elimination at optimization level "-O2" or above, they were still
475 being needlessly generated in the first place. Guile now avoids
476 generating them, speeding up not only the optimizer at -O2 but also the
477 entire compiler pipeline at -O1 or below, as well as improving the
478 residual code at -O1 or below.
479
480 * New deprecations
481
482 ** Using `uri?' as a predicate on relative-refs deprecated
483
484 If you don't care whether the URI is a relative-ref or not, use
485 `uri-reference?'. If you do, use `uri-reference?' and `relative-ref?'.
486 In the future `uri?' will return a true value only for URIs that specify
487 a scheme.
488
489 ** Struct tail arrays deprecated
490
491 Guile's structures used to have a facility whereby each instance of a
492 vtable can contain a variable-length tail array of values. The length
493 of the tail array was stored in the structure. This facility was
494 originally intended to allow C code to expose raw C structures with
495 word-sized tail arrays to Scheme.
496
497 However, the tail array facility was confusing and doesn't work very
498 well. It was very rarely used, but it insinuates itself into all
499 invocations of `make-struct'. For this reason the clumsily-named
500 `make-struct/no-tail' procedure can actually be more elegant in actual
501 use, because it doesn't have a random `0' argument stuck in the middle.
502
503 Tail arrays also inhibit optimization by allowing instances to affect
504 their shapes. In the absence of tail arrays, all instances of a given
505 vtable have the same number and kinds of fields. This uniformity can be
506 exploited by the runtime and the optimizer. The presence of tail arrays
507 make some of these optimizations more difficult.
508
509 Finally, the tail array facility is ad-hoc and does not compose with the
510 rest of Guile. If a Guile user wants an array with user-specified
511 length, it's best to use a vector. It is more clear in the code, and
512 the standard optimization techniques will do a good job with it.
513
514 For all of these reasons, tail arrays are deprecated in Guile 2.2 and
515 will be removed from Guile 3.0. Likewise, `make-struct' /
516 `scm_make_struct' is deprecated in favor of `make-struct/no-tail' /
517 `scm_make_struct_no_tail'. Perhaps one day we will be able to reclaim
518 the `make-struct' name!
519
520 ** Struct "self" slots deprecated
521
522 It used to be that you could make a structure vtable that had "self"
523 slots. Instances of that vtable would have those slots initialized to
524 the instance itself. This can be useful in C code where you might have
525 a pointer to the data array, and want to get the `SCM' handle for the
526 structure. However this was a little used complication without any use
527 in Scheme code. To replace it, just use "p" slots and initialize the
528 slot values manually on initialization.
529
530 ** Struct fields with opaque ("o") protection deprecated
531
532 Struct fields are declared with a "protection", meaning read-only ('r'),
533 read-write ('w'), or opaque ('o'). There is also "hidden" ('h') which
534 is read-write but which isn't initialized by arguments passed to
535 `make-struct/no-tail', but that's a detail. Opaque struct fields were
536 used to allocate storage in a struct that could only be accessed by C.
537 This facility was very rarely used (unused in Guile itself) but now that
538 we are implementing more and more in Scheme, it is completely useless.
539
540 To enforce permissions on struct fields, instead layer on an abstraction
541 at a higher level, in the same way that immutable record fields are
542 simply those which don't have an accessor.
543
544 ** Using `struct-ref' and `struct-set!' on unboxed fields is deprecated
545
546 Use the new `struct-ref/unboxed' and `struct-set!/unboxed' instead.
547
548 * Bug fixes
549
550 ** guile.m4 now checks for Guile 2.2 by default
551
552 Before, it was still preferring Guile 2.0. It now also supports the
553 Guile 3.0 prereleases.
554
555 ** Fix setting breakpoints from the REPL
556
557 ** Allow GDB support to be used with GDB linked against Guile 2.0.
558
559 ** Fix deadlock in `readdir' on error.
560
561 ** Fix crash on ia64 during thread switches.
562
563 ** Fix bug inferring range of `logand' computations with negative numbers
564
565 ** Fix bug when issuing HTTP requests through proxies.
566
567 ** Refactor weak hash table implementation to be more robust
568
569 Guile 2.2's weak hash table implementation had three big problems. The
570 first was a bug causing these tables to leak memory when they would be
571 resized. The second was that the implementation was designed so that
572 tables should be visited by the mark phase of the garbage collector in
573 one big piece. This could cause the garbage collector to see too many
574 newly marked objects at once, causing inefficies in garbage collection.
575 Finally, the way in which lost weak references were ultimately removed
576 from weak tables caused a race between the finalizer threads and the
577 mutator threads, leading to unbounded excess space retention in
578 pathological cases. All of this problems have been fixed.
579
580 ** Allow garbage collection of revealed file ports
581
582 Guile can mark a file port as "revealed" if Scheme has been given access
583 to the file descriptor. In that case, the file descriptor will not be
584 closed when the port is garbage-collected. However we had a bug that
585 for revealed ports prevented the port from ever being garbage-collected,
586 leading to memory leaks of Guile's internal port buffers. This is now
587 fixed.
588
589 ** Fix put-bytevector, unget-bytevector with start == bytevector length
590
591 ** Enable GNU Readline 7.0's support for "bracketed paste".
592
593 Before, when pasting an expression that contained TAB characters into
594 Guile's REPL with GNU Readline support enabled, the pasted TAB
595 characters would trigger autocompletion in Readline. This was never
596 what you wanted. Guile now sets the new "bracketed-paste" option in GNU
597 Readline 7.0 to on by default, making readline treat pastes into the
598 terminal as atomic units without control characters. See "Readline
599 Options" in the manual for full details.
600
601 ** Fix time-monotonic from SRFI-19; broken in 2.2.1.
602
603
604 Changes in 2.2.2 (since 2.2.1):
605
606 * Bug fixes
607
608 ** Syntax objects are once more comparable with 'equal?'
609
610 The syntax object change in 2.2.1 had the unintended effect of making
611 syntax objects no longer comparable with equal?. This release restores
612 the previous behavior.
613
614 ** Restore libgc dependency
615
616 The change to throw exceptions when mutating literal constants partly
617 relied on an interface that was added to our garbage collector (BDW-GC)
618 after its 7.2 release. Guile 2.2.2 adds a workaround to allow Guile to
619 continue be used with libgc as old as 7.2.
620
621 ** SRFI-37 bug fix to not error on empty-string arguments.
622
623 Thanks to Thomas Danckaert for fixing this long-standing bug.
624
625
626
627 Changes in 2.2.1 (since 2.2.0):
628
629 * Notable changes
630
631 ** New sandboxed evaluation facility
632
633 Guile now has a way to execute untrusted code in a safe way. See
634 "Sandboxed Evaluation" in the manual for full details, including some
635 important notes on limitations on the sandbox's ability to prevent
636 resource exhaustion.
637
638 ** All literal constants are read-only
639
640 According to the Scheme language definition, it is an error to attempt
641 to mutate a "constant literal". A constant literal is data that is a
642 literal quoted part of a program. For example, all of these are errors:
643
644 (set-car! '(1 . 2) 42)
645 (append! '(1 2 3) '(4 5 6))
646 (vector-set! '#(a b c) 1 'B)
647
648 Guile takes advantage of this provision of Scheme to deduplicate shared
649 structure in constant literals within a compilation unit, and to
650 allocate constant data directly in the compiled object file. If the
651 data needs no relocation at run-time, as is the case for pairs or
652 vectors that only contain immediate values, then the data can actually
653 be shared between different Guile processes, using the operating
654 system's virtual memory facilities.
655
656 However, in Guile 2.2.0, constants that needed relocation were actually
657 mutable -- though (vector-set! '#(a b c) 1 'B) was an error, Guile
658 wouldn't actually cause an exception to be raised, silently allowing the
659 mutation. This could affect future users of this constant, or indeed of
660 any constant in the compilation unit that shared structure with the
661 original vector.
662
663 Additionally, attempting to mutate constant literals mapped in the
664 read-only section of files would actually cause a segmentation fault, as
665 the operating system prohibits writes to read-only memory. "Don't do
666 that" isn't a very nice solution :)
667
668 Both of these problems have been fixed. Any attempt to mutate a
669 constant literal will now raise an exception, whether the constant needs
670 relocation or not.
671
672 ** Syntax objects are now a distinct type
673
674 It used to be that syntax objects were represented as a tagged vector.
675 These values could be forged by users to break scoping abstractions,
676 preventing the implementation of sandboxing facilities in Guile. We are
677 as embarrassed about the previous situation as we pleased are about the
678 fact that we've fixed it.
679
680 Unfortunately, during the 2.2 stable series (or at least during part of
681 it), we need to support files compiled with Guile 2.2.0. These files
682 may contain macros that contain legacy syntax object constants. See the
683 discussion of "allow-legacy-syntax-objects?" in "Syntax Transformer
684 Helpers" in the manual for full details.
685
686 * Bug fixes
687
688 *** Fix snarfing with -ggdb3 (#25803)
689 *** Fix spurious snarf warnings for net_db.c
690 *** Output statprof flat display to correct port
691 *** Document guile-2.2 cond-expand feature
692 *** Add --with-bdw-gc for BSDs that use bdw-gc-threaded (see README)
693 *** Documentation typo fixes (#26188)
694 *** Fix SRFI-9 date->string bugs with ~N and ~F (#26261, #26260, #26259)
695 *** SRFI-19 current-time-monotonic returns time of right type (#26329)
696 *** Avoid causing GC when looking up exception handler
697 *** Increment objcode version, in a compatible way
698 *** Fix compile warning in (system base types)
699 *** Only run tests that require fork if it is provided
700 *** Speed up procedure-minimum-arity for fixed arity
701 *** REPL server tests catch ECONNABORTED
702 *** Avoid deprecated argument to setvbuf in (web client)
703 *** Remove non-existent 'open-connection-for-uri' export from (web client)
704
705
706 Changes in 2.2.0 (changes since the 2.0.x stable release series):
707
708 * Notable changes
709
710 ** Speed
711
712 The biggest change in Guile 2.2 is a complete rewrite of its virtual
713 machine and compiler internals. The result is faster startup time,
714 better memory usage, and faster execution of user code. See the
715 "Performance improvements" section below for more details.
716
717 ** Better thread-safety
718
719 This new release series takes the ABI-break opportunity to fix some
720 interfaces that were difficult to use correctly from multiple threads.
721 Notably, weak hash tables and ports are now transparently thread-safe.
722 See "Scheduling" in the manual, for updated documentation on threads and
723 communications primitives.
724
725 ** Better space-safety
726
727 It used to be the case that, when calling a Scheme procedure, the
728 procedure and arguments were always preserved against garbage
729 collection. This is no longer the case; Guile is free to collect the
730 procedure and arguments if they become unreachable, or to re-use their
731 slots for other local variables. Guile still offers good-quality
732 backtraces by determining the procedure being called from the
733 instruction pointer instead of from the value in slot 0 of an
734 application frame, and by using a live variable map that allows the
735 debugger to know which locals are live at all points in a frame.
736
737 ** Off-main-thread finalization
738
739 Following Guile 2.0.6's change to invoke finalizers via asyncs, Guile
740 2.2 takes the additional step of invoking finalizers from a dedicated
741 finalizer thread, if threads are enabled. This avoids concurrency
742 issues between finalizers and application code, and also speeds up
743 finalization. If your application's finalizers are not robust to the
744 presence of threads, see "Foreign Objects" in the manual for information
745 on how to disable automatic finalization and instead run finalizers
746 manually.
747
748 ** Better locale support in Guile scripts
749
750 When Guile is invoked directly, either from the command line or via a
751 hash-bang line (e.g. "#!/usr/bin/guile"), it now installs the current
752 locale via a call to `(setlocale LC_ALL "")'. For users with a unicode
753 locale, this makes all ports unicode-capable by default, without the
754 need to call `setlocale' in your program. This behavior may be
755 controlled via the GUILE_INSTALL_LOCALE environment variable; see
756 "Environment Variables" in the manual, for more.
757
758 ** Complete Emacs-compatible Elisp implementation
759
760 Thanks to the work of Robin Templeton, Guile's Elisp implementation is
761 now fully Emacs-compatible, implementing all of Elisp's features and
762 quirks in the same way as the editor we know and love.
763
764 ** Dynamically expandable stacks
765
766 Instead of allocating fixed stack sizes for running Scheme code, Guile
767 now starts off each thread with only one page of stack, and expands and
768 shrinks it dynamically as needed. Guile will throw an exception for
769 stack overflows if growing the stack fails. It is also possible to
770 impose a stack limit during the extent of a function call. See "Stack
771 Overflow" in the manual, for more.
772
773 This change allows users to write programs that use the stack as a data
774 structure for pending computations, as it was meant to be, without
775 reifying that data out to the heap. Where you would previously make a
776 loop that collect its results in reverse order only to re-reverse them
777 at the end, now you can just recurse without worrying about stack
778 overflows.
779
780 Using the stack also allows more code to be continuation-safe. For
781 example, returning multiple times from a `map' procedure in Guile 2.0
782 would change the value of previously returned result lists, because
783 `map' built its result list in reverse order then used `reverse!' to
784 return the proper result. Now in Guile 2.2, `map' is implemented using
785 straightforward recursion, which eliminates this bug while maintaining
786 good performance as well as good space complexity.
787
788 ** Out-of-memory improvements
789
790 Instead of aborting, failures to allocate memory will now raise an
791 unwind-only `out-of-memory' exception, and cause the corresponding
792 `catch' expression to run garbage collection in order to free up memory.
793
794 ** GOOPS core reimplemented in Scheme
795
796 Guile's object orientation system, GOOPS, has been mostly reimplemented
797 in Scheme. This decreases its maintenance burden on the rest of Guile,
798 while also makes it possible to implement new features in the future,
799 such as method combinations or `eqv?' specializers.
800
801 ** Better handling of GUILE_LOAD_COMPILED_PATH
802
803 It used to be that Guile would stop at the first .go file it found in
804 the GUILE_LOAD_COMPILED_PATH. If that file turned out to be out of
805 date, then no .go file would be loaded. Now Guile will continue to
806 search the path for a file which is both present and up-to-date, with
807 respect to the .scm file.
808
809 ** C99 required
810
811 Following Emacs, you must use a C99-capable compiler when building
812 Guile. In the future we also expect require C99 to use Guile's C
813 interface, at least for `stdint' support.
814
815 ** Lightweight pre-emptive threading primitives
816
817 The compiler now inserts special "handle-interrupts" opcodes before each
818 call, return, and backwards jump target. This allows the user to
819 interrupt any computation and to accurately profile code using
820 interrupts. It used to be that interrupts were run by calling a C
821 function from the VM; now interrupt thunks are run directly from the VM.
822 This allows interrupts to save a delimited continuation and, if the
823 continuation was established from the same VM invocation (the usual
824 restriction), that continuation can then be resumed. In this way users
825 can implement lightweight pre-emptive threading facilities.
826
827 ** with-dynamic-state in VM
828
829 Similarly, `with-dynamic-state' no longer recurses out of the VM,
830 allowing captured delimited continuations that include a
831 `with-dynamic-state' invocation to be resumed. This is a precondition
832 to allow lightweight threading libraries to establish a dynamic state
833 per lightweight fiber.
834
835 * Performance improvements
836
837 ** Faster programs via new virtual machine
838
839 Guile now compiles programs to instructions for a new virtual machine.
840 The new virtual machine's instructions can address their source and
841 destination operands by "name" (slot). This makes access to named
842 temporary values much faster than in Guile 2.0, and removes a lot of
843 value-shuffling that the old virtual machine had to do. The end result
844 is that loop-heavy code can be two or three times as fast with Guile 2.2
845 as in 2.0. Your mileage may vary, of course; see "A Virtual Machine for
846 Guile" in the manual for the nitties and the gritties.
847
848 ** Better startup time, memory usage with ELF object file format
849
850 Guile now uses the standard ELF format for its compiled code. (Guile
851 has its own loader and linker, so this does not imply a dependency on
852 any particular platform's ELF toolchain.) The benefit is that Guile is
853 now able to statically allocate more data in the object files. ELF also
854 enables more sharing of data between processes, and decreases startup
855 time (about 40% faster than the already fast startup of the Guile 2.0
856 series). Guile also uses DWARF for some of its debugging information.
857 Much of the debugging information can be stripped from the object files
858 as well. See "Object File Format" in the manual, for full details.
859
860 ** Better optimizations via compiler rewrite
861
862 Guile's compiler now uses a Continuation-Passing Style (CPS)
863 intermediate language, allowing it to reason easily about temporary
864 values and control flow. Examples of optimizations that this permits
865 are optimal contification, optimal common subexpression elimination,
866 dead code elimination, loop-invariant code motion, loop peeling, loop
867 inversion, parallel moves with at most one temporary, allocation of
868 stack slots using precise liveness information, unboxing of 64-bit
869 integers and floating point values, and closure optimization. For more,
870 see "Continuation-Passing Style" in the manual.
871
872 ** Faster interpreter
873
874 Combined with a number of optimizations to the interpreter itself,
875 simply compiling `eval.scm' with the new compiler yields an interpreter
876 that is consistently two or three times faster than the one in Guile
877 2.0.
878
879 ** Allocation-free dynamic stack
880
881 Guile now implements the dynamic stack with an actual stack instead of a
882 list of heap objects, avoiding most allocation. This speeds up prompts,
883 the `scm_dynwind_*' family of functions, fluids, and `dynamic-wind'.
884
885 ** Optimized UTF-8 and Latin-1 ports, symbols, and strings
886
887 Guile 2.2 is faster at reading and writing UTF-8 and Latin-1 strings
888 from ports, and at converting symbols and strings to and from these
889 encodings.
890
891 ** Optimized hash functions
892
893 Guile 2.2 now uses Bob Jenkins' `hashword2' (from his `lookup3.c') for
894 its string hash, and Thomas Wang's integer hash function for `hashq' and
895 `hashv'. These functions produce much better hash values across all
896 available fixnum bits.
897
898 ** Optimized generic array facility
899
900 Thanks to work by Daniel Llorens, the generic array facility is much
901 faster now, as it is internally better able to dispatch on the type of
902 the underlying backing store.
903
904 ** All ports are now buffered, can be targets of `setvbuf'
905
906 See "Buffering" in the manual, for more. A port with a buffer size of 1
907 is equivalent to an unbuffered port. Ports may set their default buffer
908 sizes, and some ports (for example soft ports) are unbuffered by default
909 for historical reasons.
910
911 ** Mutexes are now faster under contention
912
913 Guile implements its own mutexes, so that threads that are trying to
914 acquire a mutex can be interrupted. These mutexes used to be quite
915 inefficient when many threads were trying to acquire them, causing many
916 spurious wakeups and contention. This has been fixed.
917
918 * New interfaces
919
920 ** New `cond-expand' feature: `guile-2.2'
921
922 Use this feature if you need to check for Guile 2.2 from Scheme code.
923
924 ** New predicate: `nil?'
925
926 See "Nil" in the manual.
927
928 ** New compiler modules
929
930 Since the compiler was rewritten, there are new modules for the back-end
931 of the compiler and the low-level loader and introspection interfaces.
932 See the "Guile Implementation" chapter in the manual for all details.
933
934 ** Add "tree" display mode for statprof.
935
936 See the newly updated "Statprof" section of the manual, for more.
937
938 ** Support for non-blocking I/O
939
940 See "Non-Blocking I/O" in the manual, for more.
941
942 ** Implement R6RS custom binary input/output ports
943
944 See "Custom Ports" in the manual.
945
946 ** Implement R6RS output-buffer-mode
947 ** Implement R6RS bytevector->string, string->bytevector
948
949 See "R6RS Transcoders" in the manual.
950
951 ** `accept' now takes optional flags argument
952
953 These flags can include `SOCK_NONBLOCK' and `SOCK_CLOEXEC', indicating
954 options to apply to the returned socket, potentially removing the need
955 for additional system calls to set these options. See "Network Sockets
956 and Communication" in the manual, for more.
957
958 ** Thread-safe atomic boxes (references)
959
960 See "Atomics" in the manual.
961
962 ** Thread-local fluids
963
964 Guile now has support for fluids whose values are not captured by
965 `current-dynamic-state' and not inheritied by child threads, and thus
966 are local to the kernel thread they run on. See "Thread-Local
967 Variables" in the manual, for more.
968
969 ** suspendable-continuation?
970
971 This predicate returns true if the delimited continuation captured by
972 aborting to a prompt would be able to be resumed. See "Prompt
973 Primitives" in the manual for more.
974
975 ** scm_c_prepare_to_wait_on_fd, scm_c_prepare_to_wait_on_cond,
976 ** scm_c_wait_finished
977
978 See "Asyncs" in the manual for more.
979
980 ** File descriptor finalizers
981
982 See "Ports and File Descriptors" in the manual.
983
984 ** New inline functions: `scm_new_smob', `scm_new_double_smob'
985
986 These can replace many uses of SCM_NEWSMOB, SCM_RETURN_NEWSMOB2, and the
987 like. See XXX in the manual, for more.
988
989 ** New low-level type accessors
990
991 For more on `SCM_HAS_TYP7', `SCM_HAS_TYP7S', `SCM_HAS_TYP16', see XXX.
992
993 `SCM_HEAP_OBJECT_P' is now an alias for the inscrutable `SCM_NIMP'.
994
995 `SCM_UNPACK_POINTER' and `SCM_PACK_POINTER' are better-named versions of
996 the old `SCM2PTR' and `PTR2SCM'. Also, `SCM_UNPACK_POINTER' yields a
997 void*.
998
999 ** `TCP_NODELAY' and `TCP_CORK' socket options, if provided by the system
1000
1001 ** `scm_c_put_latin1_chars', `scm_c_put_utf32_chars'
1002
1003 Use these instead of `scm_lfwrite'. See the new "Using Ports from C"
1004 section of the manual, for more.
1005
1006 ** <standard-vtable>, standard-vtable-fields
1007
1008 See "Structures" in the manual for more on these.
1009
1010 ** Convenience utilities for ports and strings.
1011
1012 See "Conversion to/from C" for more on `scm_from_port_string',
1013 `scm_from_port_stringn', `scm_to_port_string', and
1014 `scm_to_port_stringn'.
1015
1016 ** New expressive PEG parser
1017
1018 See "PEG Parsing" in the manual for more. Thanks to Michael Lucy for
1019 originally writing these, and to Noah Lavine for integration work.
1020
1021 ** `make-stack' now also works on delimited continuations
1022
1023 ** Better URI-reference support
1024
1025 The `(web uri)' module now has interfaces for handling URI references,
1026 which might not have a scheme. The Location header of a web request or
1027 response is now a URI reference instead of a URI. Also,
1028 `request-absolute-uri' now has an optional default scheme argument. See
1029 "Web" in the manual for full details.
1030
1031 ** formal-name->char, char->formal-name
1032
1033 See "Characters", in the manual.
1034
1035 * Incompatible changes
1036
1037 ** ASCII is not ISO-8859-1
1038
1039 In Guile 2.0, if a user set "ASCII" or "ANSI_X3.4-1968" as the encoding
1040 of a port, Guile would treat it as ISO-8859-1. While these encodings
1041 are the same for codepoints 0 to 127, ASCII does not extend past that
1042 range, whereas ISO-8859-1 goes up to 255. Guile 2.2 no longer treats
1043 ASCII as ISO-8859-1. This is likely to be a problem only if the user's
1044 locale is set to ASCII, and the user or a program writes non-ASCII
1045 codepoints to a port.
1046
1047 ** Decoding errors do not advance the read pointer before erroring
1048
1049 When the user sets a port's conversion strategy to "error", indicating
1050 that Guile should throw an error if it tries to read from a port whose
1051 incoming bytes are not valid for the port's encoding, it used to be that
1052 Guile would advance the read pointer past the bad bytes, and then throw
1053 an error. This would allow the following `read-char' invocation to
1054 proceed after the bad bytes. This behavior is incompatible with the
1055 final R6RS standard, and besides contravenes the user's intention to
1056 raise an error on bad input. Guile now raises an error without
1057 advancing the read pointer. To skip over a bad encoding, set the port
1058 conversion strategy to "substitute" and read a substitute character.
1059
1060 ** Decoding errors with `substitute' strategy return U+FFFD
1061
1062 It used to be that decoding errors with the `substitute' conversion
1063 strategy would replace the bad bytes with a `?' character. This has
1064 been changed to use the standard U+FFFD REPLACEMENT CHARACTER, in
1065 accordance with the Unicode recommendations.
1066
1067 ** API to define new port types from C has changed
1068
1069 Guile's ports have been completely overhauled to allow Guile developers
1070 and eventually Guile users to write low-level input and output routines
1071 in Scheme. The new internals will eventually allow for user-space
1072 tasklets or green threads that suspend to a scheduler when they would
1073 cause blocking I/O, allowing users to write straightforward network
1074 services that parse their input and send their output as if it were
1075 blocking, while under the hood Guile can multiplex many active
1076 connections at once.
1077
1078 At the same time, this change makes Guile's ports implementation much
1079 more maintainable, rationalizing the many legacy port internals and
1080 making sure that the abstractions between the user, Guile's core ports
1081 facility, and the port implementations result in a system that is as
1082 performant and expressive as possible.
1083
1084 The interface to the user has no significant change, neither on the C
1085 side nor on the Scheme side. However this refactoring has changed the
1086 interface to the port implementor in an incompatible way. See the newly
1087 expanded "I/O Extensions" in the manual, for full details.
1088
1089 *** Remove `scm_set_port_mark'
1090
1091 Port mark functions have not been called since the switch to the BDW
1092 garbage collector.
1093
1094 *** Remove `scm_set_port_equalp'
1095
1096 Likewise port equal functions weren't being called. Given that ports
1097 have their own internal buffers, it doesn't make sense to hook them into
1098 equal? anyway.
1099
1100 *** Remove `scm_set_port_free'
1101
1102 It used to be that if an open port became unreachable, a special "free"
1103 function would be called instead of the "close" function. Now that the
1104 BDW-GC collector allows us to run arbitrary code in finalizers, we can
1105 simplify to just call "close" on the port and remove the separate free
1106 functions. Note that hooking into the garbage collector has some
1107 overhead. For that reason Guile exposes a new interface,
1108 `scm_set_port_needs_close_on_gc', allowing port implementations to
1109 indicate to Guile whether they need closing on GC or not.
1110
1111 *** Remove `scm_set_port_end_input', `scm_set_port_flush'
1112
1113 As buffering is handled by Guile itself, these functions which were to
1114 manage an implementation-side buffer are no longer needed.
1115
1116 *** Change prototype of `scm_make_port_type'
1117
1118 The `read' (renamed from `fill_input') and `write' functions now operate
1119 on bytevectors. Also the `mode_bits' argument now inplicitly includes
1120 SCM_OPN, so you don't need to include these.
1121
1122 *** Change prototype of port `close' function
1123
1124 The port close function now returns void.
1125
1126 *** Port and port type data structures are now opaque
1127
1128 Port type implementations should now use API to access port state.
1129 However, since the change to handle port buffering centrally, port type
1130 implementations rarely need to access unrelated port state.
1131
1132 *** Port types are now `scm_t_port_type*', not a tc16 value
1133
1134 `scm_make_port_type' now returns an opaque pointer, not a tc16.
1135 Relatedly, the limitation that there only be 256 port types has been
1136 lifted.
1137
1138 ** String ports default to UTF-8
1139
1140 Guile 2.0 would use the `%default-port-encoding' when creating string
1141 ports. This resulted in ports that could only accept a subset of valid
1142 characters, which was surprising to users. Now string ports default to
1143 the UTF-8 encoding. Sneaky users can still play encoding conversion
1144 games with string ports by explicitly setting the encoding of a port
1145 after it is open. See "Ports" in the manual for more.
1146
1147 ** `scm_from_stringn' and `scm_to_stringn' encoding arguments are never NULL
1148
1149 These functions now require a valid `encoding' argument, and will abort
1150 if given `NULL'.
1151
1152 ** All r6rs ports are both textual and binary
1153
1154 Because R6RS ports are a thin layer on top of Guile's ports, and Guile's
1155 ports are both textual and binary, Guile's R6RS ports are also both
1156 textual and binary, and thus both kinds have port transcoders. This is
1157 an incompatibility with respect to R6RS.
1158
1159 ** Threading facilities moved to (ice-9 threads)
1160
1161 It used to be that call-with-new-thread and other threading primitives
1162 were available in the default environment. This is no longer the case;
1163 they have been moved to (ice-9 threads) instead. Existing code will not
1164 break, however; we used the deprecation facility to signal a warning
1165 message while also providing these bindings in the root environment for
1166 the duration of the 2.2 series.
1167
1168 ** cancel-thread uses asynchronous interrupts, not pthread_cancel
1169
1170 See "Asyncs" in the manual, for more on asynchronous interrupts.
1171
1172 ** SRFI-18 threads, mutexes, cond vars disjoint from Guile
1173
1174 When we added support for the SRFI-18 threading library in Guile 2.0, we
1175 did so in a way that made SRFI-18 mutexes the same as Guile mutexes.
1176 This was a mistake. In Guile our goal is to provide basic,
1177 well-thought-out, well-implemented, minimal primitives, on top of which
1178 we can build a variety of opinionated frameworks. Incorporating SRFI-18
1179 functionality into core Guile caused us to bloat and slow down our core
1180 threading primitives. Worse, they became very hard to describe; they
1181 did many things, did them poorly, and all that they did was never
1182 adequately specified.
1183
1184 For all of these reasons we have returned to a situation where SRFI-18
1185 concepts are implemented only in the `(srfi srfi-18)' module. This
1186 means that SRFI-18 threads are built on Guile threads, but aren't the
1187 same as Guile threads; calling Guile `thread?' on a thread no longer
1188 returns true.
1189
1190 We realize this causes inconvenience to users who use both Guile
1191 threading interfaces and SRFI-18 interfaces, and we lament the change --
1192 but we are better off now. We hope the newly revised "Scheduling"
1193 section in the manual compensates for the headache.
1194
1195 ** Remove `lock-mutex' "owner" argument
1196
1197 Mutex owners are a SRFI-18 concept; use SRFI-18 mutexes instead.
1198 Relatedly, `scm_lock_mutex_timed' taking the owner argument is now
1199 deprecated; use `scm_timed_lock_mutex' instead.
1200
1201 ** Remove `unlock-mutex' cond var and timeout arguments
1202
1203 It used to be that `unlock-mutex' included `wait-condition-variable'
1204 functionality. This has been deprecated; use SRFI-18 if you want this
1205 behavior from `mutex-unlock!'. Relatedly, `scm_unlock_mutex_timed' is
1206 deprecated; use `scm_unlock_mutex' instead.
1207
1208 ** Removed `unchecked-unlock' mutex flag
1209
1210 This flag was introduced for internal use by SRFI-18; use SRFI-18
1211 mutexes if you need this behaviour.
1212
1213 ** SRFI-18 mutexes no longer recursive
1214
1215 Contrary to specification, SRFI-18 mutexes in Guile were recursive.
1216 This is no longer the case.
1217
1218 ** Thread cleanup handlers removed
1219
1220 The `set-thread-cleanup!' and `thread-cleanup' functions that were added
1221 in Guile 2.0 to support cleanup after thread cancellation are no longer
1222 needed, since threads can declare cleanup handlers via `dynamic-wind'.
1223
1224 ** Only threads created by Guile are joinable
1225
1226 `join-thread' used to work on "foreign" threads that were not created by
1227 Guile itself, though their join value was always `#f'. This is no
1228 longer the case; attempting to join a foreign thread will throw an
1229 error.
1230
1231 ** Dynamic states capture values, not locations
1232
1233 Dynamic states used to capture the locations of fluid-value
1234 associations. Capturing the current dynamic state then setting a fluid
1235 would result in a mutation of that captured state. Now capturing a
1236 dynamic state simply captures the current values, and calling
1237 `with-dynamic-state' copies those values into the Guile virtual machine
1238 instead of aliasing them in a way that could allow them to be mutated in
1239 place. This change allows Guile's fluid variables to be thread-safe.
1240 To capture the locations of a dynamic state, capture a
1241 `with-dynamic-state' invocation using partial continuations instead.
1242
1243 ** Remove `frame-procedure'
1244
1245 Several optimizations in Guile make `frame-procedure' an interface that
1246 we can no longer support. For background, `frame-procedure' used to
1247 return the value at slot 0 in a frame, which usually corresponds to the
1248 SCM value of the procedure being applied. However it could be that this
1249 slot is re-used for some other value, because the closure was not needed
1250 in the function. Such a re-use might even be for an untagged value, in
1251 which case treating slot 0 as a SCM value is quite dangerous. It's also
1252 possible that so-called "well-known" closures (closures whose callers
1253 are all known) are optimized in such a way that slot 0 is not a
1254 procedure but some optimized representation of the procedure's free
1255 variables. Instead, developers building debugging tools that would like
1256 access to `frame-procedure' are invited to look at the source for the
1257 `(system vm frame)' module for alternate interfaces, including the new
1258 `frame-procedure-name'.
1259
1260 ** Remove `,procedure' REPL command
1261
1262 Not all procedures have values, so it doesn't make sense to expose this
1263 interface to the user. Instead, the `,locals' REPL command will include
1264 the callee, if it is live.
1265
1266 ** Remove `frame-local-ref', `frame-local-set!', `frame-num-locals'
1267
1268 These procedures reference values in a frame on the stack. Since we now
1269 have unboxed values of different kinds, it is now necessary to specify
1270 the type when reference locals, and once this incompatible change needs
1271 to be made, we might as well make these interfaces private. See
1272 "Frames' in the manual, for more information on the replacements for
1273 these low-level interfaces.
1274
1275 ** Vtable hierarchy changes
1276
1277 In an attempt to make Guile's structure and record types integrate
1278 better with GOOPS by unifying the vtable hierarchy, `make-vtable-vtable'
1279 is now deprecated. Instead, users should just use `make-vtable' with
1280 appropriate arguments. See "Structures" in the manual for all of the
1281 details. As such, `record-type-vtable' and `%condition-type-vtable' now
1282 have a parent vtable and are no longer roots of the vtable hierarchy.
1283
1284 ** Syntax parameters are a distinct type
1285
1286 Guile 2.0's transitional implementation of `syntax-parameterize' was
1287 based on the `fluid-let-syntax' interface inherited from the psyntax
1288 expander. This interface allowed any binding to be dynamically rebound
1289 -- even bindings like `lambda'. This is no longer the case in Guile
1290 2.2. Syntax parameters must be defined via `define-syntax-parameter',
1291 and only such bindings may be parameterized. See "Syntax Parameters" in
1292 the manual for more.
1293
1294 ** Defined identifiers scoped in the current module
1295
1296 Sometimes Guile's expander would attach incorrect module scoping
1297 information for top-level bindings made by an expansion. For example,
1298 given the following R6RS library:
1299
1300 (library (defconst)
1301 (export defconst)
1302 (import (guile))
1303 (define-syntax-rule (defconst name val)
1304 (begin
1305 (define t val)
1306 (define-syntax-rule (name) t))))
1307
1308 Attempting to use it would produce an error:
1309
1310 (import (defconst))
1311 (defconst foo 42)
1312 (foo)
1313 =| Unbound variable: t
1314
1315 It wasn't clear that we could fix this in Guile 2.0 without breaking
1316 someone's delicate macros, so the fix is only coming out now.
1317
1318 ** Pseudo-hygienically rename macro-introduced bindings
1319
1320 Bindings introduced by macros, like `t' in the `defconst' example above,
1321 are now given pseudo-fresh names. This allows
1322
1323 (defconst foo 42)
1324 (defconst bar 37)
1325
1326 to introduce different bindings for `t'. These pseudo-fresh names are
1327 made in such a way that if the macro is expanded again, for example as
1328 part of a simple recompilation, the introduced identifiers get the same
1329 pseudo-fresh names. See "Hygiene and the Top-Level" in the manual, for
1330 details.
1331
1332 ** Fix literal matching for module-bound literals
1333
1334 `syntax-rules' and `syntax-case' macros can take a set of "literals":
1335 bound or unbound keywords that the syntax matcher treats specially.
1336 Before, literals were always matched symbolically (by name). Now they
1337 are matched by binding. This allows literals to be reliably bound to
1338 values, renamed by imports or exports, et cetera. See "Syntax-rules
1339 Macros" in the manual for more on literals.
1340
1341 ** Fix bug importing specific bindings with #:select
1342
1343 It used to be that if #:select didn't find a binding in the public
1344 interface of a module, it would actually grovel in the module's
1345 unexported private bindings. This was not intended and is now fixed.
1346
1347 ** Statically scoped module duplicate handlers
1348
1349 It used to be that if a module did not specify a #:duplicates handler,
1350 when a name was first referenced in that module and multiple imported
1351 modules provide that name, the value of the
1352 `default-duplicate-binding-handlers' parameter would be used to resolve
1353 the duplicate bindings. We have changed so that instead a module
1354 defaults to the set of handlers described in the manual. If the module
1355 specifies #:duplicates, of course we use that. The
1356 `default-duplicate-binding-handlers' parameter now simply accesses the
1357 handlers of the current module, instead of some global value.
1358
1359 ** Fix too-broad capture of dynamic stack by delimited continuations
1360
1361 Guile was using explicit stacks to represent, for example, the chain of
1362 current exception handlers. This means that a delimited continuation
1363 that captured a "catch" expression would capture the whole stack of
1364 exception handlers, not just the exception handler added by the "catch".
1365 This led to strangeness when resuming the continuation in some other
1366 context like other threads; "throw" could see an invalid stack of
1367 exception handlers. This has been fixed by the addition of the new
1368 "fluid-ref*" procedure that can access older values of fluids; in this
1369 way the exception handler stack is now implicit. See "Fluids and
1370 Dynamic States" in the manual, for more on fluid-ref*.
1371
1372 ** `dynamic-wind' doesn't check that guards are thunks
1373
1374 Checking that the dynamic-wind out-guard procedure was actually a thunk
1375 before doing the wind was slow, unreliable, and not strictly needed.
1376
1377 ** All deprecated code removed
1378
1379 All code deprecated in Guile 2.0 has been removed. See older NEWS, and
1380 check that your programs can compile without linker warnings and run
1381 without runtime warnings. See "Deprecation" in the manual.
1382
1383 In particular, the following functions, which were deprecated in 2.0.10
1384 but not specifically mentioned earlier in this file, have been removed:
1385
1386 *** `uniform-vector-read!' and `uniform-vector-write' have been
1387 removed. Use `get-bytevector-n!' and `put-bytevector' from (rnrs io
1388 ports) instead.
1389
1390 ** Remove miscellaneous unused interfaces
1391
1392 We have removed accidentally public, undocumented interfaces that we
1393 think are not used, and not useful. This includes `scm_markstream',
1394 `SCM_FLUSH_REGISTER_WINDOWS', `SCM_THREAD_SWITCHING_CODE', `SCM_FENCE',
1395 `scm_call_generic_0', `scm_call_generic_1', `scm_call_generic_2'
1396 `scm_call_generic_3', `scm_apply_generic', and `scm_program_source'.
1397 `scm_async_click' was renamed to `scm_async_tick', and `SCM_ASYNC_TICK'
1398 was made private (use `SCM_TICK' instead).
1399
1400 ** Many internal compiler / VM changes
1401
1402 As the compiler and virtual machine were re-written, there are many
1403 changes in the back-end of Guile to interfaces that were introduced in
1404 Guile 2.0. These changes are only only of interest if you wrote a
1405 language on Guile 2.0 or a tool using Guile 2.0 internals. If this is
1406 the case, drop by the IRC channel to discuss the changes.
1407
1408 ** Defining a SMOB or port type no longer mucks exports of `(oop goops)'
1409
1410 It used to be that defining a SMOB or port type added an export to
1411 GOOPS, for the wrapper class of the smob type. This violated
1412 modularity, though, so we have removed this behavior.
1413
1414 ** Bytecode replaces objcode as a target language
1415
1416 One way in which people may have used details of Guile's runtime in
1417 Guile 2.0 is in compiling code to thunks for later invocation. Instead
1418 of compiling to objcode and then calling `make-program', now the way to
1419 do it is to compile to `bytecode' and then call `load-thunk-from-memory'
1420 from `(system vm loader)'.
1421
1422 ** Weak pairs removed
1423
1424 Weak pairs were not safe to access with `car' and `cdr', and so were
1425 removed.
1426
1427 ** Weak alist vectors removed
1428
1429 Use weak hash tables instead.
1430
1431 ** Weak vectors may no longer be accessed via `vector-ref' et al
1432
1433 Weak vectors may no longer be accessed with the vector interface. This
1434 was a source of bugs in the 2.0 Guile implementation, and a limitation
1435 on using vectors as building blocks for other abstractions. Vectors in
1436 Guile are now a concrete type; for an abstract interface, use the
1437 generic array facility (`array-ref' et al).
1438
1439 ** scm_t_array_implementation removed
1440
1441 This interface was introduced in 2.0 but never documented. It was a
1442 failed attempt to layer the array implementation that actually
1443 introduced too many layers, as it prevented the "vref" and "vset"
1444 members of scm_t_array_handle (called "ref" and "set" in 1.8, not
1445 present in 2.0) from specializing on array backing stores.
1446
1447 Notably, the definition of scm_t_array_handle has now changed, to not
1448 include the (undocumented) "impl" member. We are sorry for any
1449 inconvenience this may cause.
1450
1451 ** `scm_make' is now equivalent to Scheme `make'
1452
1453 It used to be that `scm_make' only implemented a hard-wired object
1454 allocation and initialization protocol. This was because `scm_make' was
1455 used while GOOPS booted its own, more complete `make' implementation in
1456 Scheme. Now that we've re-implemented everything in Scheme, the C
1457 `scm_make' now dispatches directly to Scheme `make', which implements
1458 the full protocol. This change is incompatible in some ways, but on the
1459 whole is good news for GOOPS users.
1460
1461 ** GOOPS slot definitions are now objects
1462
1463 Slot definitions are now instances of a <slot> class, instead of being
1464 specially formatted lists. To most user code, this is transparent, as
1465 the slot definition accessors like `slot-definition-name' continue to
1466 work. However, code that for example uses `car' to get the name of a
1467 slot definition will need to be updated to use the accessors.
1468
1469 ** Class slot changes
1470
1471 Class objects no longer have a `default-slot-definition-class' slot,
1472 which was never used. They also no longer have slots for hashsets
1473 (`h0', `h1', and so on up to `h7'), which have been unused since Guile
1474 2.0 and were not a great idea.
1475
1476 There is a new class option, `#:static-slot-allocation?'. See the
1477 manual for details.
1478
1479 ** Removal of internal, unintentionally exposed GOOPS C interfaces
1480
1481 These include: `scm_sys_fast_slot_ref', `scm_sys_fast_slot_set_x'
1482 `scm_basic_basic_make_class', `scm_sys_compute_slots',
1483 `scm_sys_prep_layout_x' `scm_t_method', `SCM_METHOD',
1484 `scm_s_slot_set_x', `SCM_CLASS_CLASS_LAYOUT', `scm_si_slotdef_class',
1485 `scm_si_generic_function', `scm_si_specializers', `scm_si_procedure',
1486 `scm_si_formals', `scm_si_body', `scm_si_make_procedure',
1487 `SCM_CLASS_CLASS_LAYOUT', `SCM_INSTANCE_HASH', `SCM_SET_HASHSET', `union
1488 scm_t_debug_info', `scm_pure_generic_p', `SCM_PUREGENERICP',
1489 `SCM_VALIDATE_PUREGENERIC', `SCM_VTABLE_FLAG_GOOPS_PURE_GENERIC',
1490 `SCM_CLASSF_PURE_GENERIC', `scm_c_extend_primitive_generic',
1491 `scm_sys_initialize_object', `SCM_CLASS_CLASS_LAYOUT',
1492 `scm_si_redefined', `scm_si_direct_supers', `scm_si_direct_slots',
1493 `scm_si_direct_subclasses', `scm_si_direct_methods', `scm_si_cpl'
1494 `scm_si_slots', `scm_si_getters_n_setters', `SCM_N_CLASS_SLOTS',
1495 `SCM_OBJ_CLASS_REDEF', `SCM_INST', `SCM_ACCESSORS_OF',
1496 `scm_sys_allocate_instance', and `scm_sys_invalidate_class_x'.
1497
1498 * New deprecations
1499
1500 ** `SCM_FDES_RANDOM_P'
1501
1502 Instead, use `lseek (fd, 0, SEEK_CUR)' directly.
1503
1504 ** `_IONBF', `_IOLBF', and `_IOFBF'
1505
1506 Instead, use the symbol values `none', `line', or `block', respectively,
1507 as arguments to the `setvbuf' function.
1508
1509 ** `SCM_FDES_RANDOM_P'
1510
1511 Instead, use `lseek (fd, 0, SEEK_CUR)' directly.
1512
1513 ** Arbiters
1514
1515 Arbiters were an experimental mutual exclusion facility from 20 years
1516 ago that didn't survive the test of time. Use mutexes or atomic boxes
1517 instead.
1518
1519 ** User asyncs
1520
1521 Guile had (and still has) "system asyncs", which are asynchronous
1522 interrupts, and also had this thing called "user asyncs", which was a
1523 trivial unused data structure. Now that we have deprecated the old
1524 `async', `async-mark', and `run-asyncs' procedures that comprised the
1525 "user async" facility, we have been able to clarify our documentation to
1526 only refer to "asyncs".
1527
1528 ** Critical sections
1529
1530 Critical sections have long been just a fancy way to lock a mutex and
1531 defer asynchronous interrupts. Instead of SCM_CRITICAL_SECTION_START,
1532 make sure you're in a "scm_dynwind_begin (0)" and use
1533 scm_dynwind_pthread_mutex_lock instead, possibly also with
1534 scm_dynwind_block_asyncs.
1535
1536 ** `scm_make_mutex_with_flags'
1537
1538 Use `scm_make_mutex_with_kind' instead. See "Mutexes and Condition
1539 Variables" in the manual, for more.
1540
1541 ** Dynamic roots
1542
1543 This was a facility that predated threads, was unused as far as we can
1544 tell, and was never documented. Still, a grep of your code for
1545 dynamic-root or dynamic_root would not be amiss.
1546
1547 ** `make-dynamic-state'
1548
1549 Use `current-dynamic-state' to get an immutable copy of the current
1550 fluid-value associations.
1551
1552 ** `with-statprof' macro
1553
1554 Use the `statprof' procedure instead.
1555
1556 ** SCM_WTA_DISPATCH_0, SCM_WTA_DISPATCH_1, SCM_WTA_DISPATCH_2, SCM_WTA_DISPATCH_N
1557 ** SCM_GASSERT0, SCM_GASSERT1, SCM_GASSERT2, SCM_GASSERTn
1558 ** SCM_WTA_DISPATCH_1_SUBR
1559
1560 These macros were used in dispatching primitive generics. They can be
1561 replaced by using C functions (the same name but in lower case), if
1562 needed, but this is a hairy part of Guile that perhaps you shouldn't be
1563 using.
1564
1565 ** scm_compute_applicable_methods and scm_find_method
1566
1567 Use `compute-applicable-methods' from Scheme instead.
1568
1569 ** scm_no_applicable_method
1570
1571 Fetch no-applicable-method from the GOOPS exports if you need it.
1572
1573 ** scm_class_boolean, scm_class_char, scm_class_pair
1574 ** scm_class_procedure, scm_class_string, scm_class_symbol
1575 ** scm_class_primitive_generic, scm_class_vector, scm_class_null
1576 ** scm_class_real, scm_class_complex, scm_class_integer
1577 ** scm_class_fraction, scm_class_unknown, scm_class_top
1578 ** scm_class_object, scm_class_class, scm_class_applicable
1579 ** scm_class_applicable_struct, scm_class_applicable_struct_with_setter
1580 ** scm_class_generic, scm_class_generic_with_setter, scm_class_accessor
1581 ** scm_class_extended_generic, scm_class_extended_generic_with_setter
1582 ** scm_class_extended_accessor, scm_class_method
1583 ** scm_class_accessor_method, scm_class_procedure_class
1584 ** scm_class_applicable_struct_class, scm_class_number, scm_class_list
1585 ** scm_class_keyword, scm_class_port, scm_class_input_output_port
1586 ** scm_class_input_port, scm_class_output_port, scm_class_foreign_slot
1587 ** scm_class_self, scm_class_protected, scm_class_hidden
1588 ** scm_class_opaque, scm_class_read_only, scm_class_protected_hidden
1589 ** scm_class_protected_opaque, scm_class_protected_read_only
1590 ** scm_class_scm, scm_class_int, scm_class_float, scm_class_double
1591 ** scm_port_class, scm_smob_class
1592
1593 These class exports are now deprecated. Instead, look up the ones you
1594 need from the GOOPS module, or use `scm_class_of' on particular values.
1595
1596 ** scm_get_keyword
1597
1598 Instead from Scheme use kw-arg-ref or real keyword arguments, and from C
1599 use `scm_c_bind_keyword_arguments'.
1600
1601 ** scm_slot_ref_using_class, scm_slot_set_using_class_x
1602 ** scm_slot_bound_using_class_p, scm_slot_exists_using_class_p
1603
1604 Instead use the normal `scm_slot_ref' and similar procedures.
1605
1606 * Changes to the distribution
1607
1608 ** Pre-built binary files in the tarball
1609
1610 Building Guile from a tarball can now take advantage of a "prebuilt/"
1611 tree of prebuilt .go files. These compiled files are created when a
1612 tarball is made, and are used to speed up the build for users of
1613 official releases.
1614
1615 These pre-built binaries are not necessary, however: they are not stored
1616 in revision control and can always be re-created from the source, given
1617 that Guile can bootstrap itself from its minimal bootstrap C
1618 interpreter. If you do not want to depend on these pre-built binaries,
1619 you can "make -C prebuilt clean" before building.
1620
1621 ** New minor version
1622
1623 The "effective version" of Guile is now 2.2, which allows parallel
1624 installation with other effective versions (for example, the older Guile
1625 2.0). See "Parallel Installations" in the manual for full details.
1626 Notably, the `pkg-config' file is now `guile-2.2'.
1627
1628 ** Bump required libgc version to 7.2, released March 2012.
1629
1630 ** GUILE_PROGS searches for versioned Guile
1631
1632 The GUILE_PROGS autoconf macro can take a required version argument. As
1633 a new change, that version argument is additionally searched for as a
1634 suffix. For example, GUILE_PROGS(2.2) would look for guile-2.2,
1635 guile2.2, guile-2, guile2, and then guile. The found prefix is also
1636 applied to guild, guile-config, and the like. Thanks to Freja Nordsiek
1637 for this work.
1638
1639 ** The readline extension is now installed in the extensionsdir
1640
1641 The shared library that implements Guile's readline extension is no
1642 longer installed to the libdir. This change should be transparent to
1643 users, but packagers may be interested.
1644
1645
1646
1647 Changes in 2.0.14 (since 2.0.13):
1648
1649 * Bug fixes
1650
1651 ** Builds of .go files and of Guile itself are now bit-reproducible
1652 (<http://bugs.gnu.org/20272>)
1653
1654 ** 'number->locale-string' and 'monetary-amount->locale-string' fixes
1655 (<http://bugs.gnu.org/24990>)
1656
1657 ** (system base target) now recognizes "sh3" as a cross-compilation target
1658
1659 ** Fix race condition in '00-repl-server.test'
1660 (<http://bugs.gnu.org/24769>)
1661
1662 ** 'scandir' from (ice-9 ftw) no longer calls 'stat' for each entry
1663
1664 ** Several documentation improvements
1665
1666
1667 Changes in 2.0.13 (since 2.0.12):
1668
1669 * Security fixes
1670
1671 ** CVE-2016-8606: REPL server now protects against HTTP inter-protocol
1672 attacks
1673
1674 Guile 2.x provides a "REPL server" started by the '--listen'
1675 command-line option or equivalent API (see "REPL Servers" in the
1676 manual).
1677
1678 The REPL server is vulnerable to the HTTP inter-protocol attack as
1679 described at
1680 <https://en.wikipedia.org/wiki/Inter-protocol_exploitation>, notably the
1681 HTML form protocol attack described at
1682 <https://www.jochentopf.com/hfpa/hfpa.pdf>. A "DNS rebinding attack"
1683 can be combined with this attack and allow an attacker to send arbitrary
1684 Guile code to the REPL server through web pages accessed by the
1685 developer, even though the REPL server is listening to a loopback device
1686 ("localhost"). This was demonstrated in an article entitled "How to
1687 steal any developer's local database" available at
1688 <http://bouk.co/blog/hacking-developers/>.
1689
1690 The REPL server in Guile 2.0.13 now detects attempts to exploit this
1691 vulnerability. It immediately closes the connection when it receives a
1692 line that looks like an HTTP request.
1693
1694 Nevertheless, we recommend binding the REPL server to a Unix-domain
1695 socket, for instance by running:
1696
1697 guile --listen=/tmp/guile-socket
1698
1699 ** CVE-2016-8605: 'mkdir' procedure no longer calls umask(2)
1700 (<http://bugs.gnu.org/24659>)
1701
1702 When the second argument to the 'mkdir' procedure was omitted, it would
1703 call umask(0) followed by umask(previous_umask) and apply the umask to
1704 mode #o777.
1705
1706 This was unnecessary and a security issue for multi-threaded
1707 applications: during a small window the process' umask was set to zero,
1708 so other threads calling mkdir(2) or open(2) could end up creating
1709 world-readable/writable/executable directories or files.
1710
1711 * New interfaces
1712
1713 ** mkstemp! takes optional "mode" argument
1714
1715 See "File System" in the manual, for more.
1716
1717 ** New 'scm_to_uintptr_t' and 'scm_from_uintptr_t' C functions
1718
1719 * Bug fixes
1720
1721 ** Fix optimizer bug when compiling fixpoint operator
1722 ** Fix build error on MinGW
1723 ** Update 'uname' implementation on MinGW
1724 ** 'port-encoding' and 'set-port-encoding!' ensure they are passed an
1725 open port
1726 ** (system base target) now recognizes Alpha as a cross-compilation target
1727
1728
1729 Changes in 2.0.12 (since 2.0.11):
1730
1731 * Notable changes
1732
1733 ** FFI: Add support for functions that set 'errno'
1734
1735 When accessing POSIX functions from a system's libc via Guile's dynamic
1736 FFI, you commonly want to access the 'errno' variable to be able to
1737 produce useful diagnostic messages.
1738
1739 This is now possible using 'pointer->procedure' or
1740 'scm_pointer_to_procedure_with_errno'. See "Dynamic FFI" in the manual.
1741
1742 ** The #!r6rs directive now influences read syntax
1743
1744 The #!r6rs directive now changes the per-port reader options to make
1745 Guile's reader conform more closely to the R6RS syntax. In particular:
1746
1747 - It makes the reader case sensitive.
1748 - It disables the recognition of keyword syntax in conflict with the
1749 R6RS (and R5RS).
1750 - It enables the `square-brackets', `hungry-eol-escapes' and
1751 `r6rs-hex-escapes' reader options.
1752
1753 ** 'read' now accepts "\(" as equivalent to "("
1754
1755 This is indented for use at the beginning of lines in multi-line strings
1756 to avoid confusing Emacs' lisp modes. Previously "\(" was an error.
1757
1758 ** SRFI-14 character data set upgraded to Unicode 8.0.0
1759
1760 ** SRFI-19 table of leap seconds updated
1761
1762 ** 'string-hash', 'read-string', and 'write' have been optimized
1763
1764 ** GOOPS bug fix for inherited accessor methods
1765
1766 In the port of GOOPS to Guile 2.0, we introduced a bug related to
1767 accessor methods. The bug resulted in GOOPS assuming that a slot S in
1768 an object whose class is C would always be present in instances of all
1769 subclasses C, and allocated to the same struct index. This is not the
1770 case for multiple inheritance. This behavior has been fixed to be as it
1771 was in 1.8.
1772
1773 One aspect of this change may cause confusion among users. Previously
1774 if you defined a class C:
1775
1776 (use-modules (oop goops))
1777 (define-class C ()
1778 (a #:getter get-a))
1779
1780 And now you define a subclass, intending to provide an #:init-value for
1781 the slot A:
1782
1783 (define-class D (A)
1784 (a #:init-value 42))
1785
1786 Really what you have done is define in D a new slot with the same name,
1787 overriding the existing slot. The problem comes in that before fixing
1788 this bug (but not in 1.8), the getter 'get-a' would succeed for
1789 instances of D, even though 'get-a' should only work for the slot 'a'
1790 that is defined on class C, not any other slot that happens to have the
1791 same name and be in a class with C as a superclass.
1792
1793 It would be possible to "merge" the slot definitions on C and D, but
1794 that part of the meta-object protocol (`compute-slots' et al) is not
1795 fully implemented.
1796
1797 Somewhat relatedly, GOOPS also had a fix around #:init-value on
1798 class-allocated slots. GOOPS was re-initializing the value of slots
1799 with #:class or #:each-subclass allocation every time instances of that
1800 class was allocated. This has been fixed.
1801
1802 * New interfaces
1803
1804 ** New SRFI-28 string formatting implementation
1805
1806 See "SRFI-28" in the manual.
1807
1808 ** New (ice-9 unicode) module
1809
1810 See "Characters" in the manual.
1811
1812 ** Web server
1813
1814 The (web server) module now exports 'make-server-impl', 'server-impl?',
1815 and related procedures. Likewise, (web server http) exports 'http'.
1816
1817 ** New procedures: 'string-utf8-length' and 'scm_c_string_utf8_length'
1818
1819 See "Bytevectors as Strings" in the manual, for more.
1820
1821 ** New 'EXIT_SUCCESS' and 'EXIT_FAILURE' Scheme variables
1822
1823 See "Processes" in the manual.
1824
1825 ** New C functions to disable automatic SMOB finalization
1826
1827 The new 'scm_set_automatic_finalization_enabled' C function allows you
1828 to choose whether automatic object finalization should be enabled (as
1829 was the case until now, and still is by default.) This is meant for
1830 applications that are not thread-safe nor async-safe; such applications
1831 can disable automatic finalization and call the new 'scm_run_finalizers'
1832 function when appropriate.
1833
1834 See the "Garbage Collecting Smobs" and "Smobs" sections in the manual.
1835
1836 ** Cross-compilation to ARM
1837
1838 More ARM cross-compilation targets are supported: "arm.*eb",
1839 "^aarch64.*be", and "aarch64".
1840
1841 * New deprecation
1842
1843 ** The undocumented and unused C function 'scm_string_hash' is now deprecated
1844
1845 * Bugs fixed
1846
1847 ** Compiler
1848 *** 'call-with-prompt' does not truncate multiple-value returns
1849 (<http://bugs.gnu.org/14347>)
1850 *** Use permissions of source file for compiled file
1851 (<http://bugs.gnu.org/18477>)
1852 *** Fix bug when inlining some functions with optional arguments
1853 (<http://bugs.gnu.org/17634>)
1854 *** Avoid quadratic expansion time in 'and' and 'or' macros
1855 (<http://bugs.gnu.org/17147>)
1856 *** Fix expander bug introduced when adding support for tail patterns
1857 (<http://lists.gnu.org/archive/html/guile-user/2015-09/msg00017.html>)
1858 *** Handle ~p in 'format' warnings (<http://bugs.gnu.org/18299>)
1859 *** Fix bug that exposed `list' invocations to CSE
1860 (<http://bugs.gnu.org/21899>)
1861 *** Reduce eq? and eqv? over constants using equal?
1862 (<http://bugs.gnu.org/21855>)
1863 *** Skip invalid .go files found in GUILE_LOAD_COMPILED_PATH
1864
1865 ** Threads
1866 *** Fix data races leading to corruption (<http://bugs.gnu.org/22152>)
1867
1868 ** Memory management
1869 *** Fix race between SMOB marking and finalization
1870 (<http://bugs.gnu.org/19883>)
1871
1872 ** Ports
1873 *** Fix port position handling on binary input ports
1874 (<http://bugs.gnu.org/20302>)
1875 *** Bytevector and custom binary ports to use ISO-8859-1
1876 (<http://bugs.gnu.org/20200>)
1877 *** Fix buffer overrun with unbuffered custom binary input ports
1878 (<http://bugs.gnu.org/19621>)
1879 *** Fix memory corruption that arose when using 'get-bytevector-n'
1880 (<http://bugs.gnu.org/17466>)
1881
1882 ** System
1883 *** {get,set}sockopt now expect type 'int' for SO_SNDBUF/SO_RCVBUF
1884 *** 'system*' now available on MS-Windows
1885 *** 'open-pipe' now available on MS-Windows
1886 *** Better support for file names containing backslashes on Windows
1887
1888 ** Web
1889 *** 'split-and-decode-uri-path' no longer decodes "+" to space
1890 *** HTTP: Support date strings with a leading space for hours
1891 (<http://bugs.gnu.org/23421>)
1892 *** HTTP: Accept empty reason phrases (<http://bugs.gnu.org/22273>)
1893 *** HTTP: 'Location' header can now contain URI references, not just
1894 absolute URIs
1895 *** HTTP: Improve chunked-mode support (<http://bugs.gnu.org/19939>)
1896 *** HTTP: 'open-socket-for-uri' now sets better OS buffering parameters
1897 (<http://bugs.gnu.org/15368>)
1898
1899 ** Miscellaneous
1900 *** Fix 'atan' procedure when applied to complex numbers
1901 *** Fix Texinfo to HTML conversion for @itemize and @acronym
1902 (<http://bugs.gnu.org/21772>)
1903 *** 'bytevector-fill!' accepts fill arguments greater than 127
1904 (<http://bugs.gnu.org/19027>)
1905 *** 'bytevector-copy' correctly copies SRFI-4 homogeneous vectors
1906 (<http://bugs.gnu.org/18866>)
1907 *** 'strerror' no longer hangs when passed a non-integer argument
1908 (<http://bugs.gnu.org/18065>)
1909 *** 'scm_boot_guile' now gracefully handles argc == 0
1910 (<http://bugs.gnu.org/18680>)
1911 *** Fix 'SCM_SMOB_OBJECT_LOC' definition (<http://bugs.gnu.org/18495>)
1912 *** Fix bug where 'bit-count*' was not using its second argument
1913 *** SRFI-1 'length+' raises an error for non-lists and dotted lists
1914 (<http://bugs.gnu.org/17296>)
1915 *** Add documentation for SXPath (<http://bugs.gnu.org/19478>)
1916
1917
1918 Changes in 2.0.11 (since 2.0.10):
1919
1920 This release fixes an embarrassing regression introduced in the C
1921 interface to SRFI-4 vectors. See
1922 <https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00047.html>
1923 for details.
1924
1925
1926 Changes in 2.0.10 (since 2.0.9):
1927
1928 * Notable changes
1929
1930 ** New GDB extension to support Guile
1931
1932 Guile now comes with an extension for GDB 7.8 or later (unreleased at
1933 the time of writing) that simplifies debugging of C code that uses
1934 Guile. See "GDB Support" in the manual.
1935
1936 ** Improved integration between R6RS and native Guile exceptions
1937
1938 R6RS exception handlers, established using 'with-exception-handler' or
1939 'guard', are now able to catch native Guile exceptions, which are
1940 automatically converted into appropriate R6RS condition objects.
1941
1942 ** Support for HTTP proxies
1943
1944 Guile's built-in web client now honors the 'http_proxy' environment
1945 variable, as well as the new 'current-http-proxy' parameter. See
1946 "Web Client" in the manual for details.
1947
1948 ** Lexical syntax improvements
1949
1950 *** Support |...| symbol notation.
1951
1952 Guile's core reader and printer now support the R7RS |...| notation
1953 for writing symbols with arbitrary characters, as a more portable and
1954 attractive alternative to Guile's native #{...}# notation. To enable
1955 this notation by default, put one or both of the following in your
1956 ~/.guile:
1957
1958 (read-enable 'r7rs-symbols)
1959 (print-enable 'r7rs-symbols)
1960
1961 *** Support '#true' and '#false' notation for booleans.
1962
1963 The booleans '#t' and '#f' may now be written as '#true' and '#false'
1964 for improved readability, per R7RS.
1965
1966 *** Recognize '#\escape' character name.
1967
1968 The escape character '#\esc' may now be written as '#\escape', per R7RS.
1969
1970 *** Accept "\|" in string literals.
1971
1972 The pipe character may now be preceded by a backslash, per R7RS.
1973
1974 ** Custom binary input ports now support 'setvbuf'.
1975
1976 Until now, ports returned by 'make-custom-binary-input-port' were always
1977 full-buffered. Now, their buffering mode can be changed using 'setvbuf'.
1978
1979 ** SRFI-4 predicates and length accessors no longer accept arrays.
1980
1981 Given that the SRFI-4 accessors don't work for arrays, the fact that the
1982 predicates and length accessors returned true for arrays was a bug.
1983
1984 ** GUILE_PROGS now supports specifying a minimum required version.
1985
1986 The 'GUILE_PROGS' autoconf macro in guile.m4 now allows an optional
1987 argument to specify a minimum required Guile version. By default, it
1988 requires Guile >= 2.0. A micro version can also be specified, e.g.:
1989 GUILE_PROGS([2.0.10])
1990
1991 ** Error reporting improvements
1992
1993 *** Improved run-time error reporting in (ice-9 match).
1994
1995 If no pattern matches in a 'match' form, the datum that failed to match
1996 is printed along with the location of the failed 'match' invocation.
1997
1998 *** Print the faulty object upon invalid-keyword errors.
1999 *** Improved error reporting of procedures defined by define-inlinable.
2000 *** Improved error reporting for misplaced ellipses in macro definitions.
2001 *** Improved error checking in 'define-public' and 'module-add!'.
2002 *** Improved error when 'include' form with relative path is not in a file.
2003
2004 ** Speed improvements
2005
2006 *** 'scm_c_read' on ISO-8859-1 (e.g. binary) unbuffered ports is faster.
2007 *** New inline asm for VM fixnum multiply, for faster overflow checking.
2008 *** New inline asm for VM fixnum operations on ARM and 32-bit x86.
2009 *** 'positive?' and 'negative?' are now compiled to VM primitives.
2010 *** Numerical comparisons with more than 2 arguments are compiled to VM code.
2011 *** Several R6RS bitwise operators have been optimized.
2012
2013 ** Miscellaneous
2014
2015 *** Web: 'content-disposition' headers are now supported.
2016 *** Web: 'uri-encode' hexadecimal percent-encoding is now uppercase.
2017 *** Size argument to 'make-doubly-weak-hash-table' is now optional.
2018 *** Timeout for 'unlock-mutex' and SRFI-18 'mutex-unlock!' may now be #f.
2019
2020 ** Gnulib update
2021
2022 Guile's copy of Gnulib was updated to v0.1-92-g546ff82. The following
2023 modules were imported from Gnulib: copysign, fsync, isfinite, link,
2024 lstat, mkdir, mkstemp, readlink, rename, rmdir, and unistd.
2025
2026 * New interfaces
2027
2028 ** Cooperative REPL servers
2029
2030 This new facility supports REPLs that run at specified times within an
2031 existing thread, for example in programs utilizing an event loop or in
2032 single-threaded programs. This allows for safe access and mutation of
2033 a program's data structures from the REPL without concern for thread
2034 synchronization. See "Cooperative REPL Servers" in the manual for
2035 details.
2036
2037 ** SRFI-43 (Vector Library)
2038
2039 Guile now includes SRFI-43, a comprehensive library of vector operations
2040 analogous to the SRFI-1 list library. See "SRFI-43" in the manual for
2041 details.
2042
2043 ** SRFI-64 (A Scheme API for test suites)
2044
2045 Guile now includes SRFI-64, a flexible framework for creating test
2046 suites. The reference implementation of SRFI-64 has also been updated
2047 to fully support earlier versions of Guile.
2048
2049 ** SRFI-111 (Boxes)
2050
2051 See "SRFI-111" in the manual.
2052
2053 ** 'define-values'
2054
2055 See "Binding multiple return values" in the manual.
2056
2057 ** Custom ellipsis identifiers using 'with-ellipsis' or SRFI-46.
2058
2059 Guile now allows macro definitions to use identifiers other than '...'
2060 as the ellipsis. This is convenient when writing macros that generate
2061 macro definitions. The desired ellipsis identifier can be given as the
2062 first operand to 'syntax-rules', as specified in SRFI-46 and R7RS, or by
2063 using the new 'with-ellipsis' special form in procedural macros. With
2064 this addition, Guile now fully supports SRFI-46.
2065
2066 See "Specifying a Custom Ellipsis Identifier" and "Custom Ellipsis
2067 Identifiers for syntax-case Macros" in the manual for details.
2068
2069 ** R7RS 'syntax-error'
2070
2071 Guile now supports 'syntax-error', as specified by R7RS, allowing for
2072 improved compile-time error reporting from 'syntax-rules' macros. See
2073 "Reporting Syntax Errors in Macros" in the manual for details.
2074
2075 ** New procedures to convert association lists into hash tables
2076
2077 Guile now includes the convenience procedures 'alist->hash-table',
2078 'alist->hashq-table', 'alist->hashv-table', and 'alist->hashx-table'.
2079 See "Hash Table Reference" in the manual.
2080
2081 ** New predicates: 'exact-integer?' and 'scm_is_exact_integer'
2082
2083 See "Integers" in the manual.
2084
2085 ** 'weak-vector-length', 'weak-vector-ref', and 'weak-vector-set!'
2086
2087 These should now be used to access weak vectors, instead of
2088 'vector-length', 'vector-ref', and 'vector-set!'.
2089
2090 * Manual updates
2091
2092 ** Improve docs for 'eval-when'.
2093
2094 Each 'eval-when' condition is now explained in detail, including
2095 'expand' which was previously undocumented. (expand load eval) is now
2096 the recommended set of conditions, instead of (compile load eval).
2097 See "Eval When" in the manual, for details.
2098
2099 ** Update the section on SMOBs and memory management.
2100
2101 See "Defining New Types (Smobs)" in the manual.
2102
2103 ** Fixes
2104
2105 *** GOOPS: #:dsupers is the init keyword for the dsupers slot.
2106 *** 'unfold-right' takes a tail, not a tail generator.
2107 *** Clarify that 'append!' and 'reverse!' might not mutate.
2108 *** Fix doc that incorrectly claimed (integer? +inf.0) => #t.
2109 (http://bugs.gnu.org/16356)
2110 *** Document that we support SRFI-62 (S-expression comments).
2111 *** Document that we support SRFI-87 (=> in case clauses).
2112 *** Document 'equal?' in the list of R6RS incompatibilities.
2113 *** Remove outdated documentation of LTDL_LIBRARY_PATH.
2114 *** Fix 'weak-vector?' doc: Weak hash tables are not weak vectors.
2115 *** Fix 'my-or' examples to use let-bound variable.
2116 (http://bugs.gnu.org/14203)
2117
2118 * New deprecations
2119
2120 ** General 'uniform-vector' interface
2121
2122 This interface lacked both generality and specificity. The general
2123 replacements are 'array-length', 'array-ref', and friends on the scheme
2124 side, and the array handle interface on the C side. On the specific
2125 side of things, there are the specific bytevector, SRFI-4, and bitvector
2126 interfaces.
2127
2128 ** Use of the vector interface on arrays
2129 ** 'vector-length', 'vector-ref', and 'vector-set!' on weak vectors
2130 ** 'vector-length', 'vector-ref', and 'vector-set!' as primitive-generics
2131
2132 Making the vector interface operate only on a single representation will
2133 allow future versions of Guile to compile loops involving vectors to
2134 more efficient native code.
2135
2136 ** 'htons', 'htonl', 'ntohs', 'ntohl'
2137
2138 These procedures, like their C counterpart, were used to convert numbers
2139 to/from network byte order, typically in conjunction with the
2140 now-deprecated uniform vector API.
2141
2142 This functionality is now covered by the bytevector and binary I/O APIs.
2143 See "Interpreting Bytevector Contents as Integers" in the manual.
2144
2145 ** 'gc-live-object-stats'
2146
2147 It hasn't worked in the whole 2.0 series. There is no replacement,
2148 unfortunately.
2149
2150 ** 'scm_c_program_source'
2151
2152 This internal VM function was not meant to be public. Use
2153 'scm_procedure_source' instead.
2154
2155 * Build fixes
2156
2157 ** Fix build with Clang 3.4.
2158
2159 ** MinGW build fixes
2160 *** Do not add $(EXEEXT) to guild or guile-tools.
2161 *** tests: Use double quotes around shell arguments, for Windows.
2162 *** tests: Don't rely on $TMPDIR and /tmp on Windows.
2163 *** tests: Skip FFI tests that use `qsort' when it's not accessible.
2164 *** tests: Remove symlink only when it exists.
2165 *** tests: Don't rely on `scm_call_2' being visible.
2166
2167 ** Fix computation of LIBLOBJS so dependencies work properly.
2168 (http://bugs.gnu.org/14193)
2169
2170 * Bug fixes
2171
2172 ** Web: Fix web client with methods other than GET.
2173 (http://bugs.gnu.org/15908)
2174 ** Web: Add Content-Length header for empty bodies.
2175 ** Web: Accept "UTC" as the zone offset in date headers.
2176 (http://bugs.gnu.org/14128)
2177 ** Web: Don't throw if a response is longer than its Content-Length says.
2178 ** Web: Write out HTTP Basic auth headers correctly.
2179 (http://bugs.gnu.org/14370)
2180 ** Web: Always print a path component in 'write-request-line'.
2181 ** Fix 'define-public' from (ice-9 curried-definitions).
2182 ** psyntax: toplevel variable definitions discard previous syntactic binding.
2183 (http://bugs.gnu.org/11988)
2184 ** Fix thread-unsafe lazy initializations.
2185 ** Make (ice-9 popen) thread-safe.
2186 (http://bugs.gnu.org/15683)
2187 ** Make guardians thread-safe.
2188 ** Make regexp_exec thread-safe.
2189 (http://bugs.gnu.org/14404)
2190 ** vm: Gracefully handle stack overflows.
2191 (http://bugs.gnu.org/15065)
2192 ** Fix 'rationalize'.
2193 (http://bugs.gnu.org/14905)
2194 ** Fix inline asm for VM fixnum operations on x32.
2195 ** Fix 'SCM_SYSCALL' to really swallow EINTR.
2196 ** Hide EINTR returns from 'accept'.
2197 ** SRFI-19: Update the table of leap seconds.
2198 ** Add missing files to the test-suite Makefile.
2199 ** Make sure 'ftw' allows directory traversal when running as root.
2200 ** Fix 'hash-for-each' for weak hash tables.
2201 ** SRFI-18: Export 'current-thread'.
2202 (http://bugs.gnu.org/16890)
2203 ** Fix inlining of tail list to apply.
2204 (http://bugs.gnu.org/15533)
2205 ** Fix bug in remqueue in threads.c when removing last element.
2206 ** Fix build when '>>' on negative integers is not arithmetic.
2207 ** Fix 'bitwise-bit-count' for negative arguments.
2208 (http://bugs.gnu.org/14864)
2209 ** Fix VM 'ash' for right shifts by large amounts.
2210 (http://bugs.gnu.org/14864)
2211 ** Fix rounding in scm_i_divide2double for negative arguments.
2212 ** Avoid lossy conversion from inum to double in numerical comparisons.
2213 ** Fix numerical comparison of fractions to infinities.
2214 ** Allow fl+ and fl* to accept zero arguments.
2215 (http://bugs.gnu.org/14869)
2216 ** flonum? returns false for complex number objects.
2217 (http://bugs.gnu.org/14866)
2218 ** flfinite? applied to a NaN returns false.
2219 (http://bugs.gnu.org/14868)
2220 ** Flonum operations always return flonums.
2221 (http://bugs.gnu.org/14871)
2222 ** min and max: NaNs beat infinities, per R6RS errata.
2223 (http://bugs.gnu.org/14865)
2224 ** Fix 'fxbit-count' for negative arguments.
2225 ** 'gcd' and 'lcm' support inexact integer arguments.
2226 (http://bugs.gnu.org/14870)
2227 ** Fix R6RS 'fixnum-width'.
2228 (http://bugs.gnu.org/14879)
2229 ** tests: Use shell constructs that /bin/sh on Solaris 10 can understand.
2230 (http://bugs.gnu.org/14042)
2231 ** Fix display of symbols containing backslashes.
2232 (http://bugs.gnu.org/15033)
2233 ** Fix truncated-print for uniform vectors.
2234 ** Define `AF_UNIX' only when Unix-domain sockets are supported.
2235 ** Decompiler: fix handling of empty 'case-lambda' expressions.
2236 ** Fix handling of signed zeroes and infinities in 'numerator' and 'denominator'.
2237 ** dereference-pointer: check for null pointer.
2238 ** Optimizer: Numerical comparisons are not negatable, for correct NaN handling.
2239 ** Compiler: Evaluate '-' and '/' in left-to-right order.
2240 (for more robust floating-point arithmetic)
2241 ** snarf.h: Declare static const function name vars as SCM_UNUSED.
2242 ** chars.c: Remove duplicate 'const' specifiers.
2243 ** Modify SCM_UNPACK type check to avoid warnings in clang.
2244 ** Arrange so that 'file-encoding' does not truncate the encoding name.
2245 (http://bugs.gnu.org/16463)
2246 ** Improve error checking in bytevector->uint-list and bytevector->sint-list.
2247 (http://bugs.gnu.org/15100)
2248 ** Fix (ash -1 SCM_I_FIXNUM_BIT-1) to return a fixnum instead of a bignum.
2249 ** i18n: Fix null pointer dereference when locale info is missing.
2250 ** Fix 'string-copy!' to work properly with overlapping src/dest.
2251 ** Fix hashing of vectors to run in bounded time.
2252 ** 'port-position' works on CBIPs that do not support 'set-port-position!'.
2253 ** Custom binary input ports sanity-check the return value of 'read!'.
2254 ** bdw-gc.h: Check SCM_USE_PTHREAD_THREADS using #if not #ifdef.
2255 ** REPL Server: Don't establish a SIGINT handler.
2256 ** REPL Server: Redirect warnings to client socket.
2257 ** REPL Server: Improve robustness of 'stop-server-and-clients!'.
2258 ** Add srfi-16, srfi-30, srfi-46, srfi-62, srfi-87 to %cond-expand-features.
2259 ** Fix trap handlers to handle applicable structs.
2260 (http://bugs.gnu.org/15691)
2261 ** Fix optional end argument in `uniform-vector-read!'.
2262 (http://bugs.gnu.org/15370)
2263 ** Fix brainfuck->scheme compiler.
2264 ** texinfo: Fix newline preservation in @example with lines beginning with @
2265
2266 ** C standards conformance improvements
2267
2268 Improvements and bug fixes were made to the C part of Guile's run-time
2269 support (libguile).
2270
2271 *** Don't use the identifier 'noreturn'.
2272 (http://bugs.gnu.org/15798)
2273 *** Rewrite SCM_I_INUM to avoid unspecified behavior when not using GNU C.
2274 *** Improve fallback implemention of SCM_SRS to avoid unspecified behavior.
2275 *** SRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable.
2276 *** Improve compliance with C standards regarding signed integer shifts.
2277 *** Avoid signed overflow in random.c.
2278 *** VM: Avoid signed overflows in 'add1' and 'sub1'.
2279 *** VM: Avoid overflow in ASM_ADD when the result is most-positive-fixnum.
2280 *** read: Avoid signed integer overflow in 'read_decimal_integer'.
2281
2282
2283
2284 Changes in 2.0.9 (since 2.0.7):
2285
2286 Note: 2.0.8 was a brown paper bag release that was never announced, but
2287 some mirrors may have picked it up. Please do not use it.
2288
2289 * Notable changes
2290
2291 ** New keyword arguments for procedures that open files
2292
2293 The following procedures that open files now support keyword arguments
2294 to request binary I/O or to specify the character encoding for text
2295 files: `open-file', `open-input-file', `open-output-file',
2296 `call-with-input-file', `call-with-output-file', `with-input-from-file',
2297 `with-output-to-file', and `with-error-to-file'.
2298
2299 It is also now possible to specify whether Guile should scan files for
2300 Emacs-style coding declarations. This scan was done by default in
2301 versions 2.0.0 through 2.0.7, but now must be explicitly requested.
2302
2303 See "File Ports" in the manual for details.
2304
2305 ** Rewritten guile.m4
2306
2307 The `guile.m4' autoconf macros have been rewritten to use `guild' and
2308 `pkg-config' instead of the deprecated `guile-config' (which itself
2309 calls pkg-config).
2310
2311 There is also a new macro, `GUILE_PKG', which allows packages to select
2312 the version of Guile that they want to compile against. See "Autoconf
2313 Macros" in the manual, for more information.
2314
2315 ** Better Windows support
2316
2317 Guile now correctly identifies absolute paths on Windows (MinGW), and
2318 creates files on that platform according to its path conventions. See
2319 "File System" in the manual, for all details.
2320
2321 In addition, the new Gnulib imports provide `select' and `poll' on
2322 Windows builds.
2323
2324 As an incompatible change, systems that are missing <sys/select.h> were
2325 previously provided a public `scm_std_select' C function that defined a
2326 version of `select', but unhappily it also provided its own incompatible
2327 definitions for FD_SET, FD_ZERO, and other system interfaces. Guile
2328 should not be setting these macros in public API, so this interface was
2329 removed on those plaforms (basically only MinGW).
2330
2331 ** Numerics improvements
2332
2333 `number->string' now reliably outputs enough digits to produce the same
2334 number when read back in. Previously, it mishandled subnormal numbers
2335 (printing them as "#.#"), and failed to distinguish between some
2336 distinct inexact numbers, e.g. 1.0 and (+ 1.0 (expt 2.0 -52)). These
2337 problems had far-reaching implications, since the compiler uses
2338 `number->string' to serialize numeric constants into .go files.
2339
2340 `sqrt' now produces exact rational results when possible, and handles
2341 very large or very small numbers more robustly.
2342
2343 A number (ahem) of operations involving exact rationals have been
2344 optimized, most notably `integer-expt' and `expt'.
2345
2346 `exact->inexact' now performs correct IEEE rounding.
2347
2348 ** New optimizations
2349
2350 There were a number of improvements to the partial evaluator, allowing
2351 complete reduction of forms such as:
2352
2353 ((let ((_ 10)) (lambda () _)))
2354
2355 ((lambda _ _))
2356
2357 (apply (lambda _ _) 1 2 3 '(4))
2358
2359 (call-with-values (lambda () (values 1 2)) (lambda _ _))
2360
2361 `string-join' now handles huge lists efficiently.
2362
2363 `get-bytevector-some' now uses buffered input, which is much faster.
2364
2365 Finally, `array-ref', `array-set!' on arrays of rank 1 or 2 is now
2366 faster, because it avoids building a rest list. Similarly, the
2367 one-argument case of `array-for-each' and `array-map!' has been
2368 optimized, and `array-copy!' and `array-fill!' are faster.
2369
2370 ** `peek-char' no longer consumes EOF
2371
2372 As required by the R5RS, if `peek-char' returns EOF, then the next read
2373 will also return EOF. Previously `peek-char' would consume the EOF.
2374 This makes a difference for terminal devices where it is possible to
2375 read past an EOF.
2376
2377 ** Gnulib update
2378
2379 Guile's copy of Gnulib was updated to v0.0-7865-ga828bb2. The following
2380 modules were imported from Gnulib: select, times, pipe-posix, fstat,
2381 getlogin, poll, and c-strcase.
2382
2383 ** `include' resolves relative file names relative to including file
2384
2385 Given a relative file name, `include' will look for it relative to the
2386 directory of the including file. This harmonizes the behavior of
2387 `include' with that of `load'.
2388
2389 ** SLIB compatibility restored
2390
2391 Guile 2.0.8 is now compatible with SLIB. You will have to use a
2392 development version of SLIB, however, until a new version of SLIB is
2393 released.
2394
2395 ** Better ,trace REPL command
2396
2397 Sometimes the ,trace output for nested function calls could overflow the
2398 terminal width, which wasn't useful. Now there is a limit to the amount
2399 of space the prefix will take. See the documentation for ",trace" for
2400 more information.
2401
2402 ** Better docstring syntax supported for `case-lambda'
2403
2404 Docstrings can now be placed immediately after the `case-lambda' or
2405 `case-lambda*' keyword. See "Case-lambda" in the manual.
2406
2407 ** Improved handling of Unicode byte order marks
2408
2409 See "BOM Handling" in the manual for details.
2410
2411 ** Update predefined character sets to Unicode 6.2
2412
2413 ** GMP 4.2 or later required
2414
2415 Guile used to require GMP at least version 4.1 (released in May 2002),
2416 and now requires at least version 4.2 (released in March 2006).
2417
2418 * Manual updates
2419
2420 ** Better SXML documentation
2421
2422 The documentation for SXML modules was much improved, though there is
2423 still far to go. See "SXML" in manual.
2424
2425 ** Style updates
2426
2427 Use of "iff" was replaced with standard English. Keyword arguments are
2428 now documented consistently, along with their default values.
2429
2430 ** An end to the generated-documentation experiment
2431
2432 When Guile 2.0 imported some modules from Guile-Lib, they came with a
2433 system that generated documentation from docstrings and module
2434 commentaries. This produced terrible documentation. We finally bit the
2435 bullet and incorporated these modules into the main text, and will be
2436 improving them manually over time, as is the case with SXML. Help is
2437 appreciated.
2438
2439 ** New documentation
2440
2441 There is now documentation for `scm_array_type', and `scm_array_ref', as
2442 well as for the new `array-length' / 'scm_c_array_length' /
2443 `scm_array_length' functions. `array-in-bounds?' has better
2444 documentation as well. The `program-arguments-alist' and
2445 `program-lambda-list' functions are now documented, as well as `and=>',
2446 `exit', and `quit'. The (system repl server) module is now documented
2447 (see REPL Servers). Finally, the GOOPS class hierarchy diagram has been
2448 regenerated for the web and print output formats.
2449
2450 * New deprecations
2451
2452 ** Deprecate generalized vector interface
2453
2454 The generalized vector interface, introduced in 1.8.0, is simply a
2455 redundant, verbose interface to arrays of rank 1. `array-ref' and
2456 similar functions are entirely sufficient. Thus,
2457 `scm_generalized_vector_p', `scm_generalized_vector_length',
2458 `scm_generalized_vector_ref', `scm_generalized_vector_set_x', and
2459 `scm_generalized_vector_to_list' are now deprecated.
2460
2461 ** Deprecate SCM_CHAR_CODE_LIMIT and char-code-limit
2462
2463 These constants were defined to 256, which is not the highest codepoint
2464 supported by Guile. Given that they were useless and incorrect, they
2465 have been deprecated.
2466
2467 ** Deprecate `http-get*'
2468
2469 The new `#:streaming?' argument to `http-get' subsumes the functionality
2470 of `http-get*' (introduced in 2.0.7). Also, the `#:extra-headers'
2471 argument is deprecated in favor of `#:headers'.
2472
2473 ** Deprecate (ice-9 mapping)
2474
2475 This module, present in Guile since 1996 but never used or documented,
2476 has never worked in Guile 2.0. It has now been deprecated and will be
2477 removed in Guile 2.2.
2478
2479 ** Deprecate undocumented array-related C functions
2480
2481 These are `scm_array_fill_int', `scm_ra_eqp', `scm_ra_lessp',
2482 `scm_ra_leqp', `scm_ra_grp', `scm_ra_greqp', `scm_ra_sum',
2483 `scm_ra_product', `scm_ra_difference', `scm_ra_divide', and
2484 `scm_array_identity'.
2485
2486 * New interfaces
2487
2488 ** SRFI-41 Streams
2489
2490 See "SRFI-41" in the manual.
2491
2492 ** SRFI-45 exports `promise?'
2493
2494 SRFI-45 now exports a `promise?' procedure that works with its promises.
2495 Also, its promises now print more nicely.
2496
2497 ** New HTTP client procedures
2498
2499 See "Web Client" for documentation on the new `http-head', `http-post',
2500 `http-put', `http-delete', `http-trace', and `http-options' procedures,
2501 and also for more options to `http-get'.
2502
2503 ** Much more capable `xml->sxml'
2504
2505 See "Reading and Writing XML" for information on how the `xml->sxml'
2506 parser deals with namespaces, processed entities, doctypes, and literal
2507 strings. Incidentally, `current-ssax-error-port' is now a parameter
2508 object.
2509
2510 ** New procedures for converting strings to and from bytevectors
2511
2512 See "Representing Strings as Bytes" for documention on the new `(ice-9
2513 iconv)' module and its `bytevector->string' and `string->bytevector'
2514 procedures.
2515
2516 ** Escape continuations with `call/ec' and `let/ec'
2517
2518 See "Prompt Primitives".
2519
2520 ** New procedures to read all characters from a port
2521
2522 See "Line/Delimited" in the manual for documentation on `read-string'
2523 and `read-string!'.
2524
2525 ** New procedure `sendfile'
2526
2527 See "File System".
2528
2529 ** New procedure `unget-bytevector'
2530
2531 See "R6RS Binary Input".
2532
2533 ** New C helper: `scm_c_bind_keyword_arguments'
2534
2535 See "Keyword Procedures".
2536
2537 ** New command-line arguments: `--language' and `-C'
2538
2539 See "Command-line Options" in the manual.
2540
2541 ** New environment variables: `GUILE_STACK_SIZE', `GUILE_INSTALL_LOCALE'
2542
2543 See "Environment Variables".
2544
2545 ** New procedures for dealing with file names
2546
2547 See "File System" for documentation on `system-file-name-convention',
2548 `file-name-separator?', `absolute-file-name?', and
2549 `file-name-separator-string'.
2550
2551 ** `array-length', an array's first dimension
2552
2553 See "Array Procedures".
2554
2555 ** `hash-count', for hash tables
2556
2557 See "Hash Tables".
2558
2559 ** `round-ash', a bit-shifting operator that rounds on right-shift
2560
2561 See "Bitwise Operations".
2562
2563 ** New foreign types: `ssize_t', `ptrdiff_t'
2564
2565 See "Foreign Types".
2566
2567 ** New C helpers: `scm_from_ptrdiff_t', `scm_to_ptrdiff_t'
2568
2569 See "Integers".
2570
2571 ** Socket option `SO_REUSEPORT' now available from Scheme
2572
2573 If supported on the platform, `SO_REUSEPORT' is now available from
2574 Scheme as well. See "Network Sockets and Communication".
2575
2576 ** `current-language' in default environment
2577
2578 Previously defined only in `(system base language)', `current-language'
2579 is now defined in the default environment, and is used to determine the
2580 language for the REPL, and for `compile-and-load'.
2581
2582 ** New procedure: `fluid->parameter'
2583
2584 See "Parameters", for information on how to convert a fluid to a
2585 parameter.
2586
2587 ** New `print' REPL option
2588
2589 See "REPL Commands" in the manual for information on the new
2590 user-customizable REPL printer.
2591
2592 ** New variable: %site-ccache-dir
2593
2594 The "Installing Site Packages" and "Build Config" manual sections now
2595 refer to this variable to describe where users should install their
2596 `.go' files.
2597
2598 * Build fixes
2599
2600 ** Fix compilation against libgc 7.3.
2601 ** Fix cross-compilation of `c-tokenize.o'.
2602 ** Fix warning when compiling against glibc 2.17.
2603 ** Fix documentation build against Texinfo 5.0.
2604 ** Fix building Guile from a directory with non-ASCII characters.
2605 ** Fix native MinGW build.
2606 ** Fix --disable-posix build.
2607 ** Fix MinGW builds with networking, POSIX, and thread support.
2608
2609 * Bug fixes
2610
2611 ** Fix inexact number printer.
2612 (http://bugs.gnu.org/13757)
2613 ** Fix infinite loop when parsing optional-argument short options (SRFI-37).
2614 (http://bugs.gnu.org/13176)
2615 ** web: Support non-GMT date headers in the HTTP client.
2616 (http://bugs.gnu.org/13544)
2617 ** web: support IP-literal (IPv6 address) in Host header.
2618 ** Avoid stack overflows with `par-map' and nested futures in general.
2619 (http://bugs.gnu.org/13188)
2620 ** Peek-char no longer consumes EOF.
2621 (http://bugs.gnu.org/12216)
2622 ** Avoid swallowing multiple EOFs in R6RS binary-input procedures.
2623 ** A fork when multiple threads are running will now print a warning.
2624 ** Allow for spurious wakeups from pthread_cond_wait.
2625 (http://bugs.gnu.org/10641)
2626 ** Warn and ignore module autoload failures.
2627 (http://bugs.gnu.org/12202)
2628 ** Use chmod portably in (system base compile).
2629 (http://bugs.gnu.org/10474)
2630 ** Fix response-body-port for HTTP responses without content-length.
2631 (http://bugs.gnu.org/13857)
2632 ** Allow case-lambda expressions with no clauses.
2633 (http://bugs.gnu.org/9776)
2634 ** Improve standards conformance of string->number.
2635 (http://bugs.gnu.org/11887)
2636 ** Support calls and tail-calls with more than 255 formals.
2637 ** ,option evaluates its right-hand-side.
2638 (http://bugs.gnu.org/13076)
2639 ** Structs with tail arrays are not simple.
2640 (http://bugs.gnu.org/12808)
2641 ** Make `SCM_LONG_BIT' usable in preprocessor conditionals.
2642 (http://bugs.gnu.org/13848)
2643 ** Fix thread-unsafe lazy initializations.
2644 ** Allow SMOB mark procedures to be called from parallel markers.
2645 (http://bugs.gnu.org/13611)
2646 ** Fix later-bindings-win logic in with-fluids.
2647 (http://bugs.gnu.org/13843)
2648 ** Fix duplicate removal of with-fluids.
2649 (http://bugs.gnu.org/13838)
2650 ** Support calling foreign functions of 10 arguments or more.
2651 (http://bugs.gnu.org/13809)
2652 ** Let reverse! accept arbitrary types as second argument.
2653 (http://bugs.gnu.org/13835)
2654 ** Recognize the `x86_64.*-gnux32' triplet.
2655 ** Check whether a triplet's OS part specifies an ABI.
2656 ** Recognize mips64* as having 32-bit pointers by default.
2657 ** Use portable sed constructs.
2658 (http://bugs.gnu.org/14042)
2659 ** Remove language/glil/decompile-assembly.scm.
2660 (http://bugs.gnu.org/10622)
2661 ** Use O_BINARY in `copy-file', `load-objcode', `mkstemp'.
2662 ** Use byte-oriented functions in `get-bytevector*'.
2663 ** Fix abort when iconv swallows BOM from UTF-16 or UTF-32 stream.
2664 ** Fix compilation of functions with more than 255 local variables.
2665 ** Fix `getgroups' for when zero supplementary group IDs exist.
2666 ** Allow (define-macro name (lambda ...)).
2667 ** Various fixes to the (texinfo) modules.
2668 ** guild: Gracefully handle failures to install the locale.
2669 ** Fix format string warnings for ~!, ~|, ~/, ~q, ~Q, and ~^.
2670 (http://bugs.gnu.org/13485)
2671 ** Fix source annotation bug in psyntax 'expand-body'.
2672 ** Ecmascript: Fix conversion to boolean for non-numbers.
2673 ** Use case-insensitive comparisons for encoding names.
2674 ** Add missing cond-expand feature identifiers.
2675 ** A failure to find a module's file does not prevent future loading.
2676 ** Many (oop goops save) fixes.
2677 ** `http-get': don't shutdown write end of socket.
2678 (http://bugs.gnu.org/13095)
2679 ** Avoid signed integer overflow in scm_product.
2680 ** http: read-response-body always returns bytevector or #f, never EOF.
2681 ** web: Correctly detect "No route to host" conditions.
2682 ** `system*': failure to execvp no longer leaks dangling processes.
2683 (http://bugs.gnu.org/13166)
2684 ** More sensible case-lambda* dispatch.
2685 (http://bugs.gnu.org/12929)
2686 ** Do not defer expansion of internal define-syntax forms.
2687 (http://bugs.gnu.org/13509)
2688
2689
2690
2691 Changes in 2.0.7 (since 2.0.6):
2692
2693 * Notable changes
2694
2695 ** SRFI-105 curly infix expressions are supported
2696
2697 Curly infix expressions as described at
2698 http://srfi.schemers.org/srfi-105/srfi-105.html are now supported by
2699 Guile's reader. This allows users to write things like {a * {b + c}}
2700 instead of (* a (+ b c)). SRFI-105 support is enabled by using the
2701 `#!curly-infix' directive in source code, or the `curly-infix' reader
2702 option. See the manual for details.
2703
2704 ** Reader options may now be per-port
2705
2706 Historically, `read-options' and related procedures would manipulate
2707 global options, affecting the `read' procedure for all threads, and all
2708 current uses of `read'.
2709
2710 Guile can now associate `read' options with specific ports, allowing
2711 different ports to use different options. For instance, the
2712 `#!fold-case' and `#!no-fold-case' reader directives have been
2713 implemented, and their effect is to modify the current read options of
2714 the current port only; similarly for `#!curly-infix'. Thus, it is
2715 possible, for instance, to have one port reading case-sensitive code,
2716 while another port reads case-insensitive code.
2717
2718 ** Futures may now be nested
2719
2720 Futures may now be nested: a future can itself spawn and then `touch'
2721 other futures. In addition, any thread that touches a future that has
2722 not completed now processes other futures while waiting for the touched
2723 future to completed. This allows all threads to be kept busy, and was
2724 made possible by the use of delimited continuations (see the manual for
2725 details.)
2726
2727 Consequently, `par-map' and `par-for-each' have been rewritten and can
2728 now use all cores.
2729
2730 ** `GUILE_LOAD_PATH' et al can now add directories to the end of the path
2731
2732 `GUILE_LOAD_PATH' and `GUILE_LOAD_COMPILED_PATH' can now be used to add
2733 directories to both ends of the load path. If the special path
2734 component `...' (ellipsis) is present in these environment variables,
2735 then the default path is put in place of the ellipsis, otherwise the
2736 default path is placed at the end. See "Environment Variables" in the
2737 manual for details.
2738
2739 ** `load-in-vicinity' search for `.go' files in `%load-compiled-path'
2740
2741 Previously, `load-in-vicinity' would look for compiled files in the
2742 auto-compilation cache, but not in `%load-compiled-path'. This is now
2743 fixed. This affects `load', and the `-l' command-line flag. See
2744 <http://bugs.gnu.org/12519> for details.
2745
2746 ** Extension search order fixed, and LD_LIBRARY_PATH preserved
2747
2748 Up to 2.0.6, Guile would modify the `LD_LIBRARY_PATH' environment
2749 variable (or whichever is relevant for the host OS) to insert its own
2750 default extension directories in the search path (using GNU libltdl
2751 facilities was not possible here.) This approach was problematic in two
2752 ways.
2753
2754 First, the `LD_LIBRARY_PATH' modification would be visible to
2755 sub-processes, and would also affect future calls to `dlopen', which
2756 could lead to subtle bugs in the application or sub-processes. Second,
2757 when the installation prefix is /usr, the `LD_LIBRARY_PATH' modification
2758 would typically end up inserting /usr/lib before /usr/local/lib in the
2759 search path, which is often the opposite of system-wide settings such as
2760 `ld.so.conf'.
2761
2762 Both issues have now been fixed.
2763
2764 ** `make-vtable-vtable' is now deprecated
2765
2766 Programs should instead use `make-vtable' and `<standard-vtable>'.
2767
2768 ** The `-Wduplicate-case-datum' and `-Wbad-case-datum' are enabled
2769
2770 These recently introduced warnings have been documented and are now
2771 enabled by default when auto-compiling.
2772
2773 ** Optimize calls to `equal?' or `eqv?' with a constant argument
2774
2775 The compiler simplifies calls to `equal?' or `eqv?' with a constant
2776 argument to use `eq?' instead, when applicable.
2777
2778 * Manual updates
2779
2780 ** SRFI-9 records now documented under "Compound Data Types"
2781
2782 The documentation of SRFI-9 record types has been moved in the "Compound
2783 Data Types", next to Guile's other record APIs. A new section
2784 introduces the various record APIs, and describes the trade-offs they
2785 make. These changes were made in an attempt to better guide users
2786 through the maze of records API, and to recommend SRFI-9 as the main
2787 API.
2788
2789 The documentation of Guile's raw `struct' API has also been improved.
2790
2791 ** (ice-9 and-let-star) and (ice-9 curried-definitions) now documented
2792
2793 These modules were missing from the manual.
2794
2795 * New interfaces
2796
2797 ** New "functional record setters" as a GNU extension of SRFI-9
2798
2799 The (srfi srfi-9 gnu) module now provides three new macros to deal with
2800 "updates" of immutable records: `define-immutable-record-type',
2801 `set-field', and `set-fields'.
2802
2803 The first one allows record type "functional setters" to be defined;
2804 such setters keep the record unchanged, and instead return a new record
2805 with only one different field. The remaining macros provide the same
2806 functionality, and also optimize updates of multiple or nested fields.
2807 See the manual for details.
2808
2809 ** web: New `http-get*', `response-body-port', and `text-content-type?'
2810 procedures
2811
2812 These procedures return a port from which to read the response's body.
2813 Unlike `http-get' and `read-response-body', they allow the body to be
2814 processed incrementally instead of being stored entirely in memory.
2815
2816 The `text-content-type?' predicate allows users to determine whether the
2817 content type of a response is textual.
2818
2819 See the manual for details.
2820
2821 ** `string-split' accepts character sets and predicates
2822
2823 The `string-split' procedure can now be given a SRFI-14 character set or
2824 a predicate, instead of just a character.
2825
2826 ** R6RS SRFI support
2827
2828 Previously, in R6RS modules, Guile incorrectly ignored components of
2829 SRFI module names after the SRFI number, making it impossible to specify
2830 sub-libraries. This release corrects this, bringing us into accordance
2831 with SRFI 97.
2832
2833 ** `define-public' is no a longer curried definition by default
2834
2835 The (ice-9 curried-definitions) should be used for such uses. See the
2836 manual for details.
2837
2838 * Build fixes
2839
2840 ** Remove reference to `scm_init_popen' when `fork' is unavailable
2841
2842 This fixes a MinGW build issue (http://bugs.gnu.org/12477).
2843
2844 ** Fix race between installing `guild' and the `guile-tools' symlink
2845
2846 * Bug fixes
2847
2848 ** Procedures returned by `eval' now have docstrings
2849 (http://bugs.gnu.org/12173)
2850 ** web client: correctly handle uri-query, etc. in relative URI headers
2851 (http://bugs.gnu.org/12827)
2852 ** Fix docs for R6RS `hashtable-copy'
2853 ** R6RS `string-for-each' now accepts multiple string arguments
2854 ** Fix out-of-range error in the compiler's CSE pass
2855 (http://bugs.gnu.org/12883)
2856 ** Add missing R6RS `open-file-input/output-port' procedure
2857 ** Futures: Avoid creating the worker pool more than once
2858 ** Fix invalid assertion about mutex ownership in threads.c
2859 (http://bugs.gnu.org/12719)
2860 ** Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'
2861 ** The `scandir' procedure now uses `lstat' instead of `stat'
2862 ** Fix `generalized-vector->list' indexing bug with shared arrays
2863 (http://bugs.gnu.org/12465)
2864 ** web: Change `http-get' to try all the addresses for the given URI
2865 ** Implement `hash' for structs
2866 (http://lists.gnu.org/archive/html/guile-devel/2012-10/msg00031.html)
2867 ** `read' now adds source properties for data types beyond pairs
2868 ** Improve error reporting in `append!'
2869 ** In fold-matches, set regexp/notbol unless matching string start
2870 ** Don't stat(2) and access(2) the .go location before using it
2871 ** SRFI-19: use zero padding for hours in ISO 8601 format, not blanks
2872 ** web: Fix uri-encoding for strings with no unreserved chars, and octets 0-15
2873 ** More robust texinfo alias handling
2874 ** Optimize `format' and `simple-format'
2875 (http://bugs.gnu.org/12033)
2876 ** Angle of -0.0 is pi, not zero
2877
2878
2879 Changes in 2.0.6 (since 2.0.5):
2880
2881 * Notable changes
2882
2883 ** New optimization pass: common subexpression elimination (CSE)
2884
2885 Guile's optimizer will now run a CSE pass after partial evaluation.
2886 This pass propagates static information about branches taken, bound
2887 lexicals, and effects from an expression's dominators. It can replace
2888 common subexpressions with their boolean values (potentially enabling
2889 dead code elimination), equivalent bound lexicals, or it can elide them
2890 entirely, depending on the context in which they are executed. This
2891 pass is especially useful in removing duplicate type checks, such as
2892 those produced by SRFI-9 record accessors.
2893
2894 ** Improvements to the partial evaluator
2895
2896 Peval can now hoist tests that are common to both branches of a
2897 conditional into the test. This can help with long chains of
2898 conditionals, such as those generated by the `match' macro. Peval can
2899 now do simple beta-reductions of procedures with rest arguments. It
2900 also avoids residualizing degenerate lexical aliases, even when full
2901 inlining is not possible. Finally, peval now uses the effects analysis
2902 introduced for the CSE pass. More precise effects analysis allows peval
2903 to move more code.
2904
2905 ** Run finalizers asynchronously in asyncs
2906
2907 Finalizers are now run asynchronously, via an async. See Asyncs in the
2908 manual. This allows Guile and user code to safely allocate memory while
2909 holding a mutex.
2910
2911 ** Update SRFI-14 character sets to Unicode 6.1
2912
2913 Note that this update causes the Latin-1 characters `§' and `¶' to be
2914 reclassified as punctuation. They were previously considered to be part
2915 of `char-set:symbol'.
2916
2917 ** Better source information for datums
2918
2919 When the `positions' reader option is on, as it is by default, Guile's
2920 reader will record source information for more kinds of datums.
2921
2922 ** Improved error and warning messages
2923
2924 `syntax-violation' errors now prefer `subform' for source info, with
2925 `form' as fallback. Syntactic errors in `cond' and `case' now produce
2926 better errors. `case' can now warn on duplicate datums, or datums that
2927 cannot be usefully compared with `eqv?'. `-Warity-mismatch' now handles
2928 applicable structs. `-Wformat' is more robust in the presence of
2929 `gettext'. Finally, various exceptions thrown by the Web modules now
2930 define appropriate exception printers.
2931
2932 ** A few important bug fixes in the HTTP modules.
2933
2934 Guile's web server framework now checks if an application returns a body
2935 where it is not permitted, for example in response to a HEAD request,
2936 and warn or truncate the response as appropriate. Bad requests now
2937 cause a 400 Bad Request response to be printed before closing the port.
2938 Finally, some date-printing and URL-parsing bugs were fixed.
2939
2940 ** Pretty-print improvements
2941
2942 When Guile needs to pretty-print Tree-IL, it will try to reconstruct
2943 `cond', `or`, and other derived syntax forms from the primitive tree-IL
2944 forms. It also uses the original names instead of the fresh unique
2945 names, when it is unambiguous to do so. This can be seen in the output
2946 of REPL commands like `,optimize'.
2947
2948 Also, the `pretty-print' procedure has a new keyword argument,
2949 `#:max-expr-width'.
2950
2951 ** Fix memory leak involving applicable SMOBs
2952
2953 At some point in the 1.9.x series, Guile began leaking any applicable
2954 SMOB that was actually applied. (There was a weak-key map from SMOB to
2955 trampoline functions, where the value had a strong reference on the
2956 key.) This has been fixed. There was much rejoicing!
2957
2958 ** Support for HTTP/1.1 chunked transfer coding
2959
2960 See "Transfer Codings" in the manual, for more.
2961
2962 ** Micro-optimizations
2963
2964 A pile of micro-optimizations: the `string-trim' function when called
2965 with `char-set:whitespace'; the `(web http)' parsers; SMOB application;
2966 conversion of raw UTF-8 and UTF-32 data to and from SCM strings; vlists
2967 and vhashes; `read' when processing string literals.
2968
2969 ** Incompatible change to `scandir'
2970
2971 As was the original intention, `scandir' now runs the `select?'
2972 procedure on all items, including subdirectories and the `.' and `..'
2973 entries. It receives the basename of the file in question instead of
2974 the full name. We apologize for this incompatible change to this
2975 function introduced in the 2.0.4 release.
2976
2977 * Manual updates
2978
2979 The manual has been made much more consistent in its naming conventions
2980 with regards to formal parameters of functions. Thanks to Bake Timmons.
2981
2982 * New interfaces
2983
2984 ** New C function: `scm_to_pointer'
2985 ** New C inline functions: `scm_new_smob', `scm_new_double_smob'
2986 ** (ice-9 format): Add ~h specifier for localized number output.
2987 ** (web response): New procedure: `response-must-not-include-body?'
2988 ** New predicate: 'supports-source-properties?'
2989 ** New C helpers: `scm_c_values', `scm_c_nvalues'
2990 ** Newly public inline C function: `scm_unget_byte'
2991 ** (language tree-il): New functions: `tree-il=?', `tree-il-hash'
2992 ** New fluid: `%default-port-conversion-strategy'
2993 ** New syntax: `=>' within `case'
2994 ** (web http): `make-chunked-input-port', `make-chunked-output-port'
2995 ** (web http): `declare-opaque-header!'
2996
2997 Search the manual for these identifiers, for more information.
2998
2999 * New deprecations
3000
3001 ** `close-io-port' deprecated
3002
3003 Use `close-port'.
3004
3005 ** `scm_sym2var' deprecated
3006
3007 In most cases, replace with `scm_lookup' or `scm_module_variable'. Use
3008 `scm_define' or `scm_module_ensure_local_variable' if the second
3009 argument is nonzero. See "Accessing Modules from C" in the manual, for
3010 full details.
3011
3012 ** Lookup closures deprecated
3013
3014 These were never documented. See "Module System Reflection" in the
3015 manual for replacements.
3016
3017 * Build fixes
3018
3019 ** Fix compilation against uninstalled Guile on non-GNU platforms.
3020 ** Fix `SCM_I_ERROR' definition for MinGW without networking.
3021 ** Fix compilation with the Sun C compiler.
3022 ** Fix check for `clock_gettime' on OpenBSD and some other systems.
3023 ** Fix build with --enable-debug-malloc.
3024 ** Honor $(program_transform_name) for the `guile-tools' symlink.
3025 ** Fix cross-compilation of GOOPS-using code.
3026
3027 * Bug fixes
3028
3029 ** Fix use of unitialized stat buffer in search-path of absolute paths.
3030 ** Avoid calling `freelocale' with a NULL argument.
3031 ** Work around erroneous tr_TR locale in Darwin 8 in tests.
3032 ** Fix `getaddrinfo' test for Darwin 8.
3033 ** Use Gnulib's `regex' module for better regex portability.
3034 ** `source-properties' and friends work on any object
3035 ** Rewrite open-process in C, for robustness related to threads and fork
3036 ** Fix <TAG>vector-length when applied to other uniform vector types
3037 ** Fix escape-only prompt optimization (was disabled previously)
3038 ** Fix a segfault when /dev/urandom is not accessible
3039 ** Fix flush on soft ports, so that it actually runs.
3040 ** Better compatibility of SRFI-9 records with core records
3041 ** Fix and clarify documentation of `sorted?'.
3042 ** Fix IEEE-754 endianness conversion in bytevectors.
3043 ** Correct thunk check in the `wind' instruction.
3044 ** Add @acronym support to texinfo modules
3045 ** Fix docbook->texi for <ulink> without URL
3046 ** Fix `setvbuf' to leave the line/column number unchanged.
3047 ** Add missing public declaration for `scm_take_from_input_buffers'.
3048 ** Fix relative file name canonicalization with empty %LOAD-PATH entries.
3049 ** Import newer (ice-9 match) from Chibi-Scheme.
3050 ** Fix unbound variables and unbound values in ECMAScript runtime.
3051 ** Make SRFI-6 string ports Unicode-capable.
3052
3053
3054 Changes in 2.0.5 (since 2.0.4):
3055
3056 This release fixes the binary interface information (SONAME) of
3057 libguile, which was incorrect in 2.0.4. It does not contain other
3058 changes.
3059
3060
3061 Changes in 2.0.4 (since 2.0.3):
3062
3063 * Notable changes
3064
3065 ** Better debuggability for interpreted procedures.
3066
3067 Guile 2.0 came with a great debugging experience for compiled
3068 procedures, but the story for interpreted procedures was terrible. Now,
3069 at least, interpreted procedures have names, and the `arity' procedure
3070 property is always correct (or, as correct as it can be, in the presence
3071 of `case-lambda').
3072
3073 ** Support for cross-compilation.
3074
3075 One can now use a native Guile to cross-compile `.go' files for a
3076 different architecture. See the documentation for `--target' in the
3077 "Compilation" section of the manual, for information on how to use the
3078 cross-compiler. See the "Cross building Guile" section of the README,
3079 for more on how to cross-compile Guile itself.
3080
3081 ** The return of `local-eval'.
3082
3083 Back by popular demand, `the-environment' and `local-eval' allow the
3084 user to capture a lexical environment, and then evaluate arbitrary
3085 expressions in that context. There is also a new `local-compile'
3086 command. See "Local Evaluation" in the manual, for more. Special
3087 thanks to Mark Weaver for an initial implementation of this feature.
3088
3089 ** Fluids can now have default values.
3090
3091 Fluids are used for dynamic and thread-local binding. They have always
3092 inherited their values from the context or thread that created them.
3093 However, there was a case in which a new thread would enter Guile, and
3094 the default values of all the fluids would be `#f' for that thread.
3095
3096 This has now been fixed so that `make-fluid' has an optional default
3097 value for fluids in unrelated dynamic roots, which defaults to `#f'.
3098
3099 ** Garbage collector tuning.
3100
3101 The garbage collector has now been tuned to run more often under some
3102 circumstances.
3103
3104 *** Unmanaged allocation
3105
3106 The new `scm_gc_register_allocation' function will notify the collector
3107 of unmanaged allocation. This will cause the collector to run sooner.
3108 Guile's `scm_malloc', `scm_calloc', and `scm_realloc' unmanaged
3109 allocators eventually call this function. This leads to better
3110 performance under steady-state unmanaged allocation.
3111
3112 *** Transient allocation
3113
3114 When the collector runs, it will try to record the total memory
3115 footprint of a process, if the platform supports this information. If
3116 the memory footprint is growing, the collector will run more frequently.
3117 This reduces the increase of the resident size of a process in response
3118 to a transient increase in allocation.
3119
3120 *** Management of threads, bignums
3121
3122 Creating a thread will allocate a fair amount of memory. Guile now does
3123 some GC work (using `GC_collect_a_little') when allocating a thread.
3124 This leads to a better memory footprint when creating many short-lived
3125 threads.
3126
3127 Similarly, bignums can occupy a lot of memory. Guile now offers hooks
3128 to enable custom GMP allocators that end up calling
3129 `scm_gc_register_allocation'. These allocators are enabled by default
3130 when running Guile from the command-line. To enable them in libraries,
3131 set the `scm_install_gmp_memory_functions' variable to a nonzero value
3132 before loading Guile.
3133
3134 ** SRFI-39 parameters are available by default.
3135
3136 Guile now includes support for parameters, as defined by SRFI-39, in the
3137 default environment. See "Parameters" in the manual, for more
3138 information. `current-input-port', `current-output-port', and
3139 `current-error-port' are now parameters.
3140
3141 ** Add `current-warning-port'.
3142
3143 Guile now outputs warnings on a separate port, `current-warning-port',
3144 initialized to the value that `current-error-port' has on startup.
3145
3146 ** Syntax parameters.
3147
3148 Following Racket's lead, Guile now supports syntax parameters. See
3149 "Syntax parameters" in the manual, for more.
3150
3151 Also see Barzilay, Culpepper, and Flatt's 2011 SFP workshop paper,
3152 "Keeping it Clean with syntax-parameterize".
3153
3154 ** Parse command-line arguments from the locale encoding.
3155
3156 Guile now attempts to parse command-line arguments using the user's
3157 locale. However for backwards compatibility with other 2.0.x releases,
3158 it does so without actually calling `setlocale'. Please report any bugs
3159 in this facility to [email protected].
3160
3161 ** One-armed conditionals: `when' and `unless'
3162
3163 Guile finally has `when' and `unless' in the default environment. Use
3164 them whenever you would use an `if' with only one branch. See
3165 "Conditionals" in the manual, for more.
3166
3167 ** `current-filename', `add-to-load-path'
3168
3169 There is a new form, `(current-filename)', which expands out to the
3170 source file in which it occurs. Combined with the new
3171 `add-to-load-path', this allows simple scripts to easily add nearby
3172 directories to the load path. See "Load Paths" in the manual, for more.
3173
3174 ** `random-state-from-platform'
3175
3176 This procedure initializes a random seed using good random sources
3177 available on your platform, such as /dev/urandom. See "Random Number
3178 Generation" in the manual, for more.
3179
3180 ** Warn about unsupported `simple-format' options.
3181
3182 The `-Wformat' compilation option now reports unsupported format options
3183 passed to `simple-format'.
3184
3185 ** Manual updates
3186
3187 Besides the sections already mentioned, the following manual sections
3188 are new in this release: "Modules and the File System", "Module System
3189 Reflection", "Syntax Transformer Helpers", and "Local Inclusion".
3190
3191 * New interfaces
3192
3193 ** (ice-9 session): `apropos-hook'
3194 ** New print option: `escape-newlines', defaults to #t.
3195 ** (ice-9 ftw): `file-system-fold', `file-system-tree', `scandir'
3196 ** `scm_c_value_ref': access to multiple returned values from C
3197 ** scm_call (a varargs version), scm_call_7, scm_call_8, scm_call_9
3198 ** Some new syntax helpers in (system syntax)
3199
3200 Search the manual for these identifiers and modules, for more.
3201
3202 * Build fixes
3203
3204 ** FreeBSD build fixes.
3205 ** OpenBSD compilation fixes.
3206 ** Solaris 2.10 test suite fixes.
3207 ** IA64 compilation fix.
3208 ** MinGW build fixes.
3209 ** Work around instruction reordering on SPARC and HPPA in the VM.
3210 ** Gnulib updates: added `dirfd', `setenv' modules.
3211
3212 * Bug fixes
3213
3214 ** Add a deprecated alias for $expt.
3215 ** Add an exception printer for `getaddrinfo-error'.
3216 ** Add deprecated shim for `scm_display_error' with stack as first argument.
3217 ** Add warnings for unsupported `simple-format' options.
3218 ** Allow overlapping regions to be passed to `bytevector-copy!'.
3219 ** Better function prologue disassembly
3220 ** Compiler: fix miscompilation of (values foo ...) in some contexts.
3221 ** Compiler: fix serialization of #nil-terminated lists.
3222 ** Compiler: allow values bound in non-tail let expressions to be collected.
3223 ** Deprecate SCM_ASRTGO.
3224 ** Document invalidity of (begin) as expression; add back-compat shim.
3225 ** Don't leak file descriptors when mmaping objcode.
3226 ** Empty substrings no longer reference the original stringbuf.
3227 ** FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged.
3228 ** FFI: Hold a weak reference to the CIF made by `procedure->pointer'.
3229 ** FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
3230 ** FFI: Properly unpack small integer return values in closure call.
3231 ** Fix R6RS `fold-left' so the accumulator is the first argument.
3232 ** Fix bit-set*! bug from 2005.
3233 ** Fix bug in `make-repl' when `lang' is actually a <language>.
3234 ** Fix bugs related to mutation, the null string, and shared substrings.
3235 ** Fix <dynwind> serialization.
3236 ** Fix erroneous check in `set-procedure-properties!'.
3237 ** Fix generalized-vector-{ref,set!} for slices.
3238 ** Fix error messages involving definition forms.
3239 ** Fix primitive-eval to return #<unspecified> for definitions.
3240 ** HTTP: Extend handling of "Cache-Control" header.
3241 ** HTTP: Fix qstring writing of cache-extension values
3242 ** HTTP: Fix validators for various list-style headers.
3243 ** HTTP: Permit non-date values for Expires header.
3244 ** HTTP: `write-request-line' writes absolute paths, not absolute URIs.
3245 ** Hack the port-column of current-output-port after printing a prompt.
3246 ** Make sure `regexp-quote' tests use Unicode-capable string ports.
3247 ** Peval: Fix bugs in the new optimizer.
3248 ** Statistically unique marks and labels, for robust hygiene across sessions.
3249 ** Web: Allow URIs with empty authorities, like "file:///etc/hosts".
3250 ** `,language' at REPL sets the current-language fluid.
3251 ** `primitive-load' returns the value(s) of the last expression.
3252 ** `scm_from_stringn' always returns unique strings.
3253 ** `scm_i_substring_copy' tries to narrow the substring.
3254 ** i18n: Fix gc_malloc/free mismatch on non-GNU systems.
3255
3256
3257 Changes in 2.0.3 (since 2.0.2):
3258
3259 * Speed improvements
3260
3261 ** Guile has a new optimizer, `peval'.
3262
3263 `Peval' is a partial evaluator that performs constant folding, dead code
3264 elimination, copy propagation, and inlining. By default it runs on
3265 every piece of code that Guile compiles, to fold computations that can
3266 happen at compile-time, so they don't have to happen at runtime.
3267
3268 If we did our job right, the only impact you would see would be your
3269 programs getting faster. But if you notice slowdowns or bloated code,
3270 please send a mail to [email protected] with details.
3271
3272 Thanks to William R. Cook, Oscar Waddell, and Kent Dybvig for inspiring
3273 peval and its implementation.
3274
3275 You can see what peval does on a given piece of code by running the new
3276 `,optimize' REPL meta-command, and comparing it to the output of
3277 `,expand'. See "Compile Commands" in the manual, for more.
3278
3279 ** Fewer calls to `stat'.
3280
3281 Guile now stats only the .go file and the .scm file when loading a fresh
3282 compiled file.
3283
3284 * Notable changes
3285
3286 ** New module: `(web client)', a simple synchronous web client.
3287
3288 See "Web Client" in the manual, for more.
3289
3290 ** Users can now install compiled `.go' files.
3291
3292 See "Installing Site Packages" in the manual.
3293
3294 ** Remove Front-Cover and Back-Cover text from the manual.
3295
3296 The manual is still under the GNU Free Documentation License, but no
3297 longer has any invariant sections.
3298
3299 ** More helpful `guild help'.
3300
3301 `guild' is Guile's multi-tool, for use in shell scripting. Now it has a
3302 nicer interface for querying the set of existing commands, and getting
3303 help on those commands. Try it out and see!
3304
3305 ** New macro: `define-syntax-rule'
3306
3307 `define-syntax-rule' is a shorthand to make a `syntax-rules' macro with
3308 one clause. See "Syntax Rules" in the manual, for more.
3309
3310 ** The `,time' REPL meta-command now has more precision.
3311
3312 The output of this command now has microsecond precision, instead of
3313 10-millisecond precision.
3314
3315 ** `(ice-9 match)' can now match records.
3316
3317 See "Pattern Matching" in the manual, for more on matching records.
3318
3319 ** New module: `(language tree-il debug)'.
3320
3321 This module provides a tree-il verifier. This is useful for people that
3322 generate tree-il, usually as part of a language compiler.
3323
3324 ** New functions: `scm_is_exact', `scm_is_inexact'.
3325
3326 These provide a nice C interface for Scheme's `exact?' and `inexact?',
3327 respectively.
3328
3329 * Bugs fixed
3330
3331 See the git log (or the ChangeLog) for more details on these bugs.
3332
3333 ** Fix order of importing modules and resolving duplicates handlers.
3334 ** Fix a number of bugs involving extended (merged) generics.
3335 ** Fix invocation of merge-generics duplicate handler.
3336 ** Fix write beyond array end in arrays.c.
3337 ** Fix read beyond end of hashtable size array in hashtab.c.
3338 ** (web http): Locale-independent parsing and serialization of dates.
3339 ** Ensure presence of Host header in HTTP/1.1 requests.
3340 ** Fix take-right and drop-right for improper lists.
3341 ** Fix leak in get_current_locale().
3342 ** Fix recursive define-inlinable expansions.
3343 ** Check that srfi-1 procedure arguments are procedures.
3344 ** Fix r6rs `map' for multiple returns.
3345 ** Fix scm_tmpfile leak on POSIX platforms.
3346 ** Fix a couple of leaks (objcode->bytecode, make-boot-program).
3347 ** Fix guile-lib back-compatibility for module-stexi-documentation.
3348 ** Fix --listen option to allow other ports.
3349 ** Fix scm_to_latin1_stringn for substrings.
3350 ** Fix compilation of untyped arrays of rank not 1.
3351 ** Fix unparse-tree-il of <dynset>.
3352 ** Fix reading of #||||#.
3353 ** Fix segfault in GOOPS when class fields are redefined.
3354 ** Prefer poll(2) over select(2) to allow file descriptors above FD_SETSIZE.
3355
3356
3357 Changes in 2.0.2 (since 2.0.1):
3358
3359 * Notable changes
3360
3361 ** `guile-tools' renamed to `guild'
3362
3363 The new name is shorter. Its intended future use is for a CPAN-like
3364 system for Guile wizards and journeyfolk to band together to share code;
3365 hence the name. `guile-tools' is provided as a backward-compatible
3366 symbolic link. See "Using Guile Tools" in the manual, for more.
3367
3368 ** New control operators: `shift' and `reset'
3369
3370 See "Shift and Reset" in the manual, for more information.
3371
3372 ** `while' as an expression
3373
3374 Previously the return value of `while' was unspecified. Now its
3375 values are specified both in the case of normal termination, and via
3376 termination by invoking `break', possibly with arguments. See "while
3377 do" in the manual for more.
3378
3379 ** Disallow access to handles of weak hash tables
3380
3381 `hash-get-handle' and `hash-create-handle!' are no longer permitted to
3382 be called on weak hash tables, because the fields in a weak handle could
3383 be nulled out by the garbage collector at any time, but yet they are
3384 otherwise indistinguishable from pairs. Use `hash-ref' and `hash-set!'
3385 instead.
3386
3387 ** More precision for `get-internal-run-time', `get-internal-real-time'
3388
3389 On 64-bit systems which support POSIX clocks, Guile's internal timing
3390 procedures offer nanosecond resolution instead of the 10-millisecond
3391 resolution previously available. 32-bit systems now use 1-millisecond
3392 timers.
3393
3394 ** Guile now measures time spent in GC
3395
3396 `gc-stats' now returns a meaningful value for `gc-time-taken'.
3397
3398 ** Add `gcprof'
3399
3400 The statprof profiler now exports a `gcprof' procedure, driven by the
3401 `after-gc-hook', to see which parts of your program are causing GC. Let
3402 us know if you find it useful.
3403
3404 ** `map', `for-each' and some others now implemented in Scheme
3405
3406 We would not mention this in NEWS, as it is not a user-visible change,
3407 if it were not for one thing: `map' and `for-each' are no longer
3408 primitive generics. Instead they are normal bindings, which can be
3409 wrapped by normal generics. This fixes some modularity issues between
3410 core `map', SRFI-1 `map', and GOOPS.
3411
3412 Also it's pretty cool that we can do this without a performance impact.
3413
3414 ** Add `scm_peek_byte_or_eof'.
3415
3416 This helper is like `scm_peek_char_or_eof', but for bytes instead of
3417 full characters.
3418
3419 ** Implement #:stop-at-first-non-option option for getopt-long
3420
3421 See "getopt-long Reference" in the manual, for more information.
3422
3423 ** Improve R6RS conformance for conditions in the I/O libraries
3424
3425 The `(rnrs io simple)' module now raises the correct R6RS conditions in
3426 error cases. `(rnrs io ports)' is also more correct now, though it is
3427 still a work in progress.
3428
3429 ** All deprecated routines emit warnings
3430
3431 A few deprecated routines were lacking deprecation warnings. This has
3432 been fixed now.
3433
3434 * Speed improvements
3435
3436 ** Constants in compiled code now share state better
3437
3438 Constants with shared state, like `("foo")' and `"foo"', now share state
3439 as much as possible, in the entire compilation unit. This cuts compiled
3440 `.go' file sizes in half, generally, and speeds startup.
3441
3442 ** VLists: optimize `vlist-fold-right', and add `vhash-fold-right'
3443
3444 These procedures are now twice as fast as they were.
3445
3446 ** UTF-8 ports to bypass `iconv' entirely
3447
3448 This reduces memory usage in a very common case.
3449
3450 ** Compiler speedups
3451
3452 The compiler is now about 40% faster. (Note that this is only the case
3453 once the compiler is itself compiled, so the build still takes as long
3454 as it did before.)
3455
3456 ** VM speed tuning
3457
3458 Some assertions that were mostly useful for sanity-checks on the
3459 bytecode compiler are now off for both "regular" and "debug" engines.
3460 This together with a fix to cache a TLS access and some other tweaks
3461 improve the VM's performance by about 20%.
3462
3463 ** SRFI-1 list-set optimizations
3464
3465 lset-adjoin and lset-union now have fast paths for eq? sets.
3466
3467 ** `memq', `memv' optimizations
3468
3469 These procedures are now at least twice as fast than in 2.0.1.
3470
3471 * Deprecations
3472
3473 ** Deprecate scm_whash API
3474
3475 `scm_whash_get_handle', `SCM_WHASHFOUNDP', `SCM_WHASHREF',
3476 `SCM_WHASHSET', `scm_whash_create_handle', `scm_whash_lookup', and
3477 `scm_whash_insert' are now deprecated. Use the normal hash table API
3478 instead.
3479
3480 ** Deprecate scm_struct_table
3481
3482 `SCM_STRUCT_TABLE_NAME', `SCM_SET_STRUCT_TABLE_NAME',
3483 `SCM_STRUCT_TABLE_CLASS', `SCM_SET_STRUCT_TABLE_CLASS',
3484 `scm_struct_table', and `scm_struct_create_handle' are now deprecated.
3485 These routines formed part of the internals of the map between structs
3486 and classes.
3487
3488 ** Deprecate scm_internal_dynamic_wind
3489
3490 The `scm_t_inner' type and `scm_internal_dynamic_wind' are deprecated,
3491 as the `scm_dynwind' API is better, and this API encourages users to
3492 stuff SCM values into pointers.
3493
3494 ** Deprecate scm_immutable_cell, scm_immutable_double_cell
3495
3496 These routines are deprecated, as the GC_STUBBORN API doesn't do
3497 anything any more.
3498
3499 * Manual updates
3500
3501 Andreas Rottman kindly transcribed the missing parts of the `(rnrs io
3502 ports)' documentation from the R6RS documentation. Thanks Andreas!
3503
3504 * Bugs fixed
3505
3506 ** Fix double-loading of script in -ds case
3507 ** -x error message fix
3508 ** iconveh-related cross-compilation fixes
3509 ** Fix small integer return value packing on big endian machines.
3510 ** Fix hash-set! in weak-value table from non-immediate to immediate
3511 ** Fix call-with-input-file & relatives for multiple values
3512 ** Fix `hash' for inf and nan
3513 ** Fix libguile internal type errors caught by typing-strictness==2
3514 ** Fix compile error in MinGW fstat socket detection
3515 ** Fix generation of auto-compiled file names on MinGW
3516 ** Fix multithreaded access to internal hash tables
3517 ** Emit a 1-based line number in error messages
3518 ** Fix define-module ordering
3519 ** Fix several POSIX functions to use the locale encoding
3520 ** Add type and range checks to the complex generalized vector accessors
3521 ** Fix unaligned accesses for bytevectors of complex numbers
3522 ** Fix '(a #{.} b)
3523 ** Fix erroneous VM stack overflow for canceled threads
3524
3525
3526 Changes in 2.0.1 (since 2.0.0):
3527
3528 * Notable changes
3529
3530 ** guile.m4 supports linking with rpath
3531
3532 The GUILE_FLAGS macro now sets GUILE_LIBS and GUILE_LTLIBS, which
3533 include appropriate directives to the linker to include libguile-2.0.so
3534 in the runtime library lookup path.
3535
3536 ** `begin' expands macros in its body before other expressions
3537
3538 This enables support for programs like the following:
3539
3540 (begin
3541 (define even?
3542 (lambda (x)
3543 (or (= x 0) (odd? (- x 1)))))
3544 (define-syntax odd?
3545 (syntax-rules ()
3546 ((odd? x) (not (even? x)))))
3547 (even? 10))
3548
3549 ** REPL reader usability enhancements
3550
3551 The REPL now flushes input after a read error, which should prevent one
3552 error from causing other errors. The REPL also now interprets comments
3553 as whitespace.
3554
3555 ** REPL output has configurable width
3556
3557 The REPL now defaults to output with the current terminal's width, in
3558 columns. See "Debug Commands" in the manual for more information on
3559 the ,width command.
3560
3561 ** Better C access to the module system
3562
3563 Guile now has convenient C accessors to look up variables or values in
3564 modules and their public interfaces. See `scm_c_public_ref' and friends
3565 in "Accessing Modules from C" in the manual.
3566
3567 ** Added `scm_call_5', `scm_call_6'
3568
3569 See "Fly Evaluation" in the manual.
3570
3571 ** Added `scm_from_latin1_keyword', `scm_from_utf8_keyword'
3572
3573 See "Keyword Procedures" in the manual, for more. Note that
3574 `scm_from_locale_keyword' should not be used when the name is a C string
3575 constant.
3576
3577 ** R6RS unicode and string I/O work
3578
3579 Added efficient implementations of `get-string-n' and `get-string-n!'
3580 for binary ports. Exported `current-input-port', `current-output-port'
3581 and `current-error-port' from `(rnrs io ports)', and enhanced support
3582 for transcoders.
3583
3584 ** Added `pointer->scm', `scm->pointer' to `(system foreign)'
3585
3586 These procedure are useful if one needs to pass and receive SCM values
3587 to and from foreign functions. See "Foreign Variables" in the manual,
3588 for more.
3589
3590 ** Added `heap-allocated-since-gc' to `(gc-stats)'
3591
3592 Also fixed the long-standing bug in the REPL `,stat' command.
3593
3594 ** Add `on-error' REPL option
3595
3596 This option controls what happens when an error occurs at the REPL, and
3597 defaults to `debug', indicating that Guile should enter the debugger.
3598 Other values include `report', which will simply print a backtrace
3599 without entering the debugger. See "System Commands" in the manual.
3600
3601 ** Enforce immutability of string literals
3602
3603 Attempting to mutate a string literal now causes a runtime error.
3604
3605 ** Fix pthread redirection
3606
3607 Guile 2.0.0 shipped with headers that, if configured with pthread
3608 support, would re-define `pthread_create', `pthread_join', and other API
3609 to redirect to the BDW-GC wrappers, `GC_pthread_create', etc. This was
3610 unintended, and not necessary: because threads must enter Guile with
3611 `scm_with_guile', Guile can handle thread registration itself, without
3612 needing to make the GC aware of all threads. This oversight has been
3613 fixed.
3614
3615 ** `with-continuation-barrier' now unwinds on `quit'
3616
3617 A throw to `quit' in a continuation barrier will cause Guile to exit.
3618 Before, it would do so before unwinding to the barrier, which would
3619 prevent cleanup handlers from running. This has been fixed so that it
3620 exits only after unwinding.
3621
3622 ** `string->pointer' and `pointer->string' have optional encoding arg
3623
3624 This allows users of the FFI to more easily deal in strings with
3625 particular (non-locale) encodings, like "utf-8". See "Void Pointers and
3626 Byte Access" in the manual, for more.
3627
3628 ** R6RS fixnum arithmetic optimizations
3629
3630 R6RS fixnum operations are are still slower than generic arithmetic,
3631 however.
3632
3633 ** New procedure: `define-inlinable'
3634
3635 See "Inlinable Procedures" in the manual, for more.
3636
3637 ** New procedure: `exact-integer-sqrt'
3638
3639 See "Integer Operations" in the manual, for more.
3640
3641 ** "Extended read syntax" for symbols parses better
3642
3643 In #{foo}# symbols, backslashes are now treated as escapes, as the
3644 symbol-printing code intended. Additionally, "\x" within #{foo}# is now
3645 interpreted as starting an R6RS hex escape. This is backward compatible
3646 because the symbol printer would never produce a "\x" before. The
3647 printer also works better too.
3648
3649 ** Added `--fresh-auto-compile' option
3650
3651 This allows a user to invalidate the auto-compilation cache. It's
3652 usually not needed. See "Compilation" in the manual, for a discussion.
3653
3654 * Manual updates
3655
3656 ** GOOPS documentation updates
3657
3658 ** New man page
3659
3660 Thanks to Mark Harig for improvements to guile.1.
3661
3662 ** SRFI-23 documented
3663
3664 The humble `error' SRFI now has an entry in the manual.
3665
3666 * New modules
3667
3668 ** `(ice-9 binary-ports)': "R6RS I/O Ports", in the manual
3669 ** `(ice-9 eval-string)': "Fly Evaluation", in the manual
3670 ** `(ice-9 command-line)', not documented yet
3671
3672 * Bugs fixed
3673
3674 ** Fixed `iconv_t' memory leak on close-port
3675 ** Fixed some leaks with weak hash tables
3676 ** Export `vhash-delq' and `vhash-delv' from `(ice-9 vlist)'
3677 ** `after-gc-hook' works again
3678 ** `define-record-type' now allowed in nested contexts
3679 ** `exact-integer-sqrt' now handles large integers correctly
3680 ** Fixed C extension examples in manual
3681 ** `vhash-delete' honors HASH argument
3682 ** Make `locale-digit-grouping' more robust
3683 ** Default exception printer robustness fixes
3684 ** Fix presence of non-I CPPFLAGS in `guile-2.0.pc'
3685 ** `read' updates line/column numbers when reading SCSH block comments
3686 ** Fix imports of multiple custom interfaces of same module
3687 ** Fix encoding scanning for non-seekable ports
3688 ** Fix `setter' when called with a non-setter generic
3689 ** Fix f32 and f64 bytevectors to not accept rationals
3690 ** Fix description of the R6RS `finite?' in manual
3691 ** Quotient, remainder and modulo accept inexact integers again
3692 ** Fix `continue' within `while' to take zero arguments
3693 ** Fix alignment for structures in FFI
3694 ** Fix port-filename of stdin, stdout, stderr to match the docs
3695 ** Fix weak hash table-related bug in `define-wrapped-pointer-type'
3696 ** Fix partial continuation application with pending procedure calls
3697 ** scm_{to,from}_locale_string use current locale, not current ports
3698 ** Fix thread cleanup, by using a pthread_key destructor
3699 ** Fix `quit' at the REPL
3700 ** Fix a failure to sync regs in vm bytevector ops
3701 ** Fix (texinfo reflection) to handle nested structures like syntax patterns
3702 ** Fix stexi->html double translation
3703 ** Fix tree-il->scheme fix for <prompt>
3704 ** Fix compilation of <prompt> in <fix> in single-value context
3705 ** Fix race condition in ensure-writable-dir
3706 ** Fix error message on ,disassemble "non-procedure"
3707 ** Fix prompt and abort with the boot evaluator
3708 ** Fix `procedure->pointer' for functions returning `void'
3709 ** Fix error reporting in dynamic-pointer
3710 ** Fix problems detecting coding: in block comments
3711 ** Fix duplicate load-path and load-compiled-path in compilation environment
3712 ** Add fallback read(2) suppport for .go files if mmap(2) unavailable
3713 ** Fix c32vector-set!, c64vector-set!
3714 ** Fix mistakenly deprecated read syntax for uniform complex vectors
3715 ** Fix parsing of exact numbers with negative exponents
3716 ** Ignore SIGPIPE in (system repl server)
3717 ** Fix optional second arg to R6RS log function
3718 ** Fix R6RS `assert' to return true value.
3719 ** Fix fencepost error when seeking in bytevector input ports
3720 ** Gracefully handle `setlocale' errors when starting the REPL
3721 ** Improve support of the `--disable-posix' configure option
3722 ** Make sure R6RS binary ports pass `binary-port?' regardless of the locale
3723 ** Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'
3724
3725
3726
3727 Changes in 2.0.0 (changes since the 1.8.x series):
3728
3729 * New modules (see the manual for details)
3730
3731 ** `(srfi srfi-18)', more sophisticated multithreading support
3732 ** `(srfi srfi-27)', sources of random bits
3733 ** `(srfi srfi-38)', External Representation for Data With Shared Structure
3734 ** `(srfi srfi-42)', eager comprehensions
3735 ** `(srfi srfi-45)', primitives for expressing iterative lazy algorithms
3736 ** `(srfi srfi-67)', compare procedures
3737 ** `(ice-9 i18n)', internationalization support
3738 ** `(ice-9 futures)', fine-grain parallelism
3739 ** `(rnrs bytevectors)', the R6RS bytevector API
3740 ** `(rnrs io ports)', a subset of the R6RS I/O port API
3741 ** `(system xref)', a cross-referencing facility (FIXME undocumented)
3742 ** `(ice-9 vlist)', lists with constant-time random access; hash lists
3743 ** `(system foreign)', foreign function interface
3744 ** `(sxml match)', a pattern matcher for SXML
3745 ** `(srfi srfi-9 gnu)', extensions to the SRFI-9 record library
3746 ** `(system vm coverage)', a line-by-line code coverage library
3747 ** `(web uri)', URI data type, parser, and unparser
3748 ** `(web http)', HTTP header parsers and unparsers
3749 ** `(web request)', HTTP request data type, reader, and writer
3750 ** `(web response)', HTTP response data type, reader, and writer
3751 ** `(web server)', Generic HTTP server
3752 ** `(ice-9 poll)', a poll wrapper
3753 ** `(web server http)', HTTP-over-TCP web server implementation
3754
3755 ** Replaced `(ice-9 match)' with Alex Shinn's compatible, hygienic matcher.
3756
3757 Guile's copy of Andrew K. Wright's `match' library has been replaced by
3758 a compatible hygienic implementation by Alex Shinn. It is now
3759 documented, see "Pattern Matching" in the manual.
3760
3761 Compared to Andrew K. Wright's `match', the new `match' lacks
3762 `match-define', `match:error-control', `match:set-error-control',
3763 `match:error', `match:set-error', and all structure-related procedures.
3764
3765 ** Imported statprof, SSAX, and texinfo modules from Guile-Lib
3766
3767 The statprof statistical profiler, the SSAX XML toolkit, and the texinfo
3768 toolkit from Guile-Lib have been imported into Guile proper. See
3769 "Standard Library" in the manual for more details.
3770
3771 ** Integration of lalr-scm, a parser generator
3772
3773 Guile has included Dominique Boucher's fine `lalr-scm' parser generator
3774 as `(system base lalr)'. See "LALR(1) Parsing" in the manual, for more
3775 information.
3776
3777 * Changes to the stand-alone interpreter
3778
3779 ** Guile now can compile Scheme to bytecode for a custom virtual machine.
3780
3781 Compiled code loads much faster than Scheme source code, and runs around
3782 3 or 4 times as fast, generating much less garbage in the process.
3783
3784 ** Evaluating Scheme code does not use the C stack.
3785
3786 Besides when compiling Guile itself, Guile no longer uses a recursive C
3787 function as an evaluator. This obviates the need to check the C stack
3788 pointer for overflow. Continuations still capture the C stack, however.
3789
3790 ** New environment variables: GUILE_LOAD_COMPILED_PATH,
3791 GUILE_SYSTEM_LOAD_COMPILED_PATH
3792
3793 GUILE_LOAD_COMPILED_PATH is for compiled files what GUILE_LOAD_PATH is
3794 for source files. It is a different path, however, because compiled
3795 files are architecture-specific. GUILE_SYSTEM_LOAD_COMPILED_PATH is like
3796 GUILE_SYSTEM_PATH.
3797
3798 ** New read-eval-print loop (REPL) implementation
3799
3800 Running Guile with no arguments drops the user into the new REPL. See
3801 "Using Guile Interactively" in the manual, for more information.
3802
3803 ** Remove old Emacs interface
3804
3805 Guile had an unused `--emacs' command line argument that was supposed to
3806 help when running Guile inside Emacs. This option has been removed, and
3807 the helper functions `named-module-use!' and `load-emacs-interface' have
3808 been deprecated.
3809
3810 ** Add `(system repl server)' module and `--listen' command-line argument
3811
3812 The `(system repl server)' module exposes procedures to listen on
3813 sockets for connections, and serve REPLs to those clients. The --listen
3814 command-line argument allows any Guile program to thus be remotely
3815 debuggable.
3816
3817 See "Invoking Guile" for more information on `--listen'.
3818
3819 ** Command line additions
3820
3821 The guile binary now supports a new switch "-x", which can be used to
3822 extend the list of filename extensions tried when loading files
3823 (%load-extensions).
3824
3825 ** New reader options: `square-brackets', `r6rs-hex-escapes',
3826 `hungry-eol-escapes'
3827
3828 The reader supports a new option (changeable via `read-options'),
3829 `square-brackets', which instructs it to interpret square brackets as
3830 parentheses. This option is on by default.
3831
3832 When the new `r6rs-hex-escapes' reader option is enabled, the reader
3833 will recognize string escape sequences as defined in R6RS. R6RS string
3834 escape sequences are incompatible with Guile's existing escapes, though,
3835 so this option is off by default.
3836
3837 Additionally, Guile follows the R6RS newline escaping rules when the
3838 `hungry-eol-escapes' option is enabled.
3839
3840 See "String Syntax" in the manual, for more information.
3841
3842 ** Function profiling and tracing at the REPL
3843
3844 The `,profile FORM' REPL meta-command can now be used to statistically
3845 profile execution of a form, to see which functions are taking the most
3846 time. See `,help profile' for more information.
3847
3848 Similarly, `,trace FORM' traces all function applications that occur
3849 during the execution of `FORM'. See `,help trace' for more information.
3850
3851 ** Recursive debugging REPL on error
3852
3853 When Guile sees an error at the REPL, instead of saving the stack, Guile
3854 will directly enter a recursive REPL in the dynamic context of the
3855 error. See "Error Handling" in the manual, for more information.
3856
3857 A recursive REPL is the same as any other REPL, except that it
3858 has been augmented with debugging information, so that one can inspect
3859 the context of the error. The debugger has been integrated with the REPL
3860 via a set of debugging meta-commands.
3861
3862 For example, one may access a backtrace with `,backtrace' (or
3863 `,bt'). See "Interactive Debugging" in the manual, for more
3864 information.
3865
3866 ** New `guile-tools' commands: `compile', `disassemble'
3867
3868 Pass the `--help' command-line option to these commands for more
3869 information.
3870
3871 ** Guile now adds its install prefix to the LTDL_LIBRARY_PATH
3872
3873 Users may now install Guile to nonstandard prefixes and just run
3874 `/path/to/bin/guile', instead of also having to set LTDL_LIBRARY_PATH to
3875 include `/path/to/lib'.
3876
3877 ** Guile's Emacs integration is now more keyboard-friendly
3878
3879 Backtraces may now be disclosed with the keyboard in addition to the
3880 mouse.
3881
3882 ** Load path change: search in version-specific paths before site paths
3883
3884 When looking for a module, Guile now searches first in Guile's
3885 version-specific path (the library path), *then* in the site dir. This
3886 allows Guile's copy of SSAX to override any Guile-Lib copy the user has
3887 installed. Also it should cut the number of `stat' system calls by half,
3888 in the common case.
3889
3890 ** Value history in the REPL on by default
3891
3892 By default, the REPL will save computed values in variables like `$1',
3893 `$2', and the like. There are programmatic and interactive interfaces to
3894 control this. See "Value History" in the manual, for more information.
3895
3896 ** Readline tab completion for arguments
3897
3898 When readline is enabled, tab completion works for arguments too, not
3899 just for the operator position.
3900
3901 ** Expression-oriented readline history
3902
3903 Guile's readline history now tries to operate on expressions instead of
3904 input lines. Let us know what you think!
3905
3906 ** Interactive Guile follows GNU conventions
3907
3908 As recommended by the GPL, Guile now shows a brief copyright and
3909 warranty disclaimer on startup, along with pointers to more information.
3910
3911 * Changes to Scheme functions and syntax
3912
3913 ** Support for R6RS libraries
3914
3915 The `library' and `import' forms from the latest Scheme report have been
3916 added to Guile, in such a way that R6RS libraries share a namespace with
3917 Guile modules. R6RS modules may import Guile modules, and are available
3918 for Guile modules to import via use-modules and all the rest. See "R6RS
3919 Libraries" in the manual for more information.
3920
3921 ** Implementations of R6RS libraries
3922
3923 Guile now has implementations for all of the libraries defined in the
3924 R6RS. Thanks to Julian Graham for this excellent hack. See "R6RS
3925 Standard Libraries" in the manual for a full list of libraries.
3926
3927 ** Partial R6RS compatibility
3928
3929 Guile now has enough support for R6RS to run a reasonably large subset
3930 of R6RS programs.
3931
3932 Guile is not fully R6RS compatible. Many incompatibilities are simply
3933 bugs, though some parts of Guile will remain R6RS-incompatible for the
3934 foreseeable future. See "R6RS Incompatibilities" in the manual, for more
3935 information.
3936
3937 Please contact [email protected] if you have found an issue not
3938 mentioned in that compatibility list.
3939
3940 ** New implementation of `primitive-eval'
3941
3942 Guile's `primitive-eval' is now implemented in Scheme. Actually there is
3943 still a C evaluator, used when building a fresh Guile to interpret the
3944 compiler, so we can compile eval.scm. Thereafter all calls to
3945 primitive-eval are implemented by VM-compiled code.
3946
3947 This allows all of Guile's procedures, be they interpreted or compiled,
3948 to execute on the same stack, unifying multiple-value return semantics,
3949 providing for proper tail recursion between interpreted and compiled
3950 code, and simplifying debugging.
3951
3952 As part of this change, the evaluator no longer mutates the internal
3953 representation of the code being evaluated in a thread-unsafe manner.
3954
3955 There are two negative aspects of this change, however. First, Guile
3956 takes a lot longer to compile now. Also, there is less debugging
3957 information available for debugging interpreted code. We hope to improve
3958 both of these situations.
3959
3960 There are many changes to the internal C evalator interface, but all
3961 public interfaces should be the same. See the ChangeLog for details. If
3962 we have inadvertantly changed an interface that you were using, please
3963 contact [email protected].
3964
3965 ** Procedure removed: `the-environment'
3966
3967 This procedure was part of the interpreter's execution model, and does
3968 not apply to the compiler.
3969
3970 ** No more `local-eval'
3971
3972 `local-eval' used to exist so that one could evaluate code in the
3973 lexical context of a function. Since there is no way to get the lexical
3974 environment any more, as that concept has no meaning for the compiler,
3975 and a different meaning for the interpreter, we have removed the
3976 function.
3977
3978 If you think you need `local-eval', you should probably implement your
3979 own metacircular evaluator. It will probably be as fast as Guile's
3980 anyway.
3981
3982 ** Scheme source files will now be compiled automatically.
3983
3984 If a compiled .go file corresponding to a .scm file is not found or is
3985 not fresh, the .scm file will be compiled on the fly, and the resulting
3986 .go file stored away. An advisory note will be printed on the console.
3987
3988 Note that this mechanism depends on the timestamp of the .go file being
3989 newer than that of the .scm file; if the .scm or .go files are moved
3990 after installation, care should be taken to preserve their original
3991 timestamps.
3992
3993 Auto-compiled files will be stored in the $XDG_CACHE_HOME/guile/ccache
3994 directory, where $XDG_CACHE_HOME defaults to ~/.cache. This directory
3995 will be created if needed.
3996
3997 To inhibit automatic compilation, set the GUILE_AUTO_COMPILE environment
3998 variable to 0, or pass --no-auto-compile on the Guile command line.
3999
4000 ** New POSIX procedures: `getrlimit' and `setrlimit'
4001
4002 Note however that the interface of these functions is likely to change
4003 in the next prerelease.
4004
4005 ** New POSIX procedure: `getsid'
4006
4007 Scheme binding for the `getsid' C library call.
4008
4009 ** New POSIX procedure: `getaddrinfo'
4010
4011 Scheme binding for the `getaddrinfo' C library function.
4012
4013 ** Multicast socket options
4014
4015 Support was added for the IP_MULTICAST_TTL and IP_MULTICAST_IF socket
4016 options. See "Network Sockets and Communication" in the manual, for
4017 more information.
4018
4019 ** `recv!', `recvfrom!', `send', `sendto' now deal in bytevectors
4020
4021 These socket procedures now take bytevectors as arguments, instead of
4022 strings. There is some deprecated string support, however.
4023
4024 ** New GNU procedures: `setaffinity' and `getaffinity'.
4025
4026 See "Processes" in the manual, for more information.
4027
4028 ** New procedures: `compose', `negate', and `const'
4029
4030 See "Higher-Order Functions" in the manual, for more information.
4031
4032 ** New procedure in `(oops goops)': `method-formals'
4033
4034 ** New procedures in (ice-9 session): `add-value-help-handler!',
4035 `remove-value-help-handler!', `add-name-help-handler!'
4036 `remove-name-help-handler!', `procedure-arguments'
4037
4038 The value and name help handlers provide some minimal extensibility to
4039 the help interface. Guile-lib's `(texinfo reflection)' uses them, for
4040 example, to make stexinfo help documentation available. See those
4041 procedures' docstrings for more information.
4042
4043 `procedure-arguments' describes the arguments that a procedure can take,
4044 combining arity and formals. For example:
4045
4046 (procedure-arguments resolve-interface)
4047 => ((required . (name)) (rest . args))
4048
4049 Additionally, `module-commentary' is now publically exported from
4050 `(ice-9 session).
4051
4052 ** Removed: `procedure->memoizing-macro', `procedure->syntax'
4053
4054 These procedures created primitive fexprs for the old evaluator, and are
4055 no longer supported. If you feel that you need these functions, you
4056 probably need to write your own metacircular evaluator (which will
4057 probably be as fast as Guile's, anyway).
4058
4059 ** New language: ECMAScript
4060
4061 Guile now ships with one other high-level language supported,
4062 ECMAScript. The goal is to support all of version 3.1 of the standard,
4063 but not all of the libraries are there yet. This support is not yet
4064 documented; ask on the mailing list if you are interested.
4065
4066 ** New language: Brainfuck
4067
4068 Brainfuck is a toy language that closely models Turing machines. Guile's
4069 brainfuck compiler is meant to be an example of implementing other
4070 languages. See the manual for details, or
4071 http://en.wikipedia.org/wiki/Brainfuck for more information about the
4072 Brainfuck language itself.
4073
4074 ** New language: Elisp
4075
4076 Guile now has an experimental Emacs Lisp compiler and runtime. You can
4077 now switch to Elisp at the repl: `,language elisp'. All kudos to Daniel
4078 Kraft and Brian Templeton, and all bugs to [email protected].
4079
4080 ** Better documentation infrastructure for macros
4081
4082 It is now possible to introspect on the type of a macro, e.g.
4083 syntax-rules, identifier-syntax, etc, and extract information about that
4084 macro, such as the syntax-rules patterns or the defmacro arguments.
4085 `(texinfo reflection)' takes advantage of this to give better macro
4086 documentation.
4087
4088 ** Support for arbitrary procedure metadata
4089
4090 Building on its support for docstrings, Guile now supports multiple
4091 docstrings, adding them to the tail of a compiled procedure's
4092 properties. For example:
4093
4094 (define (foo)
4095 "one"
4096 "two"
4097 3)
4098 (procedure-properties foo)
4099 => ((name . foo) (documentation . "one") (documentation . "two"))
4100
4101 Also, vectors of pairs are now treated as additional metadata entries:
4102
4103 (define (bar)
4104 #((quz . #f) (docstring . "xyzzy"))
4105 3)
4106 (procedure-properties bar)
4107 => ((name . bar) (quz . #f) (docstring . "xyzzy"))
4108
4109 This allows arbitrary literals to be embedded as metadata in a compiled
4110 procedure.
4111
4112 ** The psyntax expander now knows how to interpret the @ and @@ special
4113 forms.
4114
4115 ** The psyntax expander is now hygienic with respect to modules.
4116
4117 Free variables in a macro are scoped in the module that the macro was
4118 defined in, not in the module the macro is used in. For example, code
4119 like this works now:
4120
4121 (define-module (foo) #:export (bar))
4122 (define (helper x) ...)
4123 (define-syntax bar
4124 (syntax-rules () ((_ x) (helper x))))
4125
4126 (define-module (baz) #:use-module (foo))
4127 (bar qux)
4128
4129 It used to be you had to export `helper' from `(foo)' as well.
4130 Thankfully, this has been fixed.
4131
4132 ** Support for version information in Guile's `module' form
4133
4134 Guile modules now have a `#:version' field. See "R6RS Version
4135 References", "General Information about Modules", "Using Guile Modules",
4136 and "Creating Guile Modules" in the manual for more information.
4137
4138 ** Support for renaming bindings on module export
4139
4140 Wherever Guile accepts a symbol as an argument to specify a binding to
4141 export, it now also accepts a pair of symbols, indicating that a binding
4142 should be renamed on export. See "Creating Guile Modules" in the manual
4143 for more information.
4144
4145 ** New procedure: `module-export-all!'
4146
4147 This procedure exports all current and future bindings from a module.
4148 Use as `(module-export-all! (current-module))'.
4149
4150 ** New procedure `reload-module', and `,reload' REPL command
4151
4152 See "Module System Reflection" and "Module Commands" in the manual, for
4153 more information.
4154
4155 ** `eval-case' has been deprecated, and replaced by `eval-when'.
4156
4157 The semantics of `eval-when' are easier to understand. See "Eval When"
4158 in the manual, for more information.
4159
4160 ** Guile is now more strict about prohibiting definitions in expression
4161 contexts.
4162
4163 Although previous versions of Guile accepted it, the following
4164 expression is not valid, in R5RS or R6RS:
4165
4166 (if test (define foo 'bar) (define foo 'baz))
4167
4168 In this specific case, it would be better to do:
4169
4170 (define foo (if test 'bar 'baz))
4171
4172 It is possible to circumvent this restriction with e.g.
4173 `(module-define! (current-module) 'foo 'baz)'. Contact the list if you
4174 have any questions.
4175
4176 ** Support for `letrec*'
4177
4178 Guile now supports `letrec*', a recursive lexical binding operator in
4179 which the identifiers are bound in order. See "Local Bindings" in the
4180 manual, for more details.
4181
4182 ** Internal definitions now expand to `letrec*'
4183
4184 Following the R6RS, internal definitions now expand to letrec* instead
4185 of letrec. The following program is invalid for R5RS, but valid for
4186 R6RS:
4187
4188 (define (foo)
4189 (define bar 10)
4190 (define baz (+ bar 20))
4191 baz)
4192
4193 ;; R5RS and Guile <= 1.8:
4194 (foo) => Unbound variable: bar
4195 ;; R6RS and Guile >= 2.0:
4196 (foo) => 30
4197
4198 This change should not affect correct R5RS programs, or programs written
4199 in earlier Guile dialects.
4200
4201 ** Macro expansion produces structures instead of s-expressions
4202
4203 In the olden days, macroexpanding an s-expression would yield another
4204 s-expression. Though the lexical variables were renamed, expansions of
4205 core forms like `if' and `begin' were still non-hygienic, as they relied
4206 on the toplevel definitions of `if' et al being the conventional ones.
4207
4208 The solution is to expand to structures instead of s-expressions. There
4209 is an `if' structure, a `begin' structure, a `toplevel-ref' structure,
4210 etc. The expander already did this for compilation, producing Tree-IL
4211 directly; it has been changed now to do so when expanding for the
4212 evaluator as well.
4213
4214 ** Defmacros must now produce valid Scheme expressions.
4215
4216 It used to be that defmacros could unquote in Scheme values, as a way of
4217 supporting partial evaluation, and avoiding some hygiene issues. For
4218 example:
4219
4220 (define (helper x) ...)
4221 (define-macro (foo bar)
4222 `(,helper ,bar))
4223
4224 Assuming this macro is in the `(baz)' module, the direct translation of
4225 this code would be:
4226
4227 (define (helper x) ...)
4228 (define-macro (foo bar)
4229 `((@@ (baz) helper) ,bar))
4230
4231 Of course, one could just use a hygienic macro instead:
4232
4233 (define-syntax foo
4234 (syntax-rules ()
4235 ((_ bar) (helper bar))))
4236
4237 ** Guile's psyntax now supports docstrings and internal definitions.
4238
4239 The following Scheme is not strictly legal:
4240
4241 (define (foo)
4242 "bar"
4243 (define (baz) ...)
4244 (baz))
4245
4246 However its intent is fairly clear. Guile interprets "bar" to be the
4247 docstring of `foo', and the definition of `baz' is still in definition
4248 context.
4249
4250 ** Support for settable identifier syntax
4251
4252 Following the R6RS, "variable transformers" are settable
4253 identifier-syntax. See "Identifier macros" in the manual, for more
4254 information.
4255
4256 ** syntax-case treats `_' as a placeholder
4257
4258 Following R6RS, a `_' in a syntax-rules or syntax-case pattern matches
4259 anything, and binds no pattern variables. Unlike the R6RS, Guile also
4260 permits `_' to be in the literals list for a pattern.
4261
4262 ** Macros need to be defined before their first use.
4263
4264 It used to be that with lazy memoization, this might work:
4265
4266 (define (foo x)
4267 (ref x))
4268 (define-macro (ref x) x)
4269 (foo 1) => 1
4270
4271 But now, the body of `foo' is interpreted to mean a call to the toplevel
4272 `ref' function, instead of a macro expansion. The solution is to define
4273 macros before code that uses them.
4274
4275 ** Functions needed by macros at expand-time need to be present at
4276 expand-time.
4277
4278 For example, this code will work at the REPL:
4279
4280 (define (double-helper x) (* x x))
4281 (define-macro (double-literal x) (double-helper x))
4282 (double-literal 2) => 4
4283
4284 But it will not work when a file is compiled, because the definition of
4285 `double-helper' is not present at expand-time. The solution is to wrap
4286 the definition of `double-helper' in `eval-when':
4287
4288 (eval-when (load compile eval)
4289 (define (double-helper x) (* x x)))
4290 (define-macro (double-literal x) (double-helper x))
4291 (double-literal 2) => 4
4292
4293 See the documentation for eval-when for more information.
4294
4295 ** `macroexpand' produces structures, not S-expressions.
4296
4297 Given the need to maintain referential transparency, both lexically and
4298 modular, the result of expanding Scheme expressions is no longer itself
4299 an s-expression. If you want a human-readable approximation of the
4300 result of `macroexpand', call `tree-il->scheme' from `(language
4301 tree-il)'.
4302
4303 ** Removed function: `macroexpand-1'
4304
4305 It is unclear how to implement `macroexpand-1' with syntax-case, though
4306 PLT Scheme does prove that it is possible.
4307
4308 ** New reader macros: #' #` #, #,@
4309
4310 These macros translate, respectively, to `syntax', `quasisyntax',
4311 `unsyntax', and `unsyntax-splicing'. See the R6RS for more information.
4312 These reader macros may be overridden by `read-hash-extend'.
4313
4314 ** Incompatible change to #'
4315
4316 Guile did have a #' hash-extension, by default, which just returned the
4317 subsequent datum: #'foo => foo. In the unlikely event that anyone
4318 actually used this, this behavior may be reinstated via the
4319 `read-hash-extend' mechanism.
4320
4321 ** `unquote' and `unquote-splicing' accept multiple expressions
4322
4323 As per the R6RS, these syntax operators can now accept any number of
4324 expressions to unquote.
4325
4326 ** Scheme expresssions may be commented out with #;
4327
4328 #; comments out an entire expression. See SRFI-62 or the R6RS for more
4329 information.
4330
4331 ** Prompts: Delimited, composable continuations
4332
4333 Guile now has prompts as part of its primitive language. See "Prompts"
4334 in the manual, for more information.
4335
4336 Expressions entered in at the REPL, or from the command line, are
4337 surrounded by a prompt with the default prompt tag.
4338
4339 ** `make-stack' with a tail-called procedural narrowing argument no longer
4340 works (with compiled procedures)
4341
4342 It used to be the case that a captured stack could be narrowed to select
4343 calls only up to or from a certain procedure, even if that procedure
4344 already tail-called another procedure. This was because the debug
4345 information from the original procedure was kept on the stack.
4346
4347 Now with the new compiler, the stack only contains active frames from
4348 the current continuation. A narrow to a procedure that is not in the
4349 stack will result in an empty stack. To fix this, narrow to a procedure
4350 that is active in the current continuation, or narrow to a specific
4351 number of stack frames.
4352
4353 ** Backtraces through compiled procedures only show procedures that are
4354 active in the current continuation
4355
4356 Similarly to the previous issue, backtraces in compiled code may be
4357 different from backtraces in interpreted code. There are no semantic
4358 differences, however. Please mail [email protected] if you see any
4359 deficiencies with Guile's backtraces.
4360
4361 ** `positions' reader option enabled by default
4362
4363 This change allows primitive-load without --auto-compile to also
4364 propagate source information through the expander, for better errors and
4365 to let macros know their source locations. The compiler was already
4366 turning it on anyway.
4367
4368 ** New macro: `current-source-location'
4369
4370 The macro returns the current source location (to be documented).
4371
4372 ** syntax-rules and syntax-case macros now propagate source information
4373 through to the expanded code
4374
4375 This should result in better backtraces.
4376
4377 ** The currying behavior of `define' has been removed.
4378
4379 Before, `(define ((f a) b) (* a b))' would translate to
4380
4381 (define f (lambda (a) (lambda (b) (* a b))))
4382
4383 Now a syntax error is signaled, as this syntax is not supported by
4384 default. Use the `(ice-9 curried-definitions)' module to get back the
4385 old behavior.
4386
4387 ** New procedure, `define!'
4388
4389 `define!' is a procedure that takes two arguments, a symbol and a value,
4390 and binds the value to the symbol in the current module. It's useful to
4391 programmatically make definitions in the current module, and is slightly
4392 less verbose than `module-define!'.
4393
4394 ** All modules have names now
4395
4396 Before, you could have anonymous modules: modules without names. Now,
4397 because of hygiene and macros, all modules have names. If a module was
4398 created without a name, the first time `module-name' is called on it, a
4399 fresh name will be lazily generated for it.
4400
4401 ** The module namespace is now separate from the value namespace
4402
4403 It was a little-known implementation detail of Guile's module system
4404 that it was built on a single hierarchical namespace of values -- that
4405 if there was a module named `(foo bar)', then in the module named
4406 `(foo)' there was a binding from `bar' to the `(foo bar)' module.
4407
4408 This was a neat trick, but presented a number of problems. One problem
4409 was that the bindings in a module were not apparent from the module
4410 itself; perhaps the `(foo)' module had a private binding for `bar', and
4411 then an external contributor defined `(foo bar)'. In the end there can
4412 be only one binding, so one of the two will see the wrong thing, and
4413 produce an obtuse error of unclear provenance.
4414
4415 Also, the public interface of a module was also bound in the value
4416 namespace, as `%module-public-interface'. This was a hack from the early
4417 days of Guile's modules.
4418
4419 Both of these warts have been fixed by the addition of fields in the
4420 `module' data type. Access to modules and their interfaces from the
4421 value namespace has been deprecated, and all accessors use the new
4422 record accessors appropriately.
4423
4424 When Guile is built with support for deprecated code, as is the default,
4425 the value namespace is still searched for modules and public interfaces,
4426 and a deprecation warning is raised as appropriate.
4427
4428 Finally, to support lazy loading of modules as one used to be able to do
4429 with module binder procedures, Guile now has submodule binders, called
4430 if a given submodule is not found. See boot-9.scm for more information.
4431
4432 ** New procedures: module-ref-submodule, module-define-submodule,
4433 nested-ref-module, nested-define-module!, local-ref-module,
4434 local-define-module
4435
4436 These new accessors are like their bare variants, but operate on
4437 namespaces instead of values.
4438
4439 ** The (app modules) module tree is officially deprecated
4440
4441 It used to be that one could access a module named `(foo bar)' via
4442 `(nested-ref the-root-module '(app modules foo bar))'. The `(app
4443 modules)' bit was a never-used and never-documented abstraction, and has
4444 been deprecated. See the following mail for a full discussion:
4445
4446 http://lists.gnu.org/archive/html/guile-devel/2010-04/msg00168.html
4447
4448 The `%app' binding is also deprecated.
4449
4450 ** `module-filename' field and accessor
4451
4452 Modules now record the file in which they are defined. This field may be
4453 accessed with the new `module-filename' procedure.
4454
4455 ** Modules load within a known environment
4456
4457 It takes a few procedure calls to define a module, and those procedure
4458 calls need to be in scope. Now we ensure that the current module when
4459 loading a module is one that has the needed bindings, instead of relying
4460 on chance.
4461
4462 ** `load' is a macro (!) that resolves paths relative to source file dir
4463
4464 The familiar Schem `load' procedure is now a macro that captures the
4465 name of the source file being expanded, and dispatches to the new
4466 `load-in-vicinity'. Referencing `load' by bare name returns a closure
4467 that embeds the current source file name.
4468
4469 This fix allows `load' of relative paths to be resolved with respect to
4470 the location of the file that calls `load'.
4471
4472 ** Many syntax errors have different texts now
4473
4474 Syntax errors still throw to the `syntax-error' key, but the arguments
4475 are often different now. Perhaps in the future, Guile will switch to
4476 using standard SRFI-35 conditions.
4477
4478 ** Returning multiple values to compiled code will silently truncate the
4479 values to the expected number
4480
4481 For example, the interpreter would raise an error evaluating the form,
4482 `(+ (values 1 2) (values 3 4))', because it would see the operands as
4483 being two compound "values" objects, to which `+' does not apply.
4484
4485 The compiler, on the other hand, receives multiple values on the stack,
4486 not as a compound object. Given that it must check the number of values
4487 anyway, if too many values are provided for a continuation, it chooses
4488 to truncate those values, effectively evaluating `(+ 1 3)' instead.
4489
4490 The idea is that the semantics that the compiler implements is more
4491 intuitive, and the use of the interpreter will fade out with time.
4492 This behavior is allowed both by the R5RS and the R6RS.
4493
4494 ** Multiple values in compiled code are not represented by compound
4495 objects
4496
4497 This change may manifest itself in the following situation:
4498
4499 (let ((val (foo))) (do-something) val)
4500
4501 In the interpreter, if `foo' returns multiple values, multiple values
4502 are produced from the `let' expression. In the compiler, those values
4503 are truncated to the first value, and that first value is returned. In
4504 the compiler, if `foo' returns no values, an error will be raised, while
4505 the interpreter would proceed.
4506
4507 Both of these behaviors are allowed by R5RS and R6RS. The compiler's
4508 behavior is more correct, however. If you wish to preserve a potentially
4509 multiply-valued return, you will need to set up a multiple-value
4510 continuation, using `call-with-values'.
4511
4512 ** Defmacros are now implemented in terms of syntax-case.
4513
4514 The practical ramification of this is that the `defmacro?' predicate has
4515 been removed, along with `defmacro-transformer', `macro-table',
4516 `xformer-table', `assert-defmacro?!', `set-defmacro-transformer!' and
4517 `defmacro:transformer'. This is because defmacros are simply macros. If
4518 any of these procedures provided useful facilities to you, we encourage
4519 you to contact the Guile developers.
4520
4521 ** Hygienic macros documented as the primary syntactic extension mechanism.
4522
4523 The macro documentation was finally fleshed out with some documentation
4524 on `syntax-rules' and `syntax-case' macros, and other parts of the macro
4525 expansion process. See "Macros" in the manual, for details.
4526
4527 ** psyntax is now the default expander
4528
4529 Scheme code is now expanded by default by the psyntax hygienic macro
4530 expander. Expansion is performed completely before compilation or
4531 interpretation.
4532
4533 Notably, syntax errors will be signalled before interpretation begins.
4534 In the past, many syntax errors were only detected at runtime if the
4535 code in question was memoized.
4536
4537 As part of its expansion, psyntax renames all lexically-bound
4538 identifiers. Original identifier names are preserved and given to the
4539 compiler, but the interpreter will see the renamed variables, e.g.,
4540 `x432' instead of `x'.
4541
4542 Note that the psyntax that Guile uses is a fork, as Guile already had
4543 modules before incompatible modules were added to psyntax -- about 10
4544 years ago! Thus there are surely a number of bugs that have been fixed
4545 in psyntax since then. If you find one, please notify [email protected].
4546
4547 ** syntax-rules and syntax-case are available by default.
4548
4549 There is no longer any need to import the `(ice-9 syncase)' module
4550 (which is now deprecated). The expander may be invoked directly via
4551 `macroexpand', though it is normally searched for via the current module
4552 transformer.
4553
4554 Also, the helper routines for syntax-case are available in the default
4555 environment as well: `syntax->datum', `datum->syntax',
4556 `bound-identifier=?', `free-identifier=?', `generate-temporaries',
4557 `identifier?', and `syntax-violation'. See the R6RS for documentation.
4558
4559 ** Tail patterns in syntax-case
4560
4561 Guile has pulled in some more recent changes from the psyntax portable
4562 syntax expander, to implement support for "tail patterns". Such patterns
4563 are supported by syntax-rules and syntax-case. This allows a syntax-case
4564 match clause to have ellipses, then a pattern at the end. For example:
4565
4566 (define-syntax case
4567 (syntax-rules (else)
4568 ((_ val match-clause ... (else e e* ...))
4569 [...])))
4570
4571 Note how there is MATCH-CLAUSE, which is ellipsized, then there is a
4572 tail pattern for the else clause. Thanks to Andreas Rottmann for the
4573 patch, and Kent Dybvig for the code.
4574
4575 ** Lexical bindings introduced by hygienic macros may not be referenced
4576 by nonhygienic macros.
4577
4578 If a lexical binding is introduced by a hygienic macro, it may not be
4579 referenced by a nonhygienic macro. For example, this works:
4580
4581 (let ()
4582 (define-macro (bind-x val body)
4583 `(let ((x ,val)) ,body))
4584 (define-macro (ref x)
4585 x)
4586 (bind-x 10 (ref x)))
4587
4588 But this does not:
4589
4590 (let ()
4591 (define-syntax bind-x
4592 (syntax-rules ()
4593 ((_ val body) (let ((x val)) body))))
4594 (define-macro (ref x)
4595 x)
4596 (bind-x 10 (ref x)))
4597
4598 It is not normal to run into this situation with existing code. However,
4599 if you have defmacros that expand to hygienic macros, it is possible to
4600 run into situations like this. For example, if you have a defmacro that
4601 generates a `while' expression, the `break' bound by the `while' may not
4602 be visible within other parts of your defmacro. The solution is to port
4603 from defmacros to syntax-rules or syntax-case.
4604
4605 ** Macros may no longer be referenced as first-class values.
4606
4607 In the past, you could evaluate e.g. `if', and get its macro value. Now,
4608 expanding this form raises a syntax error.
4609
4610 Macros still /exist/ as first-class values, but they must be
4611 /referenced/ via the module system, e.g. `(module-ref (current-module)
4612 'if)'.
4613
4614 ** Macros may now have docstrings.
4615
4616 `object-documentation' from `(ice-9 documentation)' may be used to
4617 retrieve the docstring, once you have a macro value -- but see the above
4618 note about first-class macros. Docstrings are associated with the syntax
4619 transformer procedures.
4620
4621 ** `case-lambda' is now available in the default environment.
4622
4623 The binding in the default environment is equivalent to the one from the
4624 `(srfi srfi-16)' module. Use the srfi-16 module explicitly if you wish
4625 to maintain compatibility with Guile 1.8 and earlier.
4626
4627 ** Procedures may now have more than one arity.
4628
4629 This can be the case, for example, in case-lambda procedures. The
4630 arities of compiled procedures may be accessed via procedures from the
4631 `(system vm program)' module; see "Compiled Procedures", "Optional
4632 Arguments", and "Case-lambda" in the manual.
4633
4634 ** Deprecate arity access via (procedure-properties proc 'arity)
4635
4636 Instead of accessing a procedure's arity as a property, use the new
4637 `procedure-minimum-arity' function, which gives the most permissive
4638 arity that the function has, in the same format as the old arity
4639 accessor.
4640
4641 ** `lambda*' and `define*' are now available in the default environment
4642
4643 As with `case-lambda', `(ice-9 optargs)' continues to be supported, for
4644 compatibility purposes. No semantic change has been made (we hope).
4645 Optional and keyword arguments now dispatch via special VM operations,
4646 without the need to cons rest arguments, making them very fast.
4647
4648 ** New syntax: define-once
4649
4650 `define-once' is like Lisp's `defvar': it creates a toplevel binding,
4651 but only if one does not exist already.
4652
4653 ** New function, `truncated-print', with `format' support
4654
4655 `(ice-9 pretty-print)' now exports `truncated-print', a printer that
4656 will ensure that the output stays within a certain width, truncating the
4657 output in what is hopefully an intelligent manner. See the manual for
4658 more details.
4659
4660 There is a new `format' specifier, `~@y', for doing a truncated
4661 print (as opposed to `~y', which does a pretty-print). See the `format'
4662 documentation for more details.
4663
4664 ** Better pretty-printing
4665
4666 Indentation recognizes more special forms, like `syntax-case', and read
4667 macros like `quote' are printed better.
4668
4669 ** Passing a number as the destination of `format' is deprecated
4670
4671 The `format' procedure in `(ice-9 format)' now emits a deprecation
4672 warning if a number is passed as its first argument.
4673
4674 Also, it used to be that you could omit passing a port to `format', in
4675 some cases. This still works, but has been formally deprecated.
4676
4677 ** SRFI-4 vectors reimplemented in terms of R6RS bytevectors
4678
4679 Guile now implements SRFI-4 vectors using bytevectors. Often when you
4680 have a numeric vector, you end up wanting to write its bytes somewhere,
4681 or have access to the underlying bytes, or read in bytes from somewhere
4682 else. Bytevectors are very good at this sort of thing. But the SRFI-4
4683 APIs are nicer to use when doing number-crunching, because they are
4684 addressed by element and not by byte.
4685
4686 So as a compromise, Guile allows all bytevector functions to operate on
4687 numeric vectors. They address the underlying bytes in the native
4688 endianness, as one would expect.
4689
4690 Following the same reasoning, that it's just bytes underneath, Guile
4691 also allows uniform vectors of a given type to be accessed as if they
4692 were of any type. One can fill a u32vector, and access its elements with
4693 u8vector-ref. One can use f64vector-ref on bytevectors. It's all the
4694 same to Guile.
4695
4696 In this way, uniform numeric vectors may be written to and read from
4697 input/output ports using the procedures that operate on bytevectors.
4698
4699 Calls to SRFI-4 accessors (ref and set functions) from Scheme are now
4700 inlined to the VM instructions for bytevector access.
4701
4702 See "SRFI-4" in the manual, for more information.
4703
4704 ** Nonstandard SRFI-4 procedures now available from `(srfi srfi-4 gnu)'
4705
4706 Guile's `(srfi srfi-4)' now only exports those srfi-4 procedures that
4707 are part of the standard. Complex uniform vectors and the
4708 `any->FOOvector' family are now available only from `(srfi srfi-4 gnu)'.
4709
4710 Guile's default environment imports `(srfi srfi-4)', and probably should
4711 import `(srfi srfi-4 gnu)' as well.
4712
4713 See "SRFI-4 Extensions" in the manual, for more information.
4714
4715 ** New syntax: include-from-path.
4716
4717 `include-from-path' is like `include', except it looks for its file in
4718 the load path. It can be used to compile other files into a file.
4719
4720 ** New syntax: quasisyntax.
4721
4722 `quasisyntax' is to `syntax' as `quasiquote' is to `quote'. See the R6RS
4723 documentation for more information. Thanks to Andre van Tonder for the
4724 implementation.
4725
4726 ** `*unspecified*' is identifier syntax
4727
4728 `*unspecified*' is no longer a variable, so it is optimized properly by
4729 the compiler, and is not `set!'-able.
4730
4731 ** Changes and bugfixes in numerics code
4732
4733 *** Added six new sets of fast quotient and remainder operators
4734
4735 Added six new sets of fast quotient and remainder operator pairs with
4736 different semantics than the R5RS operators. They support not only
4737 integers, but all reals, including exact rationals and inexact
4738 floating point numbers.
4739
4740 These procedures accept two real numbers N and D, where the divisor D
4741 must be non-zero. Each set of operators computes an integer quotient
4742 Q and a real remainder R such that N = Q*D + R and |R| < |D|. They
4743 differ only in how N/D is rounded to produce Q.
4744
4745 `euclidean-quotient' returns the integer Q and `euclidean-remainder'
4746 returns the real R such that N = Q*D + R and 0 <= R < |D|. `euclidean/'
4747 returns both Q and R, and is more efficient than computing each
4748 separately. Note that when D > 0, `euclidean-quotient' returns
4749 floor(N/D), and when D < 0 it returns ceiling(N/D).
4750
4751 `centered-quotient', `centered-remainder', and `centered/' are similar
4752 except that the range of remainders is -abs(D/2) <= R < abs(D/2), and
4753 `centered-quotient' rounds N/D to the nearest integer. Note that these
4754 operators are equivalent to the R6RS integer division operators `div',
4755 `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'.
4756
4757 `floor-quotient' and `floor-remainder' compute Q and R, respectively,
4758 where Q has been rounded toward negative infinity. `floor/' returns
4759 both Q and R, and is more efficient than computing each separately.
4760 Note that when applied to integers, `floor-remainder' is equivalent to
4761 the R5RS integer-only `modulo' operator. `ceiling-quotient',
4762 `ceiling-remainder', and `ceiling/' are similar except that Q is
4763 rounded toward positive infinity.
4764
4765 For `truncate-quotient', `truncate-remainder', and `truncate/', Q is
4766 rounded toward zero. Note that when applied to integers,
4767 `truncate-quotient' and `truncate-remainder' are equivalent to the
4768 R5RS integer-only operators `quotient' and `remainder'.
4769
4770 For `round-quotient', `round-remainder', and `round/', Q is rounded to
4771 the nearest integer, with ties going to the nearest even integer.
4772
4773 *** Complex number changes
4774
4775 Guile is now able to represent non-real complex numbers whose
4776 imaginary part is an _inexact_ zero (0.0 or -0.0), per R6RS.
4777 Previously, such numbers were immediately changed into inexact reals.
4778
4779 (real? 0.0+0.0i) now returns #f, per R6RS, although (zero? 0.0+0.0i)
4780 still returns #t, per R6RS. (= 0 0.0+0.0i) and (= 0.0 0.0+0.0i) are
4781 #t, but the same comparisons using `eqv?' or `equal?' are #f.
4782
4783 Like other non-real numbers, these complex numbers with inexact zero
4784 imaginary part will raise exceptions is passed to procedures requiring
4785 reals, such as `<', `>', `<=', `>=', `min', `max', `positive?',
4786 `negative?', `inf?', `nan?', `finite?', etc.
4787
4788 **** `make-rectangular' changes
4789
4790 scm_make_rectangular `make-rectangular' now returns a real number only
4791 if the imaginary part is an _exact_ 0. Previously, it would return a
4792 real number if the imaginary part was an inexact zero.
4793
4794 scm_c_make_rectangular now always returns a non-real complex number,
4795 even if the imaginary part is zero. Previously, it would return a
4796 real number if the imaginary part was zero.
4797
4798 **** `make-polar' changes
4799
4800 scm_make_polar `make-polar' now returns a real number only if the
4801 angle or magnitude is an _exact_ 0. If the magnitude is an exact 0,
4802 it now returns an exact 0. Previously, it would return a real
4803 number if the imaginary part was an inexact zero.
4804
4805 scm_c_make_polar now always returns a non-real complex number, even if
4806 the imaginary part is 0.0. Previously, it would return a real number
4807 if the imaginary part was 0.0.
4808
4809 **** `imag-part' changes
4810
4811 scm_imag_part `imag-part' now returns an exact 0 if applied to an
4812 inexact real number. Previously it returned an inexact zero in this
4813 case.
4814
4815 *** `eqv?' and `equal?' now compare numbers equivalently
4816
4817 scm_equal_p `equal?' now behaves equivalently to scm_eqv_p `eqv?' for
4818 numeric values, per R5RS. Previously, equal? worked differently,
4819 e.g. `(equal? 0.0 -0.0)' returned #t but `(eqv? 0.0 -0.0)' returned #f,
4820 and `(equal? +nan.0 +nan.0)' returned #f but `(eqv? +nan.0 +nan.0)'
4821 returned #t.
4822
4823 *** `(equal? +nan.0 +nan.0)' now returns #t
4824
4825 Previously, `(equal? +nan.0 +nan.0)' returned #f, although
4826 `(let ((x +nan.0)) (equal? x x))' and `(eqv? +nan.0 +nan.0)'
4827 both returned #t. R5RS requires that `equal?' behave like
4828 `eqv?' when comparing numbers.
4829
4830 *** Change in handling products `*' involving exact 0
4831
4832 scm_product `*' now handles exact 0 differently. A product containing
4833 an exact 0 now returns an exact 0 if and only if the other arguments
4834 are all exact. An inexact zero is returned if and only if the other
4835 arguments are all finite but not all exact. If an infinite or NaN
4836 value is present, a NaN value is returned. Previously, any product
4837 containing an exact 0 yielded an exact 0, regardless of the other
4838 arguments.
4839
4840 *** `expt' and `integer-expt' changes when the base is 0
4841
4842 While `(expt 0 0)' is still 1, and `(expt 0 N)' for N > 0 is still
4843 zero, `(expt 0 N)' for N < 0 is now a NaN value, and likewise for
4844 integer-expt. This is more correct, and conforming to R6RS, but seems
4845 to be incompatible with R5RS, which would return 0 for all non-zero
4846 values of N.
4847
4848 *** `expt' and `integer-expt' are more generic, less strict
4849
4850 When raising to an exact non-negative integer exponent, `expt' and
4851 `integer-expt' are now able to exponentiate any object that can be
4852 multiplied using `*'. They can also raise an object to an exact
4853 negative integer power if its reciprocal can be taken using `/'.
4854 In order to allow this, the type of the first argument is no longer
4855 checked when raising to an exact integer power. If the exponent is 0
4856 or 1, the first parameter is not manipulated at all, and need not
4857 even support multiplication.
4858
4859 *** Infinities are no longer integers, nor rationals
4860
4861 scm_integer_p `integer?' and scm_rational_p `rational?' now return #f
4862 for infinities, per R6RS. Previously they returned #t for real
4863 infinities. The real infinities and NaNs are still considered real by
4864 scm_real `real?' however, per R6RS.
4865
4866 *** NaNs are no longer rationals
4867
4868 scm_rational_p `rational?' now returns #f for NaN values, per R6RS.
4869 Previously it returned #t for real NaN values. They are still
4870 considered real by scm_real `real?' however, per R6RS.
4871
4872 *** `inf?' and `nan?' now throw exceptions for non-reals
4873
4874 The domain of `inf?' and `nan?' is the real numbers. Guile now signals
4875 an error when a non-real number or non-number is passed to these
4876 procedures. (Note that NaNs _are_ considered numbers by scheme, despite
4877 their name).
4878
4879 *** `rationalize' bugfixes and changes
4880
4881 Fixed bugs in scm_rationalize `rationalize'. Previously, it returned
4882 exact integers unmodified, although that was incorrect if the epsilon
4883 was at least 1 or inexact, e.g. (rationalize 4 1) should return 3 per
4884 R5RS and R6RS, but previously it returned 4. It also now handles
4885 cases involving infinities and NaNs properly, per R6RS.
4886
4887 *** Trigonometric functions now return exact numbers in some cases
4888
4889 scm_sin `sin', scm_cos `cos', scm_tan `tan', scm_asin `asin', scm_acos
4890 `acos', scm_atan `atan', scm_sinh `sinh', scm_cosh `cosh', scm_tanh
4891 `tanh', scm_sys_asinh `asinh', scm_sys_acosh `acosh', and
4892 scm_sys_atanh `atanh' now return exact results in some cases.
4893
4894 *** New procedure: `finite?'
4895
4896 Add scm_finite_p `finite?' from R6RS to guile core, which returns #t
4897 if and only if its argument is neither infinite nor a NaN. Note that
4898 this is not the same as (not (inf? x)) or (not (infinite? x)), since
4899 NaNs are neither finite nor infinite.
4900
4901 *** Improved exactness handling for complex number parsing
4902
4903 When parsing non-real complex numbers, exactness specifiers are now
4904 applied to each component, as is done in PLT Scheme. For complex
4905 numbers written in rectangular form, exactness specifiers are applied
4906 to the real and imaginary parts before calling scm_make_rectangular.
4907 For complex numbers written in polar form, exactness specifiers are
4908 applied to the magnitude and angle before calling scm_make_polar.
4909
4910 Previously, exactness specifiers were applied to the number as a whole
4911 _after_ calling scm_make_rectangular or scm_make_polar.
4912
4913 For example, (string->number "#i5.0+0i") now does the equivalent of:
4914
4915 (make-rectangular (exact->inexact 5.0) (exact->inexact 0))
4916
4917 which yields 5.0+0.0i. Previously it did the equivalent of:
4918
4919 (exact->inexact (make-rectangular 5.0 0))
4920
4921 which yielded 5.0.
4922
4923 ** Unicode characters
4924
4925 Unicode characters may be entered in octal format via e.g. `#\454', or
4926 created via (integer->char 300). A hex external representation will
4927 probably be introduced at some point.
4928
4929 ** Unicode strings
4930
4931 Internally, strings are now represented either in the `latin-1'
4932 encoding, one byte per character, or in UTF-32, with four bytes per
4933 character. Strings manage their own allocation, switching if needed.
4934
4935 Extended characters may be written in a literal string using the
4936 hexadecimal escapes `\xXX', `\uXXXX', or `\UXXXXXX', for 8-bit, 16-bit,
4937 or 24-bit codepoints, respectively, or entered directly in the native
4938 encoding of the port on which the string is read.
4939
4940 ** Unicode symbols
4941
4942 One may now use U+03BB (GREEK SMALL LETTER LAMBDA) as an identifier.
4943
4944 ** Support for non-ASCII source code files
4945
4946 The default reader now handles source code files for some of the
4947 non-ASCII character encodings, such as UTF-8. A non-ASCII source file
4948 should have an encoding declaration near the top of the file. Also,
4949 there is a new function, `file-encoding', that scans a port for a coding
4950 declaration. See the section of the manual entitled, "Character Encoding
4951 of Source Files".
4952
4953 The pre-1.9.3 reader handled 8-bit clean but otherwise unspecified source
4954 code. This use is now discouraged. Binary input and output is
4955 currently supported by opening ports in the ISO-8859-1 locale.
4956
4957 ** Source files default to UTF-8.
4958
4959 If source files do not specify their encoding via a `coding:' block,
4960 the default encoding is UTF-8, instead of being taken from the current
4961 locale.
4962
4963 ** Interactive Guile installs the current locale.
4964
4965 Instead of leaving the user in the "C" locale, running the Guile REPL
4966 installs the current locale. [FIXME xref?]
4967
4968 ** Support for locale transcoding when reading from and writing to ports
4969
4970 Ports now have an associated character encoding, and port read and write
4971 operations do conversion to and from locales automatically. Ports also
4972 have an associated strategy for how to deal with locale conversion
4973 failures.
4974
4975 See the documentation in the manual for the four new support functions,
4976 `set-port-encoding!', `port-encoding', `set-port-conversion-strategy!',
4977 and `port-conversion-strategy'.
4978
4979 ** String and SRFI-13 functions can operate on Unicode strings
4980
4981 ** Unicode support for SRFI-14 character sets
4982
4983 The default character sets are no longer locale dependent and contain
4984 characters from the whole Unicode range. There is a new predefined
4985 character set, `char-set:designated', which contains all assigned
4986 Unicode characters. There is a new debugging function, `%char-set-dump'.
4987
4988 ** Character functions operate on Unicode characters
4989
4990 `char-upcase' and `char-downcase' use default Unicode casing rules.
4991 Character comparisons such as `char<?' and `char-ci<?' now sort based on
4992 Unicode code points.
4993
4994 ** Global variables `scm_charnames' and `scm_charnums' are removed
4995
4996 These variables contained the names of control characters and were
4997 used when writing characters. While these were global, they were
4998 never intended to be public API. They have been replaced with private
4999 functions.
5000
5001 ** EBCDIC support is removed
5002
5003 There was an EBCDIC compile flag that altered some of the character
5004 processing. It appeared that full EBCDIC support was never completed
5005 and was unmaintained.
5006
5007 ** Compile-time warnings
5008
5009 Guile can warn about potentially unbound free variables. Pass the
5010 -Wunbound-variable on the `guile-tools compile' command line, or add
5011 `#:warnings '(unbound-variable)' to your `compile' or `compile-file'
5012 invocation. Warnings are also enabled by default for expressions entered
5013 at the REPL.
5014
5015 Guile can also warn when you pass the wrong number of arguments to a
5016 procedure, with -Warity-mismatch, or `arity-mismatch' in the
5017 `#:warnings' as above.
5018
5019 Other warnings include `-Wunused-variable' and `-Wunused-toplevel', to
5020 warn about unused local or global (top-level) variables, and `-Wformat',
5021 to check for various errors related to the `format' procedure.
5022
5023 ** A new `memoize-symbol' evaluator trap has been added.
5024
5025 This trap can be used for efficiently implementing a Scheme code
5026 coverage.
5027
5028 ** Duplicate bindings among used modules are resolved lazily.
5029
5030 This slightly improves program startup times.
5031
5032 ** New thread cancellation and thread cleanup API
5033
5034 See `cancel-thread', `set-thread-cleanup!', and `thread-cleanup'.
5035
5036 ** New threads are in `(guile-user)' by default, not `(guile)'
5037
5038 It used to be that a new thread entering Guile would do so in the
5039 `(guile)' module, unless this was the first time Guile was initialized,
5040 in which case it was `(guile-user)'. This has been fixed to have all
5041 new threads unknown to Guile default to `(guile-user)'.
5042
5043 ** New helpers: `print-exception', `set-exception-printer!'
5044
5045 These functions implement an extensible exception printer. Guile
5046 registers printers for all of the exceptions it throws. Users may add
5047 their own printers. There is also `scm_print_exception', for use by C
5048 programs. Pleasantly, this allows SRFI-35 and R6RS exceptions to be
5049 printed appropriately.
5050
5051 ** GOOPS dispatch in scheme
5052
5053 As an implementation detail, GOOPS dispatch is no longer implemented by
5054 special evaluator bytecodes, but rather directly via a Scheme function
5055 associated with an applicable struct. There is some VM support for the
5056 underlying primitives, like `class-of'.
5057
5058 This change will in the future allow users to customize generic function
5059 dispatch without incurring a performance penalty, and allow us to
5060 implement method combinations.
5061
5062 ** Applicable struct support
5063
5064 One may now make structs from Scheme that may be applied as procedures.
5065 To do so, make a struct whose vtable is `<applicable-struct-vtable>'.
5066 That struct will be the vtable of your applicable structs; instances of
5067 that new struct are assumed to have the procedure in their first slot.
5068 `<applicable-struct-vtable>' is like Common Lisp's
5069 `funcallable-standard-class'. Likewise there is
5070 `<applicable-struct-with-setter-vtable>', which looks for the setter in
5071 the second slot. This needs to be better documented.
5072
5073 ** GOOPS cleanups.
5074
5075 GOOPS had a number of concepts that were relevant to the days of Tcl,
5076 but not any more: operators and entities, mainly. These objects were
5077 never documented, and it is unlikely that they were ever used. Operators
5078 were a kind of generic specific to the Tcl support. Entities were
5079 replaced by applicable structs, mentioned above.
5080
5081 ** New struct slot allocation: "hidden"
5082
5083 A hidden slot is readable and writable, but will not be initialized by a
5084 call to make-struct. For example in your layout you would say "ph"
5085 instead of "pw". Hidden slots are useful for adding new slots to a
5086 vtable without breaking existing invocations to make-struct.
5087
5088 ** eqv? not a generic
5089
5090 One used to be able to extend `eqv?' as a primitive-generic, but no
5091 more. Because `eqv?' is in the expansion of `case' (via `memv'), which
5092 should be able to compile to static dispatch tables, it doesn't make
5093 sense to allow extensions that would subvert this optimization.
5094
5095 ** `inet-ntop' and `inet-pton' are always available.
5096
5097 Guile now use a portable implementation of `inet_pton'/`inet_ntop', so
5098 there is no more need to use `inet-aton'/`inet-ntoa'. The latter
5099 functions are deprecated.
5100
5101 ** `getopt-long' parsing errors throw to `quit', not `misc-error'
5102
5103 This change should inhibit backtraces on argument parsing errors.
5104 `getopt-long' has been modified to print out the error that it throws
5105 itself.
5106
5107 ** New primitive: `tmpfile'.
5108
5109 See "File System" in the manual.
5110
5111 ** Random generator state may be serialized to a datum
5112
5113 `random-state->datum' will serialize a random state to a datum, which
5114 may be written out, read back in later, and revivified using
5115 `datum->random-state'. See "Random" in the manual, for more details.
5116
5117 ** Fix random number generator on 64-bit platforms
5118
5119 There was a nasty bug on 64-bit platforms in which asking for a random
5120 integer with a range between 2**32 and 2**64 caused a segfault. After
5121 many embarrassing iterations, this was fixed.
5122
5123 ** Fast bit operations.
5124
5125 The bit-twiddling operations `ash', `logand', `logior', and `logxor' now
5126 have dedicated bytecodes. Guile is not just for symbolic computation,
5127 it's for number crunching too.
5128
5129 ** Faster SRFI-9 record access
5130
5131 SRFI-9 records are now implemented directly on top of Guile's structs,
5132 and their accessors are defined in such a way that normal call-sites
5133 inline to special VM opcodes, while still allowing for the general case
5134 (e.g. passing a record accessor to `apply').
5135
5136 ** R6RS block comment support
5137
5138 Guile now supports R6RS nested block comments. The start of a comment is
5139 marked with `#|', and the end with `|#'.
5140
5141 ** `guile-2' cond-expand feature
5142
5143 To test if your code is running under Guile 2.0 (or its alpha releases),
5144 test for the `guile-2' cond-expand feature. Like this:
5145
5146 (cond-expand (guile-2 (eval-when (compile)
5147 ;; This must be evaluated at compile time.
5148 (fluid-set! current-reader my-reader)))
5149 (guile
5150 ;; Earlier versions of Guile do not have a
5151 ;; separate compilation phase.
5152 (fluid-set! current-reader my-reader)))
5153
5154 ** New global variables: %load-compiled-path, %load-compiled-extensions
5155
5156 These are analogous to %load-path and %load-extensions.
5157
5158 ** New fluid: `%file-port-name-canonicalization'
5159
5160 This fluid parameterizes the file names that are associated with file
5161 ports. If %file-port-name-canonicalization is 'absolute, then file names
5162 are canonicalized to be absolute paths. If it is 'relative, then the
5163 name is canonicalized, but any prefix corresponding to a member of
5164 `%load-path' is stripped off. Otherwise the names are passed through
5165 unchanged.
5166
5167 In addition, the `compile-file' and `compile-and-load' procedures bind
5168 %file-port-name-canonicalization to their `#:canonicalization' keyword
5169 argument, which defaults to 'relative. In this way, one might compile
5170 "../module/ice-9/boot-9.scm", but the path that gets residualized into
5171 the .go is "ice-9/boot-9.scm".
5172
5173 ** New procedure, `make-promise'
5174
5175 `(make-promise (lambda () foo))' is equivalent to `(delay foo)'.
5176
5177 ** `defined?' may accept a module as its second argument
5178
5179 Previously it only accepted internal structures from the evaluator.
5180
5181 ** New entry into %guile-build-info: `ccachedir'
5182
5183 ** Fix bug in `module-bound?'.
5184
5185 `module-bound?' was returning true if a module did have a local
5186 variable, but one that was unbound, but another imported module bound
5187 the variable. This was an error, and was fixed.
5188
5189 ** `(ice-9 syncase)' has been deprecated.
5190
5191 As syntax-case is available by default, importing `(ice-9 syncase)' has
5192 no effect, and will trigger a deprecation warning.
5193
5194 ** New readline history functions
5195
5196 The (ice-9 readline) module now provides add-history, read-history,
5197 write-history and clear-history, which wrap the corresponding GNU
5198 History library functions.
5199
5200 ** Removed deprecated uniform array procedures:
5201 dimensions->uniform-array, list->uniform-array, array-prototype
5202
5203 Instead, use make-typed-array, list->typed-array, or array-type,
5204 respectively.
5205
5206 ** Deprecate the old `scm-style-repl'
5207
5208 The following bindings from boot-9 are now found in `(ice-9
5209 scm-style-repl)': `scm-style-repl', `error-catching-loop',
5210 `error-catching-repl', `bad-throw', `scm-repl-silent'
5211 `assert-repl-silence', `repl-print-unspecified',
5212 `assert-repl-print-unspecified', `scm-repl-verbose',
5213 `assert-repl-verbosity', `scm-repl-prompt', `set-repl-prompt!', `repl',
5214 `default-pre-unwind-handler', `handle-system-error',
5215
5216 The following bindings have been deprecated, with no replacement:
5217 `pre-unwind-handler-dispatch'.
5218
5219 The following bindings have been totally removed:
5220 `before-signal-stack'.
5221
5222 Deprecated forwarding shims have been installed so that users that
5223 expect these bindings in the main namespace will still work, but receive
5224 a deprecation warning.
5225
5226 ** `set-batch-mode?!' replaced by `ensure-batch-mode!'
5227
5228 "Batch mode" is a flag used to tell a program that it is not running
5229 interactively. One usually turns it on after a fork. It may not be
5230 turned off. `ensure-batch-mode!' deprecates the old `set-batch-mode?!',
5231 because it is a better interface, as it can only turn on batch mode, not
5232 turn it off.
5233
5234 ** Deprecate `save-stack', `the-last-stack'
5235
5236 It used to be that the way to debug programs in Guile was to capture the
5237 stack at the time of error, drop back to the REPL, then debug that
5238 stack. But this approach didn't compose, was tricky to get right in the
5239 presence of threads, and was not very powerful.
5240
5241 So `save-stack', `stack-saved?', and `the-last-stack' have been moved to
5242 `(ice-9 save-stack)', with deprecated bindings left in the root module.
5243
5244 ** `top-repl' has its own module
5245
5246 The `top-repl' binding, called with Guile is run interactively, is now
5247 is its own module, `(ice-9 top-repl)'. A deprecated forwarding shim was
5248 left in the default environment.
5249
5250 ** `display-error' takes a frame
5251
5252 The `display-error' / `scm_display_error' helper now takes a frame as an
5253 argument instead of a stack. Stacks are still supported in deprecated
5254 builds. Additionally, `display-error' will again source location
5255 information for the error.
5256
5257 ** No more `(ice-9 debug)'
5258
5259 This module had some debugging helpers that are no longer applicable to
5260 the current debugging model. Importing this module will produce a
5261 deprecation warning. Users should contact bug-guile for support.
5262
5263 ** Remove obsolete debug-options
5264
5265 Removed `breakpoints', `trace', `procnames', `indent', `frames',
5266 `maxdepth', and `debug' debug-options.
5267
5268 ** `backtrace' debug option on by default
5269
5270 Given that Guile 2.0 can always give you a backtrace, backtraces are now
5271 on by default.
5272
5273 ** `turn-on-debugging' deprecated
5274
5275 ** Remove obsolete print-options
5276
5277 The `source' and `closure-hook' print options are obsolete, and have
5278 been removed.
5279
5280 ** Remove obsolete read-options
5281
5282 The "elisp-strings" and "elisp-vectors" read options were unused and
5283 obsolete, so they have been removed.
5284
5285 ** Remove eval-options and trap-options
5286
5287 Eval-options and trap-options are obsolete with the new VM and
5288 evaluator.
5289
5290 ** Remove (ice-9 debugger) and (ice-9 debugging)
5291
5292 See "Traps" and "Interactive Debugging" in the manual, for information
5293 on their replacements.
5294
5295 ** Remove the GDS Emacs integration
5296
5297 See "Using Guile in Emacs" in the manual, for info on how we think you
5298 should use Guile with Emacs.
5299
5300 ** Deprecated: `lazy-catch'
5301
5302 `lazy-catch' was a form that captured the stack at the point of a
5303 `throw', but the dynamic state at the point of the `catch'. It was a bit
5304 crazy. Please change to use `catch', possibly with a throw-handler, or
5305 `with-throw-handler'.
5306
5307 ** Deprecated: primitive properties
5308
5309 The `primitive-make-property', `primitive-property-set!',
5310 `primitive-property-ref', and `primitive-property-del!' procedures were
5311 crufty and only used to implement object properties, which has a new,
5312 threadsafe implementation. Use object properties or weak hash tables
5313 instead.
5314
5315 ** Deprecated `@bind' syntax
5316
5317 `@bind' was part of an older implementation of the Emacs Lisp language,
5318 and is no longer used.
5319
5320 ** Miscellaneous other deprecations
5321
5322 `cuserid' has been deprecated, as it only returns 8 bytes of a user's
5323 login. Use `(passwd:name (getpwuid (geteuid)))' instead.
5324
5325 Additionally, the procedures `apply-to-args', `has-suffix?', `scheme-file-suffix'
5326 `get-option', `for-next-option', `display-usage-report',
5327 `transform-usage-lambda', `collect', and `set-batch-mode?!' have all
5328 been deprecated.
5329
5330 ** Add support for unbound fluids
5331
5332 See `make-unbound-fluid', `fluid-unset!', and `fluid-bound?' in the
5333 manual.
5334
5335 ** Add `variable-unset!'
5336
5337 See "Variables" in the manual, for more details.
5338
5339 ** Last but not least, the `λ' macro can be used in lieu of `lambda'
5340
5341 * Changes to the C interface
5342
5343 ** Guile now uses libgc, the Boehm-Demers-Weiser garbage collector
5344
5345 The semantics of `scm_gc_malloc ()' have been changed, in a
5346 backward-compatible way. A new allocation routine,
5347 `scm_gc_malloc_pointerless ()', was added.
5348
5349 Libgc is a conservative GC, which we hope will make interaction with C
5350 code easier and less error-prone.
5351
5352 ** New procedures: `scm_to_stringn', `scm_from_stringn'
5353 ** New procedures: scm_{to,from}_{utf8,latin1}_symbol{n,}
5354 ** New procedures: scm_{to,from}_{utf8,utf32,latin1}_string{n,}
5355
5356 These new procedures convert to and from string representations in
5357 particular encodings.
5358
5359 Users should continue to use locale encoding for user input, user
5360 output, or interacting with the C library.
5361
5362 Use the Latin-1 functions for ASCII, and for literals in source code.
5363
5364 Use UTF-8 functions for interaction with modern libraries which deal in
5365 UTF-8, and UTF-32 for interaction with utf32-using libraries.
5366
5367 Otherwise, use scm_to_stringn or scm_from_stringn with a specific
5368 encoding.
5369
5370 ** New type definitions for `scm_t_intptr' and friends.
5371
5372 `SCM_T_UINTPTR_MAX', `SCM_T_INTPTR_MIN', `SCM_T_INTPTR_MAX',
5373 `SIZEOF_SCM_T_BITS', `scm_t_intptr' and `scm_t_uintptr' are now
5374 available to C. Have fun!
5375
5376 ** The GH interface (deprecated in version 1.6, 2001) was removed.
5377
5378 ** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF
5379
5380 This makes these internal functions technically not callable from
5381 application code.
5382
5383 ** Functions for handling `scm_option' now no longer require an argument
5384 indicating length of the `scm_t_option' array.
5385
5386 ** Procedures-with-setters are now implemented using applicable structs
5387
5388 From a user's perspective this doesn't mean very much. But if, for some
5389 odd reason, you used the SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE, or
5390 SCM_SETTER macros, know that they're deprecated now. Also, scm_tc7_pws
5391 is gone.
5392
5393 ** Remove old evaluator closures
5394
5395 There used to be ranges of typecodes allocated to interpreted data
5396 structures, but that it no longer the case, given that interpreted
5397 procedure are now just regular VM closures. As a result, there is a
5398 newly free tc3, and a number of removed macros. See the ChangeLog for
5399 details.
5400
5401 ** Primitive procedures are now VM trampoline procedures
5402
5403 It used to be that there were something like 12 different typecodes
5404 allocated to primitive procedures, each with its own calling convention.
5405 Now there is only one, the gsubr. This may affect user code if you were
5406 defining a procedure using scm_c_make_subr rather scm_c_make_gsubr. The
5407 solution is to switch to use scm_c_make_gsubr. This solution works well
5408 both with the old 1.8 and with the current 1.9 branch.
5409
5410 Guile's old evaluator used to have special cases for applying "gsubrs",
5411 primitive procedures with specified numbers of required, optional, and
5412 rest arguments. Now, however, Guile represents gsubrs as normal VM
5413 procedures, with appropriate bytecode to parse out the correct number of
5414 arguments, including optional and rest arguments, and then with a
5415 special bytecode to apply the gsubr.
5416
5417 This allows primitive procedures to appear on the VM stack, allowing
5418 them to be accurately counted in profiles. Also they now have more
5419 debugging information attached to them -- their number of arguments, for
5420 example. In addition, the VM can completely inline the application
5421 mechanics, allowing for faster primitive calls.
5422
5423 However there are some changes on the C level. There is no more
5424 `scm_tc7_gsubr' or `scm_tcs_subrs' typecode for primitive procedures, as
5425 they are just VM procedures. Likewise the macros `SCM_GSUBR_TYPE',
5426 `SCM_GSUBR_MAKTYPE', `SCM_GSUBR_REQ', `SCM_GSUBR_OPT', and
5427 `SCM_GSUBR_REST' are gone, as are `SCM_SUBR_META_INFO', `SCM_SUBR_PROPS'
5428 `SCM_SET_SUBR_GENERIC_LOC', and `SCM_SUBR_ARITY_TO_TYPE'.
5429
5430 Perhaps more significantly, `scm_c_make_subr',
5431 `scm_c_make_subr_with_generic', `scm_c_define_subr', and
5432 `scm_c_define_subr_with_generic'. They all operated on subr typecodes,
5433 and there are no more subr typecodes. Use the scm_c_make_gsubr family
5434 instead.
5435
5436 Normal users of gsubrs should not be affected, though, as the
5437 scm_c_make_gsubr family still is the correct way to create primitive
5438 procedures.
5439
5440 ** Remove deprecated array C interfaces
5441
5442 Removed the deprecated array functions `scm_i_arrayp',
5443 `scm_i_array_ndim', `scm_i_array_mem', `scm_i_array_v',
5444 `scm_i_array_base', `scm_i_array_dims', and the deprecated macros
5445 `SCM_ARRAYP', `SCM_ARRAY_NDIM', `SCM_ARRAY_CONTP', `SCM_ARRAY_MEM',
5446 `SCM_ARRAY_V', `SCM_ARRAY_BASE', and `SCM_ARRAY_DIMS'.
5447
5448 ** Remove unused snarf macros
5449
5450 `SCM_DEFINE1', `SCM_PRIMITIVE_GENERIC_1', `SCM_PROC1, and `SCM_GPROC1'
5451 are no more. Use SCM_DEFINE or SCM_PRIMITIVE_GENERIC instead.
5452
5453 ** New functions: `scm_call_n', `scm_c_run_hookn'
5454
5455 `scm_call_n' applies to apply a function to an array of arguments.
5456 `scm_c_run_hookn' runs a hook with an array of arguments.
5457
5458 ** Some SMOB types changed to have static typecodes
5459
5460 Fluids, dynamic states, and hash tables used to be SMOB objects, but now
5461 they have statically allocated tc7 typecodes.
5462
5463 ** Preparations for changing SMOB representation
5464
5465 If things go right, we'll be changing the SMOB representation soon. To
5466 that end, we did a lot of cleanups to calls to e.g. SCM_CELL_WORD_2(x) when
5467 the code meant SCM_SMOB_DATA_2(x); user code will need similar changes
5468 in the future. Code accessing SMOBs using SCM_CELL macros was never
5469 correct, but until now things still worked. Users should be aware of
5470 such changes.
5471
5472 ** Changed invocation mechanics of applicable SMOBs
5473
5474 Guile's old evaluator used to have special cases for applying SMOB
5475 objects. Now, with the VM, when Guile sees a SMOB, it looks up a VM
5476 trampoline procedure for it, and use the normal mechanics to apply the
5477 trampoline. This simplifies procedure application in the normal,
5478 non-SMOB case.
5479
5480 The upshot is that the mechanics used to apply a SMOB are different from
5481 1.8. Descriptors no longer have `apply_0', `apply_1', `apply_2', and
5482 `apply_3' functions, and the macros SCM_SMOB_APPLY_0 and friends are now
5483 deprecated. Just use the scm_call_0 family of procedures.
5484
5485 ** Removed support shlibs for SRFIs 1, 4, 13, 14, and 60
5486
5487 Though these SRFI support libraries did expose API, they encoded a
5488 strange version string into their library names. That version was never
5489 programmatically exported, so there was no way people could use the
5490 libs.
5491
5492 This was a fortunate oversight, as it allows us to remove the need for
5493 extra, needless shared libraries --- the C support code for SRFIs 4, 13,
5494 and 14 was already in core --- and allow us to incrementally return the
5495 SRFI implementation to Scheme.
5496
5497 ** New C function: scm_module_public_interface
5498
5499 This procedure corresponds to Scheme's `module-public-interface'.
5500
5501 ** Undeprecate `scm_the_root_module ()'
5502
5503 It's useful to be able to get the root module from C without doing a
5504 full module lookup.
5505
5506 ** Inline vector allocation
5507
5508 Instead of having vectors point out into the heap for their data, their
5509 data is now allocated inline to the vector object itself. The same is
5510 true for bytevectors, by default, though there is an indirection
5511 available which should allow for making a bytevector from an existing
5512 memory region.
5513
5514 ** New struct constructors that don't involve making lists
5515
5516 `scm_c_make_struct' and `scm_c_make_structv' are new varargs and array
5517 constructors, respectively, for structs. You might find them useful.
5518
5519 ** Stack refactor
5520
5521 In Guile 1.8, there were debugging frames on the C stack. Now there is
5522 no more need to explicitly mark the stack in this way, because Guile has
5523 a VM stack that it knows how to walk, which simplifies the C API
5524 considerably. See the ChangeLog for details; the relevant interface is
5525 in libguile/stacks.h. The Scheme API has not been changed significantly.
5526
5527 ** Removal of Guile's primitive object system.
5528
5529 There were a number of pieces in `objects.[ch]' that tried to be a
5530 minimal object system, but were never documented, and were quickly
5531 obseleted by GOOPS' merge into Guile proper. So `scm_make_class_object',
5532 `scm_make_subclass_object', `scm_metaclass_standard', and like symbols
5533 from objects.h are no more. In the very unlikely case in which these
5534 were useful to you, we urge you to contact guile-devel.
5535
5536 ** No future.
5537
5538 Actually the future is still in the state that it was, is, and ever
5539 shall be, Amen, except that `futures.c' and `futures.h' are no longer a
5540 part of it. These files were experimental, never compiled, and would be
5541 better implemented in Scheme anyway. In the future, that is.
5542
5543 ** Deprecate trampolines
5544
5545 There used to be C functions `scm_trampoline_0', `scm_trampoline_1', and
5546 so on. The point was to do some precomputation on the type of the
5547 procedure, then return a specialized "call" procedure. However this
5548 optimization wasn't actually an optimization, so it is now deprecated.
5549 Just use `scm_call_0', etc instead.
5550
5551 ** Deprecated `scm_badargsp'
5552
5553 This function is unused in Guile, but was part of its API.
5554
5555 ** Better support for Lisp `nil'.
5556
5557 The bit representation of `nil' has been tweaked so that it is now very
5558 efficient to check e.g. if a value is equal to Scheme's end-of-list or
5559 Lisp's nil. Additionally there are a heap of new, specific predicates
5560 like scm_is_null_or_nil.
5561
5562 ** Better integration of Lisp `nil'.
5563
5564 `scm_is_boolean', `scm_is_false', and `scm_is_null' all return true now
5565 for Lisp's `nil'. This shouldn't affect any Scheme code at this point,
5566 but when we start to integrate more with Emacs, it is possible that we
5567 break code that assumes that, for example, `(not x)' implies that `x' is
5568 `eq?' to `#f'. This is not a common assumption. Refactoring affected
5569 code to rely on properties instead of identities will improve code
5570 correctness. See "Nil" in the manual, for more details.
5571
5572 ** Support for static allocation of strings, symbols, and subrs.
5573
5574 Calls to snarfing CPP macros like SCM_DEFINE macro will now allocate
5575 much of their associated data as static variables, reducing Guile's
5576 memory footprint.
5577
5578 ** `scm_stat' has an additional argument, `exception_on_error'
5579 ** `scm_primitive_load_path' has an additional argument `exception_on_not_found'
5580
5581 ** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type
5582
5583 Previously they would use the `off_t' type, which is fragile since its
5584 definition depends on the application's value for `_FILE_OFFSET_BITS'.
5585
5586 ** The `long_long' C type, deprecated in 1.8, has been removed
5587
5588 ** Removed deprecated uniform array procedures: scm_make_uve,
5589 scm_array_prototype, scm_list_to_uniform_array,
5590 scm_dimensions_to_uniform_array, scm_make_ra, scm_shap2ra, scm_cvref,
5591 scm_ra_set_contp, scm_aind, scm_raprin1
5592
5593 These functions have been deprecated since early 2005.
5594
5595 * Changes to the distribution
5596
5597 ** Guile's license is now LGPLv3+
5598
5599 In other words the GNU Lesser General Public License, version 3 or
5600 later (at the discretion of each person that chooses to redistribute
5601 part of Guile).
5602
5603 ** AM_SILENT_RULES
5604
5605 Guile's build is visually quieter, due to the use of Automake 1.11's
5606 AM_SILENT_RULES. Build as `make V=1' to see all of the output.
5607
5608 ** GOOPS documentation folded into Guile reference manual
5609
5610 GOOPS, Guile's object system, used to be documented in separate manuals.
5611 This content is now included in Guile's manual directly.
5612
5613 ** `guile-config' will be deprecated in favor of `pkg-config'
5614
5615 `guile-config' has been rewritten to get its information from
5616 `pkg-config', so this should be a transparent change. Note however that
5617 guile.m4 has yet to be modified to call pkg-config instead of
5618 guile-config.
5619
5620 ** Guile now provides `guile-2.0.pc' instead of `guile-1.8.pc'
5621
5622 Programs that use `pkg-config' to find Guile or one of its Autoconf
5623 macros should now require `guile-2.0' instead of `guile-1.8'.
5624
5625 ** New installation directory: $(pkglibdir)/1.9/ccache
5626
5627 If $(libdir) is /usr/lib, for example, Guile will install its .go files
5628 to /usr/lib/guile/1.9/ccache. These files are architecture-specific.
5629
5630 ** Parallel installability fixes
5631
5632 Guile now installs its header files to a effective-version-specific
5633 directory, and includes the effective version (e.g. 2.0) in the library
5634 name (e.g. libguile-2.0.so).
5635
5636 This change should be transparent to users, who should detect Guile via
5637 the guile.m4 macro, or the guile-2.0.pc pkg-config file. It will allow
5638 parallel installs for multiple versions of Guile development
5639 environments.
5640
5641 ** Dynamically loadable extensions may be placed in a Guile-specific path
5642
5643 Before, Guile only searched the system library paths for extensions
5644 (e.g. /usr/lib), which meant that the names of Guile extensions had to
5645 be globally unique. Installing them to a Guile-specific extensions
5646 directory is cleaner. Use `pkg-config --variable=extensiondir
5647 guile-2.0' to get the location of the extensions directory.
5648
5649 ** User Scheme code may be placed in a version-specific path
5650
5651 Before, there was only one way to install user Scheme code to a
5652 version-specific Guile directory: install to Guile's own path,
5653 e.g. /usr/share/guile/2.0. The site directory,
5654 e.g. /usr/share/guile/site, was unversioned. This has been changed to
5655 add a version-specific site directory, e.g. /usr/share/guile/site/2.0,
5656 searched before the global site directory.
5657
5658 ** New dependency: libgc
5659
5660 See http://www.hpl.hp.com/personal/Hans_Boehm/gc/, for more information.
5661
5662 ** New dependency: GNU libunistring
5663
5664 See http://www.gnu.org/software/libunistring/, for more information. Our
5665 Unicode support uses routines from libunistring.
5666
5667 ** New dependency: libffi
5668
5669 See http://sourceware.org/libffi/, for more information.
5670
5671
5672
5673 Changes in 1.8.8 (since 1.8.7)
5674
5675 * Bugs fixed
5676
5677 ** Fix possible buffer overruns when parsing numbers
5678 ** Avoid clash with system setjmp/longjmp on IA64
5679 ** Fix `wrong type arg' exceptions with IPv6 addresses
5680
5681
5682 Changes in 1.8.7 (since 1.8.6)
5683
5684 * New modules (see the manual for details)
5685
5686 ** `(srfi srfi-98)', an interface to access environment variables
5687
5688 * Bugs fixed
5689
5690 ** Fix compilation with `--disable-deprecated'
5691 ** Fix %fast-slot-ref/set!, to avoid possible segmentation fault
5692 ** Fix MinGW build problem caused by HAVE_STRUCT_TIMESPEC confusion
5693 ** Fix build problem when scm_t_timespec is different from struct timespec
5694 ** Fix build when compiled with -Wundef -Werror
5695 ** More build fixes for `alphaev56-dec-osf5.1b' (Tru64)
5696 ** Build fixes for `powerpc-ibm-aix5.3.0.0' (AIX 5.3)
5697 ** With GCC, always compile with `-mieee' on `alpha*' and `sh*'
5698 ** Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130)
5699 ** Fix parsing of SRFI-88/postfix keywords longer than 128 characters
5700 ** Fix reading of complex numbers where both parts are inexact decimals
5701
5702 ** Allow @ macro to work with (ice-9 syncase)
5703
5704 Previously, use of the @ macro in a module whose code is being
5705 transformed by (ice-9 syncase) would cause an "Invalid syntax" error.
5706 Now it works as you would expect (giving the value of the specified
5707 module binding).
5708
5709 ** Have `scm_take_locale_symbol ()' return an interned symbol (bug #25865)
5710
5711
5712 Changes in 1.8.6 (since 1.8.5)
5713
5714 * New features (see the manual for details)
5715
5716 ** New convenience function `scm_c_symbol_length ()'
5717
5718 ** Single stepping through code from Emacs
5719
5720 When you use GDS to evaluate Scheme code from Emacs, you can now use
5721 `C-u' to indicate that you want to single step through that code. See
5722 `Evaluating Scheme Code' in the manual for more details.
5723
5724 ** New "guile(1)" man page!
5725
5726 * Changes to the distribution
5727
5728 ** Automake's `AM_MAINTAINER_MODE' is no longer used
5729
5730 Thus, the `--enable-maintainer-mode' configure option is no longer
5731 available: Guile is now always configured in "maintainer mode".
5732
5733 ** `ChangeLog' files are no longer updated
5734
5735 Instead, changes are detailed in the version control system's logs. See
5736 the top-level `ChangeLog' files for details.
5737
5738
5739 * Bugs fixed
5740
5741 ** `symbol->string' now returns a read-only string, as per R5RS
5742 ** Fix incorrect handling of the FLAGS argument of `fold-matches'
5743 ** `guile-config link' now prints `-L$libdir' before `-lguile'
5744 ** Fix memory corruption involving GOOPS' `class-redefinition'
5745 ** Fix possible deadlock in `mutex-lock'
5746 ** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro)
5747 ** Fix build issue on mips, mipsel, powerpc and ia64 (stack direction)
5748 ** Fix build issue on hppa2.0w-hp-hpux11.11 (`dirent64' and `readdir64_r')
5749 ** Fix build issue on i386-unknown-freebsd7.0 ("break strict-aliasing rules")
5750 ** Fix misleading output from `(help rationalize)'
5751 ** Fix build failure on Debian hppa architecture (bad stack growth detection)
5752 ** Fix `gcd' when called with a single, negative argument.
5753 ** Fix `Stack overflow' errors seen when building on some platforms
5754 ** Fix bug when `scm_with_guile ()' was called several times from the
5755 same thread
5756 ** The handler of SRFI-34 `with-exception-handler' is now invoked in the
5757 dynamic environment of the call to `raise'
5758 ** Fix potential deadlock in `make-struct'
5759 ** Fix compilation problem with libltdl from Libtool 2.2.x
5760 ** Fix sloppy bound checking in `string-{ref,set!}' with the empty string
5761
5762
5763 Changes in 1.8.5 (since 1.8.4)
5764
5765 * Infrastructure changes
5766
5767 ** Guile repository switched from CVS to Git
5768
5769 The new repository can be accessed using
5770 "git-clone git://git.sv.gnu.org/guile.git", or can be browsed on-line at
5771 http://git.sv.gnu.org/gitweb/?p=guile.git . See `README' for details.
5772
5773 ** Add support for `pkg-config'
5774
5775 See "Autoconf Support" in the manual for details.
5776
5777 * New modules (see the manual for details)
5778
5779 ** `(srfi srfi-88)'
5780
5781 * New features (see the manual for details)
5782
5783 ** New `postfix' read option, for SRFI-88 keyword syntax
5784 ** Some I/O primitives have been inlined, which improves I/O performance
5785 ** New object-based traps infrastructure
5786
5787 This is a GOOPS-based infrastructure that builds on Guile's low-level
5788 evaluator trap calls and facilitates the development of debugging
5789 features like single-stepping, breakpoints, tracing and profiling.
5790 See the `Traps' node of the manual for details.
5791
5792 ** New support for working on Guile code from within Emacs
5793
5794 Guile now incorporates the `GDS' library (previously distributed
5795 separately) for working on Guile code from within Emacs. See the
5796 `Using Guile In Emacs' node of the manual for details.
5797
5798 * Bugs fixed
5799
5800 ** `scm_add_slot ()' no longer segfaults (fixes bug #22369)
5801 ** Fixed `(ice-9 match)' for patterns like `((_ ...) ...)'
5802
5803 Previously, expressions like `(match '((foo) (bar)) (((_ ...) ...) #t))'
5804 would trigger an unbound variable error for `match:andmap'.
5805
5806 ** `(oop goops describe)' now properly provides the `describe' feature
5807 ** Fixed `args-fold' from `(srfi srfi-37)'
5808
5809 Previously, parsing short option names of argument-less options would
5810 lead to a stack overflow.
5811
5812 ** `(srfi srfi-35)' is now visible through `cond-expand'
5813 ** Fixed type-checking for the second argument of `eval'
5814 ** Fixed type-checking for SRFI-1 `partition'
5815 ** Fixed `struct-ref' and `struct-set!' on "light structs"
5816 ** Honor struct field access rights in GOOPS
5817 ** Changed the storage strategy of source properties, which fixes a deadlock
5818 ** Allow compilation of Guile-using programs in C99 mode with GCC 4.3 and later
5819 ** Fixed build issue for GNU/Linux on IA64
5820 ** Fixed build issues on NetBSD 1.6
5821 ** Fixed build issue on Solaris 2.10 x86_64
5822 ** Fixed build issue with DEC/Compaq/HP's compiler
5823 ** Fixed `scm_from_complex_double' build issue on FreeBSD
5824 ** Fixed `alloca' build issue on FreeBSD 6
5825 ** Removed use of non-portable makefile constructs
5826 ** Fixed shadowing of libc's <random.h> on Tru64, which broke compilation
5827 ** Make sure all tests honor `$TMPDIR'
5828
5829
5830 Changes in 1.8.4 (since 1.8.3)
5831
5832 * Bugs fixed
5833
5834 ** CR (ASCII 0x0d) is (again) recognized as a token delimiter by the reader
5835 ** Fixed a segmentation fault which occurred when displaying the
5836 backtrace of a stack with a promise object (made by `delay') in it.
5837 ** Make `accept' leave guile mode while blocking
5838 ** `scm_c_read ()' and `scm_c_write ()' now type-check their port argument
5839 ** Fixed a build problem on AIX (use of func_data identifier)
5840 ** Fixed a segmentation fault which occurred when hashx-ref or hashx-set! was
5841 called with an associator proc that returns neither a pair nor #f.
5842 ** Secondary threads now always return a valid module for (current-module).
5843 ** Avoid MacOS build problems caused by incorrect combination of "64"
5844 system and library calls.
5845 ** `guile-snarf' now honors `$TMPDIR'
5846 ** `guile-config compile' now reports CPPFLAGS used at compile-time
5847 ** Fixed build with Sun Studio (Solaris 9)
5848 ** Fixed wrong-type-arg errors when creating zero length SRFI-4
5849 uniform vectors on AIX.
5850 ** Fixed a deadlock that occurs upon GC with multiple threads.
5851 ** Fixed compile problem with GCC on Solaris and AIX (use of _Complex_I)
5852 ** Fixed autotool-derived build problems on AIX 6.1.
5853 ** Fixed NetBSD/alpha support
5854 ** Fixed MacOS build problem caused by use of rl_get_keymap(_name)
5855
5856 * New modules (see the manual for details)
5857
5858 ** `(srfi srfi-69)'
5859
5860 * Documentation fixes and improvements
5861
5862 ** Removed premature breakpoint documentation
5863
5864 The features described are not available in the series of 1.8.x
5865 releases, so the documentation was misleading and has been removed.
5866
5867 ** More about Guile's default *random-state* variable
5868
5869 ** GOOPS: more about how to use `next-method'
5870
5871 * Changes to the distribution
5872
5873 ** Corrected a few files that referred incorrectly to the old GPL + special exception licence
5874
5875 In fact Guile since 1.8.0 has been licensed with the GNU Lesser
5876 General Public License, and the few incorrect files have now been
5877 fixed to agree with the rest of the Guile distribution.
5878
5879 ** Removed unnecessary extra copies of COPYING*
5880
5881 The distribution now contains a single COPYING.LESSER at its top level.
5882
5883
5884 Changes in 1.8.3 (since 1.8.2)
5885
5886 * New modules (see the manual for details)
5887
5888 ** `(srfi srfi-35)'
5889 ** `(srfi srfi-37)'
5890
5891 * Bugs fixed
5892
5893 ** The `(ice-9 slib)' module now works as expected
5894 ** Expressions like "(set! 'x #t)" no longer yield a crash
5895 ** Warnings about duplicate bindings now go to stderr
5896 ** A memory leak in `make-socket-address' was fixed
5897 ** Alignment issues (e.g., on SPARC) in network routines were fixed
5898 ** A threading issue that showed up at least on NetBSD was fixed
5899 ** Build problems on Solaris and IRIX fixed
5900
5901 * Implementation improvements
5902
5903 ** The reader is now faster, which reduces startup time
5904 ** Procedures returned by `record-accessor' and `record-modifier' are faster
5905
5906
5907 Changes in 1.8.2 (since 1.8.1):
5908
5909 * New procedures (see the manual for details)
5910
5911 ** set-program-arguments
5912 ** make-vtable
5913
5914 * Incompatible changes
5915
5916 ** The body of a top-level `define' no longer sees the binding being created
5917
5918 In a top-level `define', the binding being created is no longer visible
5919 from the `define' body. This breaks code like
5920 "(define foo (begin (set! foo 1) (+ foo 1)))", where `foo' is now
5921 unbound in the body. However, such code was not R5RS-compliant anyway,
5922 per Section 5.2.1.
5923
5924 * Bugs fixed
5925
5926 ** Fractions were not `equal?' if stored in unreduced form.
5927 (A subtle problem, since printing a value reduced it, making it work.)
5928 ** srfi-60 `copy-bit' failed on 64-bit systems
5929 ** "guile --use-srfi" option at the REPL can replace core functions
5930 (Programs run with that option were ok, but in the interactive REPL
5931 the core bindings got priority, preventing SRFI replacements or
5932 extensions.)
5933 ** `regexp-exec' doesn't abort() on #\nul in the input or bad flags arg
5934 ** `kill' on mingw throws an error for a PID other than oneself
5935 ** Procedure names are attached to procedure-with-setters
5936 ** Array read syntax works with negative lower bound
5937 ** `array-in-bounds?' fix if an array has different lower bounds on each index
5938 ** `*' returns exact 0 for "(* inexact 0)"
5939 This follows what it always did for "(* 0 inexact)".
5940 ** SRFI-19: Value returned by `(current-time time-process)' was incorrect
5941 ** SRFI-19: `date->julian-day' did not account for timezone offset
5942 ** `ttyname' no longer crashes when passed a non-tty argument
5943 ** `inet-ntop' no longer crashes on SPARC when passed an `AF_INET' address
5944 ** Small memory leaks have been fixed in `make-fluid' and `add-history'
5945 ** GOOPS: Fixed a bug in `method-more-specific?'
5946 ** Build problems on Solaris fixed
5947 ** Build problems on HP-UX IA64 fixed
5948 ** Build problems on MinGW fixed
5949
5950
5951 Changes in 1.8.1 (since 1.8.0):
5952
5953 * LFS functions are now used to access 64-bit files on 32-bit systems.
5954
5955 * New procedures (see the manual for details)
5956
5957 ** primitive-_exit - [Scheme] the-root-module
5958 ** scm_primitive__exit - [C]
5959 ** make-completion-function - [Scheme] (ice-9 readline)
5960 ** scm_c_locale_stringn_to_number - [C]
5961 ** scm_srfi1_append_reverse [C]
5962 ** scm_srfi1_append_reverse_x [C]
5963 ** scm_log - [C]
5964 ** scm_log10 - [C]
5965 ** scm_exp - [C]
5966 ** scm_sqrt - [C]
5967
5968 * Bugs fixed
5969
5970 ** Build problems have been fixed on MacOS, SunOS, and QNX.
5971
5972 ** `strftime' fix sign of %z timezone offset.
5973
5974 ** A one-dimensional array can now be 'equal?' to a vector.
5975
5976 ** Structures, records, and SRFI-9 records can now be compared with `equal?'.
5977
5978 ** SRFI-14 standard char sets are recomputed upon a successful `setlocale'.
5979
5980 ** `record-accessor' and `record-modifier' now have strict type checks.
5981
5982 Record accessor and modifier procedures now throw an error if the
5983 record type of the record they're given is not the type expected.
5984 (Previously accessors returned #f and modifiers silently did nothing).
5985
5986 ** It is now OK to use both autoload and use-modules on a given module.
5987
5988 ** `apply' checks the number of arguments more carefully on "0 or 1" funcs.
5989
5990 Previously there was no checking on primatives like make-vector that
5991 accept "one or two" arguments. Now there is.
5992
5993 ** The srfi-1 assoc function now calls its equality predicate properly.
5994
5995 Previously srfi-1 assoc would call the equality predicate with the key
5996 last. According to the SRFI, the key should be first.
5997
5998 ** A bug in n-par-for-each and n-for-each-par-map has been fixed.
5999
6000 ** The array-set! procedure no longer segfaults when given a bit vector.
6001
6002 ** Bugs in make-shared-array have been fixed.
6003
6004 ** string<? and friends now follow char<? etc order on 8-bit chars.
6005
6006 ** The format procedure now handles inf and nan values for ~f correctly.
6007
6008 ** exact->inexact should no longer overflow when given certain large fractions.
6009
6010 ** srfi-9 accessor and modifier procedures now have strict record type checks.
6011
6012 This matches the srfi-9 specification.
6013
6014 ** (ice-9 ftw) procedures won't ignore different files with same inode number.
6015
6016 Previously the (ice-9 ftw) procedures would ignore any file that had
6017 the same inode number as a file they had already seen, even if that
6018 file was on a different device.
6019
6020
6021 Changes in 1.8.0 (changes since the 1.6.x series):
6022
6023 * Changes to the distribution
6024
6025 ** Guile is now licensed with the GNU Lesser General Public License.
6026
6027 ** The manual is now licensed with the GNU Free Documentation License.
6028
6029 ** Guile now requires GNU MP (http://swox.com/gmp).
6030
6031 Guile now uses the GNU MP library for arbitrary precision arithmetic.
6032
6033 ** Guile now has separate private and public configuration headers.
6034
6035 That is, things like HAVE_STRING_H no longer leak from Guile's
6036 headers.
6037
6038 ** Guile now provides and uses an "effective" version number.
6039
6040 Guile now provides scm_effective_version and effective-version
6041 functions which return the "effective" version number. This is just
6042 the normal full version string without the final micro-version number,
6043 so the current effective-version is "1.8". The effective version
6044 should remain unchanged during a stable series, and should be used for
6045 items like the versioned share directory name
6046 i.e. /usr/share/guile/1.8.
6047
6048 Providing an unchanging version number during a stable release for
6049 things like the versioned share directory can be particularly
6050 important for Guile "add-on" packages, since it provides a directory
6051 that they can install to that won't be changed out from under them
6052 with each micro release during a stable series.
6053
6054 ** Thread implementation has changed.
6055
6056 When you configure "--with-threads=null", you will get the usual
6057 threading API (call-with-new-thread, make-mutex, etc), but you can't
6058 actually create new threads. Also, "--with-threads=no" is now
6059 equivalent to "--with-threads=null". This means that the thread API
6060 is always present, although you might not be able to create new
6061 threads.
6062
6063 When you configure "--with-threads=pthreads" or "--with-threads=yes",
6064 you will get threads that are implemented with the portable POSIX
6065 threads. These threads can run concurrently (unlike the previous
6066 "coop" thread implementation), but need to cooperate for things like
6067 the GC.
6068
6069 The default is "pthreads", unless your platform doesn't have pthreads,
6070 in which case "null" threads are used.
6071
6072 See the manual for details, nodes "Initialization", "Multi-Threading",
6073 "Blocking", and others.
6074
6075 ** There is the new notion of 'discouraged' features.
6076
6077 This is a milder form of deprecation.
6078
6079 Things that are discouraged should not be used in new code, but it is
6080 OK to leave them in old code for now. When a discouraged feature is
6081 used, no warning message is printed like there is for 'deprecated'
6082 features. Also, things that are merely discouraged are nevertheless
6083 implemented efficiently, while deprecated features can be very slow.
6084
6085 You can omit discouraged features from libguile by configuring it with
6086 the '--disable-discouraged' option.
6087
6088 ** Deprecation warnings can be controlled at run-time.
6089
6090 (debug-enable 'warn-deprecated) switches them on and (debug-disable
6091 'warn-deprecated) switches them off.
6092
6093 ** Support for SRFI 61, extended cond syntax for multiple values has
6094 been added.
6095
6096 This SRFI is always available.
6097
6098 ** Support for require-extension, SRFI-55, has been added.
6099
6100 The SRFI-55 special form `require-extension' has been added. It is
6101 available at startup, and provides a portable way to load Scheme
6102 extensions. SRFI-55 only requires support for one type of extension,
6103 "srfi"; so a set of SRFIs may be loaded via (require-extension (srfi 1
6104 13 14)).
6105
6106 ** New module (srfi srfi-26) provides support for `cut' and `cute'.
6107
6108 The (srfi srfi-26) module is an implementation of SRFI-26 which
6109 provides the `cut' and `cute' syntax. These may be used to specialize
6110 parameters without currying.
6111
6112 ** New module (srfi srfi-31)
6113
6114 This is an implementation of SRFI-31 which provides a special form
6115 `rec' for recursive evaluation.
6116
6117 ** The modules (srfi srfi-13), (srfi srfi-14) and (srfi srfi-4) have
6118 been merged with the core, making their functionality always
6119 available.
6120
6121 The modules are still available, tho, and you could use them together
6122 with a renaming import, for example.
6123
6124 ** Guile no longer includes its own version of libltdl.
6125
6126 The official version is good enough now.
6127
6128 ** The --enable-htmldoc option has been removed from 'configure'.
6129
6130 Support for translating the documentation into HTML is now always
6131 provided. Use 'make html'.
6132
6133 ** New module (ice-9 serialize):
6134
6135 (serialize FORM1 ...) and (parallelize FORM1 ...) are useful when you
6136 don't trust the thread safety of most of your program, but where you
6137 have some section(s) of code which you consider can run in parallel to
6138 other sections. See ice-9/serialize.scm for more information.
6139
6140 ** The configure option '--disable-arrays' has been removed.
6141
6142 Support for arrays and uniform numeric arrays is now always included
6143 in Guile.
6144
6145 * Changes to the stand-alone interpreter
6146
6147 ** New command line option `-L'.
6148
6149 This option adds a directory to the front of the load path.
6150
6151 ** New command line option `--no-debug'.
6152
6153 Specifying `--no-debug' on the command line will keep the debugging
6154 evaluator turned off, even for interactive sessions.
6155
6156 ** User-init file ~/.guile is now loaded with the debugging evaluator.
6157
6158 Previously, the normal evaluator would have been used. Using the
6159 debugging evaluator gives better error messages.
6160
6161 ** The '-e' option now 'read's its argument.
6162
6163 This is to allow the new '(@ MODULE-NAME VARIABLE-NAME)' construct to
6164 be used with '-e'. For example, you can now write a script like
6165
6166 #! /bin/sh
6167 exec guile -e '(@ (demo) main)' -s "$0" "$@"
6168 !#
6169
6170 (define-module (demo)
6171 :export (main))
6172
6173 (define (main args)
6174 (format #t "Demo: ~a~%" args))
6175
6176
6177 * Changes to Scheme functions and syntax
6178
6179 ** Guardians have changed back to their original semantics
6180
6181 Guardians now behave like described in the paper by Dybvig et al. In
6182 particular, they no longer make guarantees about the order in which
6183 they return objects, and they can no longer be greedy.
6184
6185 They no longer drop cyclic data structures.
6186
6187 The C function scm_make_guardian has been changed incompatibly and no
6188 longer takes the 'greedy_p' argument.
6189
6190 ** New function hashx-remove!
6191
6192 This function completes the set of 'hashx' functions.
6193
6194 ** The concept of dynamic roots has been factored into continuation
6195 barriers and dynamic states.
6196
6197 Each thread has a current dynamic state that carries the values of the
6198 fluids. You can create and copy dynamic states and use them as the
6199 second argument for 'eval'. See "Fluids and Dynamic States" in the
6200 manual.
6201
6202 To restrict the influence that captured continuations can have on the
6203 control flow, you can errect continuation barriers. See "Continuation
6204 Barriers" in the manual.
6205
6206 The function call-with-dynamic-root now essentially temporarily
6207 installs a new dynamic state and errects a continuation barrier.
6208
6209 ** The default load path no longer includes "." at the end.
6210
6211 Automatically loading modules from the current directory should not
6212 happen by default. If you want to allow it in a more controlled
6213 manner, set the environment variable GUILE_LOAD_PATH or the Scheme
6214 variable %load-path.
6215
6216 ** The uniform vector and array support has been overhauled.
6217
6218 It now complies with SRFI-4 and the weird prototype based uniform
6219 array creation has been deprecated. See the manual for more details.
6220
6221 Some non-compatible changes have been made:
6222 - characters can no longer be stored into byte arrays.
6223 - strings and bit vectors are no longer considered to be uniform numeric
6224 vectors.
6225 - array-rank throws an error for non-arrays instead of returning zero.
6226 - array-ref does no longer accept non-arrays when no indices are given.
6227
6228 There is the new notion of 'generalized vectors' and corresponding
6229 procedures like 'generalized-vector-ref'. Generalized vectors include
6230 strings, bitvectors, ordinary vectors, and uniform numeric vectors.
6231
6232 Arrays use generalized vectors as their storage, so that you still
6233 have arrays of characters, bits, etc. However, uniform-array-read!
6234 and uniform-array-write can no longer read/write strings and
6235 bitvectors.
6236
6237 ** There is now support for copy-on-write substrings, mutation-sharing
6238 substrings and read-only strings.
6239
6240 Three new procedures are related to this: substring/shared,
6241 substring/copy, and substring/read-only. See the manual for more
6242 information.
6243
6244 ** Backtraces will now highlight the value that caused the error.
6245
6246 By default, these values are enclosed in "{...}", such as in this
6247 example:
6248
6249 guile> (car 'a)
6250
6251 Backtrace:
6252 In current input:
6253 1: 0* [car {a}]
6254
6255 <unnamed port>:1:1: In procedure car in expression (car (quote a)):
6256 <unnamed port>:1:1: Wrong type (expecting pair): a
6257 ABORT: (wrong-type-arg)
6258
6259 The prefix and suffix used for highlighting can be set via the two new
6260 printer options 'highlight-prefix' and 'highlight-suffix'. For
6261 example, putting this into ~/.guile will output the bad value in bold
6262 on an ANSI terminal:
6263
6264 (print-set! highlight-prefix "\x1b[1m")
6265 (print-set! highlight-suffix "\x1b[22m")
6266
6267
6268 ** 'gettext' support for internationalization has been added.
6269
6270 See the manual for details.
6271
6272 ** New syntax '@' and '@@':
6273
6274 You can now directly refer to variables exported from a module by
6275 writing
6276
6277 (@ MODULE-NAME VARIABLE-NAME)
6278
6279 For example (@ (ice-9 pretty-print) pretty-print) will directly access
6280 the pretty-print variable exported from the (ice-9 pretty-print)
6281 module. You don't need to 'use' that module first. You can also use
6282 '@' as a target of 'set!', as in (set! (@ mod var) val).
6283
6284 The related syntax (@@ MODULE-NAME VARIABLE-NAME) works just like '@',
6285 but it can also access variables that have not been exported. It is
6286 intended only for kluges and temporary fixes and for debugging, not
6287 for ordinary code.
6288
6289 ** Keyword syntax has been made more disciplined.
6290
6291 Previously, the name of a keyword was read as a 'token' but printed as
6292 a symbol. Now, it is read as a general Scheme datum which must be a
6293 symbol.
6294
6295 Previously:
6296
6297 guile> #:12
6298 #:#{12}#
6299 guile> #:#{12}#
6300 #:#{\#{12}\#}#
6301 guile> #:(a b c)
6302 #:#{}#
6303 ERROR: In expression (a b c):
6304 Unbound variable: a
6305 guile> #: foo
6306 #:#{}#
6307 ERROR: Unbound variable: foo
6308
6309 Now:
6310
6311 guile> #:12
6312 ERROR: Wrong type (expecting symbol): 12
6313 guile> #:#{12}#
6314 #:#{12}#
6315 guile> #:(a b c)
6316 ERROR: Wrong type (expecting symbol): (a b c)
6317 guile> #: foo
6318 #:foo
6319
6320 ** The printing of symbols that might look like keywords can be
6321 controlled.
6322
6323 The new printer option 'quote-keywordish-symbols' controls how symbols
6324 are printed that have a colon as their first or last character. The
6325 default now is to only quote a symbol with #{...}# when the read
6326 option 'keywords' is not '#f'. Thus:
6327
6328 guile> (define foo (string->symbol ":foo"))
6329 guile> (read-set! keywords #f)
6330 guile> foo
6331 :foo
6332 guile> (read-set! keywords 'prefix)
6333 guile> foo
6334 #{:foo}#
6335 guile> (print-set! quote-keywordish-symbols #f)
6336 guile> foo
6337 :foo
6338
6339 ** 'while' now provides 'break' and 'continue'
6340
6341 break and continue were previously bound in a while loop, but not
6342 documented, and continue didn't quite work properly. The undocumented
6343 parameter to break which gave a return value for the while has been
6344 dropped.
6345
6346 ** 'call-with-current-continuation' is now also available under the name
6347 'call/cc'.
6348
6349 ** The module system now checks for duplicate bindings.
6350
6351 The module system now can check for name conflicts among imported
6352 bindings.
6353
6354 The behavior can be controlled by specifying one or more 'duplicates'
6355 handlers. For example, to make Guile return an error for every name
6356 collision, write:
6357
6358 (define-module (foo)
6359 :use-module (bar)
6360 :use-module (baz)
6361 :duplicates check)
6362
6363 The new default behavior of the module system when a name collision
6364 has been detected is to
6365
6366 1. Give priority to bindings marked as a replacement.
6367 2. Issue a warning (different warning if overriding core binding).
6368 3. Give priority to the last encountered binding (this corresponds to
6369 the old behavior).
6370
6371 If you want the old behavior back without replacements or warnings you
6372 can add the line:
6373
6374 (default-duplicate-binding-handler 'last)
6375
6376 to your .guile init file.
6377
6378 ** New define-module option: :replace
6379
6380 :replace works as :export, but, in addition, marks the binding as a
6381 replacement.
6382
6383 A typical example is `format' in (ice-9 format) which is a replacement
6384 for the core binding `format'.
6385
6386 ** Adding prefixes to imported bindings in the module system
6387
6388 There is now a new :use-module option :prefix. It can be used to add
6389 a prefix to all imported bindings.
6390
6391 (define-module (foo)
6392 :use-module ((bar) :prefix bar:))
6393
6394 will import all bindings exported from bar, but rename them by adding
6395 the prefix `bar:'.
6396
6397 ** Conflicting generic functions can be automatically merged.
6398
6399 When two imported bindings conflict and they are both generic
6400 functions, the two functions can now be merged automatically. This is
6401 activated with the 'duplicates' handler 'merge-generics'.
6402
6403 ** New function: effective-version
6404
6405 Returns the "effective" version number. This is just the normal full
6406 version string without the final micro-version number. See "Changes
6407 to the distribution" above.
6408
6409 ** New threading functions: parallel, letpar, par-map, and friends
6410
6411 These are convenient ways to run calculations in parallel in new
6412 threads. See "Parallel forms" in the manual for details.
6413
6414 ** New function 'try-mutex'.
6415
6416 This function will attempt to lock a mutex but will return immediately
6417 instead of blocking and indicate failure.
6418
6419 ** Waiting on a condition variable can have a timeout.
6420
6421 The function 'wait-condition-variable' now takes a third, optional
6422 argument that specifies the point in time where the waiting should be
6423 aborted.
6424
6425 ** New function 'broadcast-condition-variable'.
6426
6427 ** New functions 'all-threads' and 'current-thread'.
6428
6429 ** Signals and system asyncs work better with threads.
6430
6431 The function 'sigaction' now takes a fourth, optional, argument that
6432 specifies the thread that the handler should run in. When the
6433 argument is omitted, the handler will run in the thread that called
6434 'sigaction'.
6435
6436 Likewise, 'system-async-mark' takes a second, optional, argument that
6437 specifies the thread that the async should run in. When it is
6438 omitted, the async will run in the thread that called
6439 'system-async-mark'.
6440
6441 C code can use the new functions scm_sigaction_for_thread and
6442 scm_system_async_mark_for_thread to pass the new thread argument.
6443
6444 When a thread blocks on a mutex, a condition variable or is waiting
6445 for IO to be possible, it will still execute system asyncs. This can
6446 be used to interrupt such a thread by making it execute a 'throw', for
6447 example.
6448
6449 ** The function 'system-async' is deprecated.
6450
6451 You can now pass any zero-argument procedure to 'system-async-mark'.
6452 The function 'system-async' will just return its argument unchanged
6453 now.
6454
6455 ** New functions 'call-with-blocked-asyncs' and
6456 'call-with-unblocked-asyncs'
6457
6458 The expression (call-with-blocked-asyncs PROC) will call PROC and will
6459 block execution of system asyncs for the current thread by one level
6460 while PROC runs. Likewise, call-with-unblocked-asyncs will call a
6461 procedure and will unblock the execution of system asyncs by one
6462 level for the current thread.
6463
6464 Only system asyncs are affected by these functions.
6465
6466 ** The functions 'mask-signals' and 'unmask-signals' are deprecated.
6467
6468 Use 'call-with-blocked-asyncs' or 'call-with-unblocked-asyncs'
6469 instead. Those functions are easier to use correctly and can be
6470 nested.
6471
6472 ** New function 'unsetenv'.
6473
6474 ** New macro 'define-syntax-public'.
6475
6476 It works like 'define-syntax' and also exports the defined macro (but
6477 only on top-level).
6478
6479 ** There is support for Infinity and NaNs.
6480
6481 Following PLT Scheme, Guile can now work with infinite numbers, and
6482 'not-a-numbers'.
6483
6484 There is new syntax for numbers: "+inf.0" (infinity), "-inf.0"
6485 (negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as
6486 "+nan.0"). These numbers are inexact and have no exact counterpart.
6487
6488 Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the
6489 sign of the dividend. The infinities are integers, and they answer #t
6490 for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is
6491 not '=' to itself, but '+nan.0' is 'eqv?' to itself.
6492
6493 For example
6494
6495 (/ 1 0.0)
6496 => +inf.0
6497
6498 (/ 0 0.0)
6499 => +nan.0
6500
6501 (/ 0)
6502 ERROR: Numerical overflow
6503
6504 Two new predicates 'inf?' and 'nan?' can be used to test for the
6505 special values.
6506
6507 ** Inexact zero can have a sign.
6508
6509 Guile can now distinguish between plus and minus inexact zero, if your
6510 platform supports this, too. The two zeros are equal according to
6511 '=', but not according to 'eqv?'. For example
6512
6513 (- 0.0)
6514 => -0.0
6515
6516 (= 0.0 (- 0.0))
6517 => #t
6518
6519 (eqv? 0.0 (- 0.0))
6520 => #f
6521
6522 ** Guile now has exact rationals.
6523
6524 Guile can now represent fractions such as 1/3 exactly. Computing with
6525 them is also done exactly, of course:
6526
6527 (* 1/3 3/2)
6528 => 1/2
6529
6530 ** 'floor', 'ceiling', 'round' and 'truncate' now return exact numbers
6531 for exact arguments.
6532
6533 For example: (floor 2) now returns an exact 2 where in the past it
6534 returned an inexact 2.0. Likewise, (floor 5/4) returns an exact 1.
6535
6536 ** inexact->exact no longer returns only integers.
6537
6538 Without exact rationals, the closest exact number was always an
6539 integer, but now inexact->exact returns the fraction that is exactly
6540 equal to a floating point number. For example:
6541
6542 (inexact->exact 1.234)
6543 => 694680242521899/562949953421312
6544
6545 When you want the old behavior, use 'round' explicitly:
6546
6547 (inexact->exact (round 1.234))
6548 => 1
6549
6550 ** New function 'rationalize'.
6551
6552 This function finds a simple fraction that is close to a given real
6553 number. For example (and compare with inexact->exact above):
6554
6555 (rationalize (inexact->exact 1.234) 1/2000)
6556 => 58/47
6557
6558 Note that, as required by R5RS, rationalize returns only then an exact
6559 result when both its arguments are exact.
6560
6561 ** 'odd?' and 'even?' work also for inexact integers.
6562
6563 Previously, (odd? 1.0) would signal an error since only exact integers
6564 were recognized as integers. Now (odd? 1.0) returns #t, (odd? 2.0)
6565 returns #f and (odd? 1.5) signals an error.
6566
6567 ** Guile now has uninterned symbols.
6568
6569 The new function 'make-symbol' will return an uninterned symbol. This
6570 is a symbol that is unique and is guaranteed to remain unique.
6571 However, uninterned symbols can not yet be read back in.
6572
6573 Use the new function 'symbol-interned?' to check whether a symbol is
6574 interned or not.
6575
6576 ** pretty-print has more options.
6577
6578 The function pretty-print from the (ice-9 pretty-print) module can now
6579 also be invoked with keyword arguments that control things like
6580 maximum output width. See the manual for details.
6581
6582 ** Variables have no longer a special behavior for `equal?'.
6583
6584 Previously, comparing two variables with `equal?' would recursivly
6585 compare their values. This is no longer done. Variables are now only
6586 `equal?' if they are `eq?'.
6587
6588 ** `(begin)' is now valid.
6589
6590 You can now use an empty `begin' form. It will yield #<unspecified>
6591 when evaluated and simply be ignored in a definition context.
6592
6593 ** Deprecated: procedure->macro
6594
6595 Change your code to use 'define-macro' or r5rs macros. Also, be aware
6596 that macro expansion will not be done during evaluation, but prior to
6597 evaluation.
6598
6599 ** Soft ports now allow a `char-ready?' procedure
6600
6601 The vector argument to `make-soft-port' can now have a length of
6602 either 5 or 6. (Previously the length had to be 5.) The optional 6th
6603 element is interpreted as an `input-waiting' thunk -- i.e. a thunk
6604 that returns the number of characters that can be read immediately
6605 without the soft port blocking.
6606
6607 ** Deprecated: undefine
6608
6609 There is no replacement for undefine.
6610
6611 ** The functions make-keyword-from-dash-symbol and keyword-dash-symbol
6612 have been discouraged.
6613
6614 They are relics from a time where a keyword like #:foo was used
6615 directly as a Tcl option "-foo" and thus keywords were internally
6616 stored as a symbol with a starting dash. We now store a symbol
6617 without the dash.
6618
6619 Use symbol->keyword and keyword->symbol instead.
6620
6621 ** The `cheap' debug option is now obsolete
6622
6623 Evaluator trap calls are now unconditionally "cheap" - in other words,
6624 they pass a debug object to the trap handler rather than a full
6625 continuation. The trap handler code can capture a full continuation
6626 by using `call-with-current-continuation' in the usual way, if it so
6627 desires.
6628
6629 The `cheap' option is retained for now so as not to break existing
6630 code which gets or sets it, but setting it now has no effect. It will
6631 be removed in the next major Guile release.
6632
6633 ** Evaluator trap calls now support `tweaking'
6634
6635 `Tweaking' means that the trap handler code can modify the Scheme
6636 expression that is about to be evaluated (in the case of an
6637 enter-frame trap) or the value that is being returned (in the case of
6638 an exit-frame trap). The trap handler code indicates that it wants to
6639 do this by returning a pair whose car is the symbol 'instead and whose
6640 cdr is the modified expression or return value.
6641
6642 * Changes to the C interface
6643
6644 ** The functions scm_hash_fn_remove_x and scm_hashx_remove_x no longer
6645 take a 'delete' function argument.
6646
6647 This argument makes no sense since the delete function is used to
6648 remove a pair from an alist, and this must not be configurable.
6649
6650 This is an incompatible change.
6651
6652 ** The GH interface is now subject to the deprecation mechanism
6653
6654 The GH interface has been deprecated for quite some time but now it is
6655 actually removed from Guile when it is configured with
6656 --disable-deprecated.
6657
6658 See the manual "Transitioning away from GH" for more information.
6659
6660 ** A new family of functions for converting between C values and
6661 Scheme values has been added.
6662
6663 These functions follow a common naming scheme and are designed to be
6664 easier to use, thread-safe and more future-proof than the older
6665 alternatives.
6666
6667 - int scm_is_* (...)
6668
6669 These are predicates that return a C boolean: 1 or 0. Instead of
6670 SCM_NFALSEP, you can now use scm_is_true, for example.
6671
6672 - <type> scm_to_<type> (SCM val, ...)
6673
6674 These are functions that convert a Scheme value into an appropriate
6675 C value. For example, you can use scm_to_int to safely convert from
6676 a SCM to an int.
6677
6678 - SCM scm_from_<type> (<type> val, ...)
6679
6680 These functions convert from a C type to a SCM value; for example,
6681 scm_from_int for ints.
6682
6683 There is a huge number of these functions, for numbers, strings,
6684 symbols, vectors, etc. They are documented in the reference manual in
6685 the API section together with the types that they apply to.
6686
6687 ** New functions for dealing with complex numbers in C have been added.
6688
6689 The new functions are scm_c_make_rectangular, scm_c_make_polar,
6690 scm_c_real_part, scm_c_imag_part, scm_c_magnitude and scm_c_angle.
6691 They work like scm_make_rectangular etc but take or return doubles
6692 directly.
6693
6694 ** The function scm_make_complex has been discouraged.
6695
6696 Use scm_c_make_rectangular instead.
6697
6698 ** The INUM macros have been deprecated.
6699
6700 A lot of code uses these macros to do general integer conversions,
6701 although the macros only work correctly with fixnums. Use the
6702 following alternatives.
6703
6704 SCM_INUMP -> scm_is_integer or similar
6705 SCM_NINUMP -> !scm_is_integer or similar
6706 SCM_MAKINUM -> scm_from_int or similar
6707 SCM_INUM -> scm_to_int or similar
6708
6709 SCM_VALIDATE_INUM_* -> Do not use these; scm_to_int, etc. will
6710 do the validating for you.
6711
6712 ** The scm_num2<type> and scm_<type>2num functions and scm_make_real
6713 have been discouraged.
6714
6715 Use the newer scm_to_<type> and scm_from_<type> functions instead for
6716 new code. The functions have been discouraged since they don't fit
6717 the naming scheme.
6718
6719 ** The 'boolean' macros SCM_FALSEP etc have been discouraged.
6720
6721 They have strange names, especially SCM_NFALSEP, and SCM_BOOLP
6722 evaluates its argument twice. Use scm_is_true, etc. instead for new
6723 code.
6724
6725 ** The macro SCM_EQ_P has been discouraged.
6726
6727 Use scm_is_eq for new code, which fits better into the naming
6728 conventions.
6729
6730 ** The macros SCM_CONSP, SCM_NCONSP, SCM_NULLP, and SCM_NNULLP have
6731 been discouraged.
6732
6733 Use the function scm_is_pair or scm_is_null instead.
6734
6735 ** The functions scm_round and scm_truncate have been deprecated and
6736 are now available as scm_c_round and scm_c_truncate, respectively.
6737
6738 These functions occupy the names that scm_round_number and
6739 scm_truncate_number should have.
6740
6741 ** The functions scm_c_string2str, scm_c_substring2str, and
6742 scm_c_symbol2str have been deprecated.
6743
6744 Use scm_to_locale_stringbuf or similar instead, maybe together with
6745 scm_substring.
6746
6747 ** New functions scm_c_make_string, scm_c_string_length,
6748 scm_c_string_ref, scm_c_string_set_x, scm_c_substring,
6749 scm_c_substring_shared, scm_c_substring_copy.
6750
6751 These are like scm_make_string, scm_length, etc. but are slightly
6752 easier to use from C.
6753
6754 ** The macros SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_LENGTH,
6755 SCM_SYMBOL_CHARS, and SCM_SYMBOL_LENGTH have been deprecated.
6756
6757 They export too many assumptions about the implementation of strings
6758 and symbols that are no longer true in the presence of
6759 mutation-sharing substrings and when Guile switches to some form of
6760 Unicode.
6761
6762 When working with strings, it is often best to use the normal string
6763 functions provided by Guile, such as scm_c_string_ref,
6764 scm_c_string_set_x, scm_string_append, etc. Be sure to look in the
6765 manual since many more such functions are now provided than
6766 previously.
6767
6768 When you want to convert a SCM string to a C string, use the
6769 scm_to_locale_string function or similar instead. For symbols, use
6770 scm_symbol_to_string and then work with that string. Because of the
6771 new string representation, scm_symbol_to_string does not need to copy
6772 and is thus quite efficient.
6773
6774 ** Some string, symbol and keyword functions have been discouraged.
6775
6776 They don't fit into the uniform naming scheme and are not explicit
6777 about the character encoding.
6778
6779 Replace according to the following table:
6780
6781 scm_allocate_string -> scm_c_make_string
6782 scm_take_str -> scm_take_locale_stringn
6783 scm_take0str -> scm_take_locale_string
6784 scm_mem2string -> scm_from_locale_stringn
6785 scm_str2string -> scm_from_locale_string
6786 scm_makfrom0str -> scm_from_locale_string
6787 scm_mem2symbol -> scm_from_locale_symboln
6788 scm_mem2uninterned_symbol -> scm_from_locale_stringn + scm_make_symbol
6789 scm_str2symbol -> scm_from_locale_symbol
6790
6791 SCM_SYMBOL_HASH -> scm_hashq
6792 SCM_SYMBOL_INTERNED_P -> scm_symbol_interned_p
6793
6794 scm_c_make_keyword -> scm_from_locale_keyword
6795
6796 ** The functions scm_keyword_to_symbol and sym_symbol_to_keyword are
6797 now also available to C code.
6798
6799 ** SCM_KEYWORDP and SCM_KEYWORDSYM have been deprecated.
6800
6801 Use scm_is_keyword and scm_keyword_to_symbol instead, but note that
6802 the latter returns the true name of the keyword, not the 'dash name',
6803 as SCM_KEYWORDSYM used to do.
6804
6805 ** A new way to access arrays in a thread-safe and efficient way has
6806 been added.
6807
6808 See the manual, node "Accessing Arrays From C".
6809
6810 ** The old uniform vector and bitvector implementations have been
6811 unceremoniously removed.
6812
6813 This implementation exposed the details of the tagging system of
6814 Guile. Use the new C API explained in the manual in node "Uniform
6815 Numeric Vectors" and "Bit Vectors", respectively.
6816
6817 The following macros are gone: SCM_UVECTOR_BASE, SCM_SET_UVECTOR_BASE,
6818 SCM_UVECTOR_MAXLENGTH, SCM_UVECTOR_LENGTH, SCM_MAKE_UVECTOR_TAG,
6819 SCM_SET_UVECTOR_LENGTH, SCM_BITVECTOR_P, SCM_BITVECTOR_BASE,
6820 SCM_SET_BITVECTOR_BASE, SCM_BITVECTOR_MAX_LENGTH,
6821 SCM_BITVECTOR_LENGTH, SCM_MAKE_BITVECTOR_TAG,
6822 SCM_SET_BITVECTOR_LENGTH, SCM_BITVEC_REF, SCM_BITVEC_SET,
6823 SCM_BITVEC_CLR.
6824
6825 ** The macros dealing with vectors have been deprecated.
6826
6827 Use the new functions scm_is_vector, scm_vector_elements,
6828 scm_vector_writable_elements, etc, or scm_is_simple_vector,
6829 SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, etc instead. See the
6830 manual for more details.
6831
6832 Deprecated are SCM_VECTORP, SCM_VELTS, SCM_VECTOR_MAX_LENGTH,
6833 SCM_VECTOR_LENGTH, SCM_VECTOR_REF, SCM_VECTOR_SET, SCM_WRITABLE_VELTS.
6834
6835 The following macros have been removed: SCM_VECTOR_BASE,
6836 SCM_SET_VECTOR_BASE, SCM_MAKE_VECTOR_TAG, SCM_SET_VECTOR_LENGTH,
6837 SCM_VELTS_AS_STACKITEMS, SCM_SETVELTS, SCM_GC_WRITABLE_VELTS.
6838
6839 ** Some C functions and macros related to arrays have been deprecated.
6840
6841 Migrate according to the following table:
6842
6843 scm_make_uve -> scm_make_typed_array, scm_make_u8vector etc.
6844 scm_make_ra -> scm_make_array
6845 scm_shap2ra -> scm_make_array
6846 scm_cvref -> scm_c_generalized_vector_ref
6847 scm_ra_set_contp -> do not use
6848 scm_aind -> scm_array_handle_pos
6849 scm_raprin1 -> scm_display or scm_write
6850
6851 SCM_ARRAYP -> scm_is_array
6852 SCM_ARRAY_NDIM -> scm_c_array_rank
6853 SCM_ARRAY_DIMS -> scm_array_handle_dims
6854 SCM_ARRAY_CONTP -> do not use
6855 SCM_ARRAY_MEM -> do not use
6856 SCM_ARRAY_V -> scm_array_handle_elements or similar
6857 SCM_ARRAY_BASE -> do not use
6858
6859 ** SCM_CELL_WORD_LOC has been deprecated.
6860
6861 Use the new macro SCM_CELL_OBJECT_LOC instead, which returns a pointer
6862 to a SCM, as opposed to a pointer to a scm_t_bits.
6863
6864 This was done to allow the correct use of pointers into the Scheme
6865 heap. Previously, the heap words were of type scm_t_bits and local
6866 variables and function arguments were of type SCM, making it
6867 non-standards-conformant to have a pointer that can point to both.
6868
6869 ** New macros SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, etc.
6870
6871 These macros should be used instead of SCM_CELL_WORD_2/3 to access the
6872 second and third words of double smobs. Likewise for
6873 SCM_SET_SMOB_DATA_2 and SCM_SET_SMOB_DATA_3.
6874
6875 Also, there is SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS that should be
6876 used to get and set the 16 exra bits in the zeroth word of a smob.
6877
6878 And finally, there is SCM_SMOB_OBJECT and SCM_SMOB_SET_OBJECT for
6879 accesing the first immediate word of a smob as a SCM value, and there
6880 is SCM_SMOB_OBJECT_LOC for getting a pointer to the first immediate
6881 smob word. Like wise for SCM_SMOB_OBJECT_2, etc.
6882
6883 ** New way to deal with non-local exits and re-entries.
6884
6885 There is a new set of functions that essentially do what
6886 scm_internal_dynamic_wind does, but in a way that is more convenient
6887 for C code in some situations. Here is a quick example of how to
6888 prevent a potential memory leak:
6889
6890 void
6891 foo ()
6892 {
6893 char *mem;
6894
6895 scm_dynwind_begin (0);
6896
6897 mem = scm_malloc (100);
6898 scm_dynwind_unwind_handler (free, mem, SCM_F_WIND_EXPLICITLY);
6899
6900 /* MEM would leak if BAR throws an error.
6901 SCM_DYNWIND_UNWIND_HANDLER frees it nevertheless.
6902 */
6903
6904 bar ();
6905
6906 scm_dynwind_end ();
6907
6908 /* Because of SCM_F_WIND_EXPLICITLY, MEM will be freed by
6909 SCM_DYNWIND_END as well.
6910 */
6911 }
6912
6913 For full documentation, see the node "Dynamic Wind" in the manual.
6914
6915 ** New function scm_dynwind_free
6916
6917 This function calls 'free' on a given pointer when a dynwind context
6918 is left. Thus the call to scm_dynwind_unwind_handler above could be
6919 replaced with simply scm_dynwind_free (mem).
6920
6921 ** New functions scm_c_call_with_blocked_asyncs and
6922 scm_c_call_with_unblocked_asyncs
6923
6924 Like scm_call_with_blocked_asyncs etc. but for C functions.
6925
6926 ** New functions scm_dynwind_block_asyncs and scm_dynwind_unblock_asyncs
6927
6928 In addition to scm_c_call_with_blocked_asyncs you can now also use
6929 scm_dynwind_block_asyncs in a 'dynwind context' (see above). Likewise for
6930 scm_c_call_with_unblocked_asyncs and scm_dynwind_unblock_asyncs.
6931
6932 ** The macros SCM_DEFER_INTS, SCM_ALLOW_INTS, SCM_REDEFER_INTS,
6933 SCM_REALLOW_INTS have been deprecated.
6934
6935 They do no longer fulfill their original role of blocking signal
6936 delivery. Depending on what you want to achieve, replace a pair of
6937 SCM_DEFER_INTS and SCM_ALLOW_INTS with a dynwind context that locks a
6938 mutex, blocks asyncs, or both. See node "Critical Sections" in the
6939 manual.
6940
6941 ** The value 'scm_mask_ints' is no longer writable.
6942
6943 Previously, you could set scm_mask_ints directly. This is no longer
6944 possible. Use scm_c_call_with_blocked_asyncs and
6945 scm_c_call_with_unblocked_asyncs instead.
6946
6947 ** New way to temporarily set the current input, output or error ports
6948
6949 C code can now use scm_dynwind_current_<foo>_port in a 'dynwind
6950 context' (see above). <foo> is one of "input", "output" or "error".
6951
6952 ** New way to temporarily set fluids
6953
6954 C code can now use scm_dynwind_fluid in a 'dynwind context' (see
6955 above) to temporarily set the value of a fluid.
6956
6957 ** New types scm_t_intmax and scm_t_uintmax.
6958
6959 On platforms that have them, these types are identical to intmax_t and
6960 uintmax_t, respectively. On other platforms, they are identical to
6961 the largest integer types that Guile knows about.
6962
6963 ** The functions scm_unmemocopy and scm_unmemoize have been removed.
6964
6965 You should not have used them.
6966
6967 ** Many public #defines with generic names have been made private.
6968
6969 #defines with generic names like HAVE_FOO or SIZEOF_FOO have been made
6970 private or renamed with a more suitable public name.
6971
6972 ** The macro SCM_TYP16S has been deprecated.
6973
6974 This macro is not intended for public use.
6975
6976 ** The macro SCM_SLOPPY_INEXACTP has been deprecated.
6977
6978 Use scm_is_true (scm_inexact_p (...)) instead.
6979
6980 ** The macro SCM_SLOPPY_REALP has been deprecated.
6981
6982 Use scm_is_real instead.
6983
6984 ** The macro SCM_SLOPPY_COMPLEXP has been deprecated.
6985
6986 Use scm_is_complex instead.
6987
6988 ** Some preprocessor defines have been deprecated.
6989
6990 These defines indicated whether a certain feature was present in Guile
6991 or not. Going forward, assume that the features are always present.
6992
6993 The macros are: USE_THREADS, GUILE_ISELECT, READER_EXTENSIONS,
6994 DEBUG_EXTENSIONS, DYNAMIC_LINKING.
6995
6996 The following macros have been removed completely: MEMOIZE_LOCALS,
6997 SCM_RECKLESS, SCM_CAUTIOUS.
6998
6999 ** The preprocessor define STACK_DIRECTION has been deprecated.
7000
7001 There should be no need to know about the stack direction for ordinary
7002 programs.
7003
7004 ** New function: scm_effective_version
7005
7006 Returns the "effective" version number. This is just the normal full
7007 version string without the final micro-version number. See "Changes
7008 to the distribution" above.
7009
7010 ** The function scm_call_with_new_thread has a new prototype.
7011
7012 Instead of taking a list with the thunk and handler, these two
7013 arguments are now passed directly:
7014
7015 SCM scm_call_with_new_thread (SCM thunk, SCM handler);
7016
7017 This is an incompatible change.
7018
7019 ** New snarfer macro SCM_DEFINE_PUBLIC.
7020
7021 This is like SCM_DEFINE, but also calls scm_c_export for the defined
7022 function in the init section.
7023
7024 ** The snarfer macro SCM_SNARF_INIT is now officially supported.
7025
7026 ** Garbage collector rewrite.
7027
7028 The garbage collector is cleaned up a lot, and now uses lazy
7029 sweeping. This is reflected in the output of (gc-stats); since cells
7030 are being freed when they are allocated, the cells-allocated field
7031 stays roughly constant.
7032
7033 For malloc related triggers, the behavior is changed. It uses the same
7034 heuristic as the cell-triggered collections. It may be tuned with the
7035 environment variables GUILE_MIN_YIELD_MALLOC. This is the percentage
7036 for minimum yield of malloc related triggers. The default is 40.
7037 GUILE_INIT_MALLOC_LIMIT sets the initial trigger for doing a GC. The
7038 default is 200 kb.
7039
7040 Debugging operations for the freelist have been deprecated, along with
7041 the C variables that control garbage collection. The environment
7042 variables GUILE_MAX_SEGMENT_SIZE, GUILE_INIT_SEGMENT_SIZE_2,
7043 GUILE_INIT_SEGMENT_SIZE_1, and GUILE_MIN_YIELD_2 should be used.
7044
7045 For understanding the memory usage of a GUILE program, the routine
7046 gc-live-object-stats returns an alist containing the number of live
7047 objects for every type.
7048
7049
7050 ** The function scm_definedp has been renamed to scm_defined_p
7051
7052 The name scm_definedp is deprecated.
7053
7054 ** The struct scm_cell type has been renamed to scm_t_cell
7055
7056 This is in accordance to Guile's naming scheme for types. Note that
7057 the name scm_cell is now used for a function that allocates and
7058 initializes a new cell (see below).
7059
7060 ** New functions for memory management
7061
7062 A new set of functions for memory management has been added since the
7063 old way (scm_must_malloc, scm_must_free, etc) was error prone and
7064 indeed, Guile itself contained some long standing bugs that could
7065 cause aborts in long running programs.
7066
7067 The new functions are more symmetrical and do not need cooperation
7068 from smob free routines, among other improvements.
7069
7070 The new functions are scm_malloc, scm_realloc, scm_calloc, scm_strdup,
7071 scm_strndup, scm_gc_malloc, scm_gc_calloc, scm_gc_realloc,
7072 scm_gc_free, scm_gc_register_collectable_memory, and
7073 scm_gc_unregister_collectable_memory. Refer to the manual for more
7074 details and for upgrading instructions.
7075
7076 The old functions for memory management have been deprecated. They
7077 are: scm_must_malloc, scm_must_realloc, scm_must_free,
7078 scm_must_strdup, scm_must_strndup, scm_done_malloc, scm_done_free.
7079
7080 ** Declarations of exported features are marked with SCM_API.
7081
7082 Every declaration of a feature that belongs to the exported Guile API
7083 has been marked by adding the macro "SCM_API" to the start of the
7084 declaration. This macro can expand into different things, the most
7085 common of which is just "extern" for Unix platforms. On Win32, it can
7086 be used to control which symbols are exported from a DLL.
7087
7088 If you `#define SCM_IMPORT' before including <libguile.h>, SCM_API
7089 will expand into "__declspec (dllimport) extern", which is needed for
7090 linking to the Guile DLL in Windows.
7091
7092 There are also SCM_RL_IMPORT, SCM_SRFI1314_IMPORT, and
7093 SCM_SRFI4_IMPORT, for the corresponding libraries.
7094
7095 ** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated.
7096
7097 Use the new functions scm_cell and scm_double_cell instead. The old
7098 macros had problems because with them allocation and initialization
7099 was separated and the GC could sometimes observe half initialized
7100 cells. Only careful coding by the user of SCM_NEWCELL and
7101 SCM_NEWCELL2 could make this safe and efficient.
7102
7103 ** CHECK_ENTRY, CHECK_APPLY and CHECK_EXIT have been deprecated.
7104
7105 Use the variables scm_check_entry_p, scm_check_apply_p and scm_check_exit_p
7106 instead.
7107
7108 ** SRCBRKP has been deprecated.
7109
7110 Use scm_c_source_property_breakpoint_p instead.
7111
7112 ** Deprecated: scm_makmacro
7113
7114 Change your code to use either scm_makmmacro or to define macros in
7115 Scheme, using 'define-macro'.
7116
7117 ** New function scm_c_port_for_each.
7118
7119 This function is like scm_port_for_each but takes a pointer to a C
7120 function as the callback instead of a SCM value.
7121
7122 ** The names scm_internal_select, scm_thread_sleep, and
7123 scm_thread_usleep have been discouraged.
7124
7125 Use scm_std_select, scm_std_sleep, scm_std_usleep instead.
7126
7127 ** The GC can no longer be blocked.
7128
7129 The global flags scm_gc_heap_lock and scm_block_gc have been removed.
7130 The GC can now run (partially) concurrently with other code and thus
7131 blocking it is not well defined.
7132
7133 ** Many definitions have been removed that were previously deprecated.
7134
7135 scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify,
7136 scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify,
7137 scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2,
7138 scm_tc16_allocated, SCM_SET_SYMBOL_HASH, SCM_IM_NIL_IFY, SCM_IM_T_IFY,
7139 SCM_IM_0_COND, SCM_IM_0_IFY, SCM_IM_1_IFY, SCM_GC_SET_ALLOCATED,
7140 scm_debug_newcell, scm_debug_newcell2, SCM_HUP_SIGNAL, SCM_INT_SIGNAL,
7141 SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, SCM_ALRM_SIGNAL,
7142 SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, SCM_ORD_SIG,
7143 SCM_NUM_SIGS, scm_top_level_lookup_closure_var,
7144 *top-level-lookup-closure*, scm_system_transformer, scm_eval_3,
7145 scm_eval2, root_module_lookup_closure, SCM_SLOPPY_STRINGP,
7146 SCM_RWSTRINGP, scm_read_only_string_p, scm_make_shared_substring,
7147 scm_tc7_substring, sym_huh, SCM_VARVCELL, SCM_UDVARIABLEP,
7148 SCM_DEFVARIABLEP, scm_mkbig, scm_big2inum, scm_adjbig, scm_normbig,
7149 scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl, SCM_FIXNUM_BIT,
7150 SCM_SETCHARS, SCM_SLOPPY_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
7151 SCM_LENGTH_MAX, SCM_SETLENGTH, SCM_ROSTRINGP, SCM_ROLENGTH,
7152 SCM_ROCHARS, SCM_ROUCHARS, SCM_SUBSTRP, SCM_COERCE_SUBSTR,
7153 scm_sym2vcell, scm_intern, scm_intern0, scm_sysintern, scm_sysintern0,
7154 scm_sysintern0_no_module_lookup, scm_init_symbols_deprecated,
7155 scm_vector_set_length_x, scm_contregs, scm_debug_info,
7156 scm_debug_frame, SCM_DSIDEVAL, SCM_CONST_LONG, SCM_VCELL,
7157 SCM_GLOBAL_VCELL, SCM_VCELL_INIT, SCM_GLOBAL_VCELL_INIT,
7158 SCM_HUGE_LENGTH, SCM_VALIDATE_STRINGORSUBSTR, SCM_VALIDATE_ROSTRING,
7159 SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY,
7160 SCM_VALIDATE_RWSTRING, DIGITS, scm_small_istr2int, scm_istr2int,
7161 scm_istr2flo, scm_istring2number, scm_istr2int, scm_istr2flo,
7162 scm_istring2number, scm_vtable_index_vcell, scm_si_vcell, SCM_ECONSP,
7163 SCM_NECONSP, SCM_GLOC_VAR, SCM_GLOC_VAL, SCM_GLOC_SET_VAL,
7164 SCM_GLOC_VAL_LOC, scm_make_gloc, scm_gloc_p, scm_tc16_variable,
7165 SCM_CHARS, SCM_LENGTH, SCM_SET_STRING_CHARS, SCM_SET_STRING_LENGTH.
7166
7167 * Changes to bundled modules
7168
7169 ** (ice-9 debug)
7170
7171 Using the (ice-9 debug) module no longer automatically switches Guile
7172 to use the debugging evaluator. If you want to switch to the
7173 debugging evaluator (which is needed for backtrace information if you
7174 hit an error), please add an explicit "(debug-enable 'debug)" to your
7175 code just after the code to use (ice-9 debug).
7176
7177
7178 Changes since Guile 1.4:
7179
7180 * Changes to the distribution
7181
7182 ** A top-level TODO file is included.
7183
7184 ** Guile now uses a versioning scheme similar to that of the Linux kernel.
7185
7186 Guile now always uses three numbers to represent the version,
7187 i.e. "1.6.5". The first number, 1, is the major version number, the
7188 second number, 6, is the minor version number, and the third number,
7189 5, is the micro version number. Changes in major version number
7190 indicate major changes in Guile.
7191
7192 Minor version numbers that are even denote stable releases, and odd
7193 minor version numbers denote development versions (which may be
7194 unstable). The micro version number indicates a minor sub-revision of
7195 a given MAJOR.MINOR release.
7196
7197 In keeping with the new scheme, (minor-version) and scm_minor_version
7198 no longer return everything but the major version number. They now
7199 just return the minor version number. Two new functions
7200 (micro-version) and scm_micro_version have been added to report the
7201 micro version number.
7202
7203 In addition, ./GUILE-VERSION now defines GUILE_MICRO_VERSION.
7204
7205 ** New preprocessor definitions are available for checking versions.
7206
7207 version.h now #defines SCM_MAJOR_VERSION, SCM_MINOR_VERSION, and
7208 SCM_MICRO_VERSION to the appropriate integer values.
7209
7210 ** Guile now actively warns about deprecated features.
7211
7212 The new configure option `--enable-deprecated=LEVEL' and the
7213 environment variable GUILE_WARN_DEPRECATED control this mechanism.
7214 See INSTALL and README for more information.
7215
7216 ** Guile is much more likely to work on 64-bit architectures.
7217
7218 Guile now compiles and passes "make check" with only two UNRESOLVED GC
7219 cases on Alpha and ia64 based machines now. Thanks to John Goerzen
7220 for the use of a test machine, and thanks to Stefan Jahn for ia64
7221 patches.
7222
7223 ** New functions: setitimer and getitimer.
7224
7225 These implement a fairly direct interface to the libc functions of the
7226 same name.
7227
7228 ** The #. reader extension is now disabled by default.
7229
7230 For safety reasons, #. evaluation is disabled by default. To
7231 re-enable it, set the fluid read-eval? to #t. For example:
7232
7233 (fluid-set! read-eval? #t)
7234
7235 but make sure you realize the potential security risks involved. With
7236 read-eval? enabled, reading a data file from an untrusted source can
7237 be dangerous.
7238
7239 ** New SRFI modules have been added:
7240
7241 SRFI-0 `cond-expand' is now supported in Guile, without requiring
7242 using a module.
7243
7244 (srfi srfi-1) is a library containing many useful pair- and list-processing
7245 procedures.
7246
7247 (srfi srfi-2) exports and-let*.
7248
7249 (srfi srfi-4) implements homogeneous numeric vector datatypes.
7250
7251 (srfi srfi-6) is a dummy module for now, since guile already provides
7252 all of the srfi-6 procedures by default: open-input-string,
7253 open-output-string, get-output-string.
7254
7255 (srfi srfi-8) exports receive.
7256
7257 (srfi srfi-9) exports define-record-type.
7258
7259 (srfi srfi-10) exports define-reader-ctor and implements the reader
7260 extension #,().
7261
7262 (srfi srfi-11) exports let-values and let*-values.
7263
7264 (srfi srfi-13) implements the SRFI String Library.
7265
7266 (srfi srfi-14) implements the SRFI Character-Set Library.
7267
7268 (srfi srfi-17) implements setter and getter-with-setter and redefines
7269 some accessor procedures as procedures with getters. (such as car,
7270 cdr, vector-ref etc.)
7271
7272 (srfi srfi-19) implements the SRFI Time/Date Library.
7273
7274 ** New scripts / "executable modules"
7275
7276 Subdirectory "scripts" contains Scheme modules that are packaged to
7277 also be executable as scripts. At this time, these scripts are available:
7278
7279 display-commentary
7280 doc-snarf
7281 generate-autoload
7282 punify
7283 read-scheme-source
7284 use2dot
7285
7286 See README there for more info.
7287
7288 These scripts can be invoked from the shell with the new program
7289 "guile-tools", which keeps track of installation directory for you.
7290 For example:
7291
7292 $ guile-tools display-commentary srfi/*.scm
7293
7294 guile-tools is copied to the standard $bindir on "make install".
7295
7296 ** New module (ice-9 stack-catch):
7297
7298 stack-catch is like catch, but saves the current state of the stack in
7299 the fluid the-last-stack. This fluid can be useful when using the
7300 debugger and when re-throwing an error.
7301
7302 ** The module (ice-9 and-let*) has been renamed to (ice-9 and-let-star)
7303
7304 This has been done to prevent problems on lesser operating systems
7305 that can't tolerate `*'s in file names. The exported macro continues
7306 to be named `and-let*', of course.
7307
7308 On systems that support it, there is also a compatibility module named
7309 (ice-9 and-let*). It will go away in the next release.
7310
7311 ** New modules (oop goops) etc.:
7312
7313 (oop goops)
7314 (oop goops describe)
7315 (oop goops save)
7316 (oop goops active-slot)
7317 (oop goops composite-slot)
7318
7319 The Guile Object Oriented Programming System (GOOPS) has been
7320 integrated into Guile. For further information, consult the GOOPS
7321 manual and tutorial in the `doc' directory.
7322
7323 ** New module (ice-9 rdelim).
7324
7325 This exports the following procedures which were previously defined
7326 in the default environment:
7327
7328 read-line read-line! read-delimited read-delimited! %read-delimited!
7329 %read-line write-line
7330
7331 For backwards compatibility the definitions are still imported into the
7332 default environment in this version of Guile. However you should add:
7333
7334 (use-modules (ice-9 rdelim))
7335
7336 to any program which uses the definitions, since this may change in
7337 future.
7338
7339 Alternatively, if guile-scsh is installed, the (scsh rdelim) module
7340 can be used for similar functionality.
7341
7342 ** New module (ice-9 rw)
7343
7344 This is a subset of the (scsh rw) module from guile-scsh. Currently
7345 it defines two procedures:
7346
7347 *** New function: read-string!/partial str [port_or_fdes [start [end]]]
7348
7349 Read characters from a port or file descriptor into a string STR.
7350 A port must have an underlying file descriptor -- a so-called
7351 fport. This procedure is scsh-compatible and can efficiently read
7352 large strings.
7353
7354 *** New function: write-string/partial str [port_or_fdes [start [end]]]
7355
7356 Write characters from a string STR to a port or file descriptor.
7357 A port must have an underlying file descriptor -- a so-called
7358 fport. This procedure is mostly compatible and can efficiently
7359 write large strings.
7360
7361 ** New module (ice-9 match)
7362
7363 This module includes Andrew K. Wright's pattern matcher. See
7364 ice-9/match.scm for brief description or
7365
7366 http://www.star-lab.com/wright/code.html
7367
7368 for complete documentation.
7369
7370 ** New module (ice-9 buffered-input)
7371
7372 This module provides procedures to construct an input port from an
7373 underlying source of input that reads and returns its input in chunks.
7374 The underlying input source is a Scheme procedure, specified by the
7375 caller, which the port invokes whenever it needs more input.
7376
7377 This is useful when building an input port whose back end is Readline
7378 or a UI element such as the GtkEntry widget.
7379
7380 ** Documentation
7381
7382 The reference and tutorial documentation that was previously
7383 distributed separately, as `guile-doc', is now included in the core
7384 Guile distribution. The documentation consists of the following
7385 manuals.
7386
7387 - The Guile Tutorial (guile-tut.texi) contains a tutorial introduction
7388 to using Guile.
7389
7390 - The Guile Reference Manual (guile.texi) contains (or is intended to
7391 contain) reference documentation on all aspects of Guile.
7392
7393 - The GOOPS Manual (goops.texi) contains both tutorial-style and
7394 reference documentation for using GOOPS, Guile's Object Oriented
7395 Programming System.
7396
7397 - The Revised^5 Report on the Algorithmic Language Scheme
7398 (r5rs.texi).
7399
7400 See the README file in the `doc' directory for more details.
7401
7402 ** There are a couple of examples in the examples/ directory now.
7403
7404 * Changes to the stand-alone interpreter
7405
7406 ** New command line option `--use-srfi'
7407
7408 Using this option, SRFI modules can be loaded on startup and be
7409 available right from the beginning. This makes programming portable
7410 Scheme programs easier.
7411
7412 The option `--use-srfi' expects a comma-separated list of numbers,
7413 each representing a SRFI number to be loaded into the interpreter
7414 before starting evaluating a script file or the REPL. Additionally,
7415 the feature identifier for the loaded SRFIs is recognized by
7416 `cond-expand' when using this option.
7417
7418 Example:
7419 $ guile --use-srfi=8,13
7420 guile> (receive (x z) (values 1 2) (+ 1 2))
7421 3
7422 guile> (string-pad "bla" 20)
7423 " bla"
7424
7425 ** Guile now always starts up in the `(guile-user)' module.
7426
7427 Previously, scripts executed via the `-s' option would run in the
7428 `(guile)' module and the repl would run in the `(guile-user)' module.
7429 Now every user action takes place in the `(guile-user)' module by
7430 default.
7431
7432 * Changes to Scheme functions and syntax
7433
7434 ** Character classifiers work for non-ASCII characters.
7435
7436 The predicates `char-alphabetic?', `char-numeric?',
7437 `char-whitespace?', `char-lower?', `char-upper?' and `char-is-both?'
7438 no longer check whether their arguments are ASCII characters.
7439 Previously, a character would only be considered alphabetic when it
7440 was also ASCII, for example.
7441
7442 ** Previously deprecated Scheme functions have been removed:
7443
7444 tag - no replacement.
7445 fseek - replaced by seek.
7446 list* - replaced by cons*.
7447
7448 ** It's now possible to create modules with controlled environments
7449
7450 Example:
7451
7452 (use-modules (ice-9 safe))
7453 (define m (make-safe-module))
7454 ;;; m will now be a module containing only a safe subset of R5RS
7455 (eval '(+ 1 2) m) --> 3
7456 (eval 'load m) --> ERROR: Unbound variable: load
7457
7458 ** Evaluation of "()", the empty list, is now an error.
7459
7460 Previously, the expression "()" evaluated to the empty list. This has
7461 been changed to signal a "missing expression" error. The correct way
7462 to write the empty list as a literal constant is to use quote: "'()".
7463
7464 ** New concept of `Guile Extensions'.
7465
7466 A Guile Extension is just a ordinary shared library that can be linked
7467 at run-time. We found it advantageous to give this simple concept a
7468 dedicated name to distinguish the issues related to shared libraries
7469 from the issues related to the module system.
7470
7471 *** New function: load-extension
7472
7473 Executing (load-extension lib init) is mostly equivalent to
7474
7475 (dynamic-call init (dynamic-link lib))
7476
7477 except when scm_register_extension has been called previously.
7478 Whenever appropriate, you should use `load-extension' instead of
7479 dynamic-link and dynamic-call.
7480
7481 *** New C function: scm_c_register_extension
7482
7483 This function registers a initialization function for use by
7484 `load-extension'. Use it when you don't want specific extensions to
7485 be loaded as shared libraries (for example on platforms that don't
7486 support dynamic linking).
7487
7488 ** Auto-loading of compiled-code modules is deprecated.
7489
7490 Guile used to be able to automatically find and link a shared
7491 library to satisfy requests for a module. For example, the module
7492 `(foo bar)' could be implemented by placing a shared library named
7493 "foo/libbar.so" (or with a different extension) in a directory on the
7494 load path of Guile.
7495
7496 This has been found to be too tricky, and is no longer supported. The
7497 shared libraries are now called "extensions". You should now write a
7498 small Scheme file that calls `load-extension' to load the shared
7499 library and initialize it explicitly.
7500
7501 The shared libraries themselves should be installed in the usual
7502 places for shared libraries, with names like "libguile-foo-bar".
7503
7504 For example, place this into a file "foo/bar.scm"
7505
7506 (define-module (foo bar))
7507
7508 (load-extension "libguile-foo-bar" "foobar_init")
7509
7510 ** Backward incompatible change: eval EXP ENVIRONMENT-SPECIFIER
7511
7512 `eval' is now R5RS, that is it takes two arguments.
7513 The second argument is an environment specifier, i.e. either
7514
7515 (scheme-report-environment 5)
7516 (null-environment 5)
7517 (interaction-environment)
7518
7519 or
7520
7521 any module.
7522
7523 ** The module system has been made more disciplined.
7524
7525 The function `eval' will save and restore the current module around
7526 the evaluation of the specified expression. While this expression is
7527 evaluated, `(current-module)' will now return the right module, which
7528 is the module specified as the second argument to `eval'.
7529
7530 A consequence of this change is that `eval' is not particularly
7531 useful when you want allow the evaluated code to change what module is
7532 designated as the current module and have this change persist from one
7533 call to `eval' to the next. The read-eval-print-loop is an example
7534 where `eval' is now inadequate. To compensate, there is a new
7535 function `primitive-eval' that does not take a module specifier and
7536 that does not save/restore the current module. You should use this
7537 function together with `set-current-module', `current-module', etc
7538 when you want to have more control over the state that is carried from
7539 one eval to the next.
7540
7541 Additionally, it has been made sure that forms that are evaluated at
7542 the top level are always evaluated with respect to the current module.
7543 Previously, subforms of top-level forms such as `begin', `case',
7544 etc. did not respect changes to the current module although these
7545 subforms are at the top-level as well.
7546
7547 To prevent strange behavior, the forms `define-module',
7548 `use-modules', `use-syntax', and `export' have been restricted to only
7549 work on the top level. The forms `define-public' and
7550 `defmacro-public' only export the new binding on the top level. They
7551 behave just like `define' and `defmacro', respectively, when they are
7552 used in a lexical environment.
7553
7554 Also, `export' will no longer silently re-export bindings imported
7555 from a used module. It will emit a `deprecation' warning and will
7556 cease to perform any re-export in the next version. If you actually
7557 want to re-export bindings, use the new `re-export' in place of
7558 `export'. The new `re-export' will not make copies of variables when
7559 rexporting them, as `export' did wrongly.
7560
7561 ** Module system now allows selection and renaming of imported bindings
7562
7563 Previously, when using `use-modules' or the `#:use-module' clause in
7564 the `define-module' form, all the bindings (association of symbols to
7565 values) for imported modules were added to the "current module" on an
7566 as-is basis. This has been changed to allow finer control through two
7567 new facilities: selection and renaming.
7568
7569 You can now select which of the imported module's bindings are to be
7570 visible in the current module by using the `:select' clause. This
7571 clause also can be used to rename individual bindings. For example:
7572
7573 ;; import all bindings no questions asked
7574 (use-modules (ice-9 common-list))
7575
7576 ;; import four bindings, renaming two of them;
7577 ;; the current module sees: every some zonk-y zonk-n
7578 (use-modules ((ice-9 common-list)
7579 :select (every some
7580 (remove-if . zonk-y)
7581 (remove-if-not . zonk-n))))
7582
7583 You can also programmatically rename all selected bindings using the
7584 `:renamer' clause, which specifies a proc that takes a symbol and
7585 returns another symbol. Because it is common practice to use a prefix,
7586 we now provide the convenience procedure `symbol-prefix-proc'. For
7587 example:
7588
7589 ;; import four bindings, renaming two of them specifically,
7590 ;; and all four w/ prefix "CL:";
7591 ;; the current module sees: CL:every CL:some CL:zonk-y CL:zonk-n
7592 (use-modules ((ice-9 common-list)
7593 :select (every some
7594 (remove-if . zonk-y)
7595 (remove-if-not . zonk-n))
7596 :renamer (symbol-prefix-proc 'CL:)))
7597
7598 ;; import four bindings, renaming two of them specifically,
7599 ;; and all four by upcasing.
7600 ;; the current module sees: EVERY SOME ZONK-Y ZONK-N
7601 (define (upcase-symbol sym)
7602 (string->symbol (string-upcase (symbol->string sym))))
7603
7604 (use-modules ((ice-9 common-list)
7605 :select (every some
7606 (remove-if . zonk-y)
7607 (remove-if-not . zonk-n))
7608 :renamer upcase-symbol))
7609
7610 Note that programmatic renaming is done *after* individual renaming.
7611 Also, the above examples show `use-modules', but the same facilities are
7612 available for the `#:use-module' clause of `define-module'.
7613
7614 See manual for more info.
7615
7616 ** The semantics of guardians have changed.
7617
7618 The changes are for the most part compatible. An important criterion
7619 was to keep the typical usage of guardians as simple as before, but to
7620 make the semantics safer and (as a result) more useful.
7621
7622 *** All objects returned from guardians are now properly alive.
7623
7624 It is now guaranteed that any object referenced by an object returned
7625 from a guardian is alive. It's now impossible for a guardian to
7626 return a "contained" object before its "containing" object.
7627
7628 One incompatible (but probably not very important) change resulting
7629 from this is that it is no longer possible to guard objects that
7630 indirectly reference themselves (i.e. are parts of cycles). If you do
7631 so accidentally, you'll get a warning.
7632
7633 *** There are now two types of guardians: greedy and sharing.
7634
7635 If you call (make-guardian #t) or just (make-guardian), you'll get a
7636 greedy guardian, and for (make-guardian #f) a sharing guardian.
7637
7638 Greedy guardians are the default because they are more "defensive".
7639 You can only greedily guard an object once. If you guard an object
7640 more than once, once in a greedy guardian and the rest of times in
7641 sharing guardians, then it is guaranteed that the object won't be
7642 returned from sharing guardians as long as it is greedily guarded
7643 and/or alive.
7644
7645 Guardians returned by calls to `make-guardian' can now take one more
7646 optional parameter, which says whether to throw an error in case an
7647 attempt is made to greedily guard an object that is already greedily
7648 guarded. The default is true, i.e. throw an error. If the parameter
7649 is false, the guardian invocation returns #t if guarding was
7650 successful and #f if it wasn't.
7651
7652 Also, since greedy guarding is, in effect, a side-effecting operation
7653 on objects, a new function is introduced: `destroy-guardian!'.
7654 Invoking this function on a guardian renders it unoperative and, if
7655 the guardian is greedy, clears the "greedily guarded" property of the
7656 objects that were guarded by it, thus undoing the side effect.
7657
7658 Note that all this hair is hardly very important, since guardian
7659 objects are usually permanent.
7660
7661 ** Continuations created by call-with-current-continuation now accept
7662 any number of arguments, as required by R5RS.
7663
7664 ** New function `issue-deprecation-warning'
7665
7666 This function is used to display the deprecation messages that are
7667 controlled by GUILE_WARN_DEPRECATION as explained in the README.
7668
7669 (define (id x)
7670 (issue-deprecation-warning "`id' is deprecated. Use `identity' instead.")
7671 (identity x))
7672
7673 guile> (id 1)
7674 ;; `id' is deprecated. Use `identity' instead.
7675 1
7676 guile> (id 1)
7677 1
7678
7679 ** New syntax `begin-deprecated'
7680
7681 When deprecated features are included (as determined by the configure
7682 option --enable-deprecated), `begin-deprecated' is identical to
7683 `begin'. When deprecated features are excluded, it always evaluates
7684 to `#f', ignoring the body forms.
7685
7686 ** New function `make-object-property'
7687
7688 This function returns a new `procedure with setter' P that can be used
7689 to attach a property to objects. When calling P as
7690
7691 (set! (P obj) val)
7692
7693 where `obj' is any kind of object, it attaches `val' to `obj' in such
7694 a way that it can be retrieved by calling P as
7695
7696 (P obj)
7697
7698 This function will replace procedure properties, symbol properties and
7699 source properties eventually.
7700
7701 ** Module (ice-9 optargs) now uses keywords instead of `#&'.
7702
7703 Instead of #&optional, #&key, etc you should now use #:optional,
7704 #:key, etc. Since #:optional is a keyword, you can write it as just
7705 :optional when (read-set! keywords 'prefix) is active.
7706
7707 The old reader syntax `#&' is still supported, but deprecated. It
7708 will be removed in the next release.
7709
7710 ** New define-module option: pure
7711
7712 Tells the module system not to include any bindings from the root
7713 module.
7714
7715 Example:
7716
7717 (define-module (totally-empty-module)
7718 :pure)
7719
7720 ** New define-module option: export NAME1 ...
7721
7722 Export names NAME1 ...
7723
7724 This option is required if you want to be able to export bindings from
7725 a module which doesn't import one of `define-public' or `export'.
7726
7727 Example:
7728
7729 (define-module (foo)
7730 :pure
7731 :use-module (ice-9 r5rs)
7732 :export (bar))
7733
7734 ;;; Note that we're pure R5RS below this point!
7735
7736 (define (bar)
7737 ...)
7738
7739 ** New function: object->string OBJ
7740
7741 Return a Scheme string obtained by printing a given object.
7742
7743 ** New function: port? X
7744
7745 Returns a boolean indicating whether X is a port. Equivalent to
7746 `(or (input-port? X) (output-port? X))'.
7747
7748 ** New function: file-port?
7749
7750 Determines whether a given object is a port that is related to a file.
7751
7752 ** New function: port-for-each proc
7753
7754 Apply PROC to each port in the Guile port table in turn. The return
7755 value is unspecified. More specifically, PROC is applied exactly once
7756 to every port that exists in the system at the time PORT-FOR-EACH is
7757 invoked. Changes to the port table while PORT-FOR-EACH is running
7758 have no effect as far as PORT-FOR-EACH is concerned.
7759
7760 ** New function: dup2 oldfd newfd
7761
7762 A simple wrapper for the `dup2' system call. Copies the file
7763 descriptor OLDFD to descriptor number NEWFD, replacing the
7764 previous meaning of NEWFD. Both OLDFD and NEWFD must be integers.
7765 Unlike for dup->fdes or primitive-move->fdes, no attempt is made
7766 to move away ports which are using NEWFD. The return value is
7767 unspecified.
7768
7769 ** New function: close-fdes fd
7770
7771 A simple wrapper for the `close' system call. Close file
7772 descriptor FD, which must be an integer. Unlike close (*note
7773 close: Ports and File Descriptors.), the file descriptor will be
7774 closed even if a port is using it. The return value is
7775 unspecified.
7776
7777 ** New function: crypt password salt
7778
7779 Encrypts `password' using the standard unix password encryption
7780 algorithm.
7781
7782 ** New function: chroot path
7783
7784 Change the root directory of the running process to `path'.
7785
7786 ** New functions: getlogin, cuserid
7787
7788 Return the login name or the user name of the current effective user
7789 id, respectively.
7790
7791 ** New functions: getpriority which who, setpriority which who prio
7792
7793 Get or set the priority of the running process.
7794
7795 ** New function: getpass prompt
7796
7797 Read a password from the terminal, first displaying `prompt' and
7798 disabling echoing.
7799
7800 ** New function: flock file operation
7801
7802 Set/remove an advisory shared or exclusive lock on `file'.
7803
7804 ** New functions: sethostname name, gethostname
7805
7806 Set or get the hostname of the machine the current process is running
7807 on.
7808
7809 ** New function: mkstemp! tmpl
7810
7811 mkstemp creates a new unique file in the file system and returns a
7812 new buffered port open for reading and writing to the file. TMPL
7813 is a string specifying where the file should be created: it must
7814 end with `XXXXXX' and will be changed in place to return the name
7815 of the temporary file.
7816
7817 ** New function: open-input-string string
7818
7819 Return an input string port which delivers the characters from
7820 `string'. This procedure, together with `open-output-string' and
7821 `get-output-string' implements SRFI-6.
7822
7823 ** New function: open-output-string
7824
7825 Return an output string port which collects all data written to it.
7826 The data can then be retrieved by `get-output-string'.
7827
7828 ** New function: get-output-string
7829
7830 Return the contents of an output string port.
7831
7832 ** New function: identity
7833
7834 Return the argument.
7835
7836 ** socket, connect, accept etc., now have support for IPv6. IPv6 addresses
7837 are represented in Scheme as integers with normal host byte ordering.
7838
7839 ** New function: inet-pton family address
7840
7841 Convert a printable string network address into an integer. Note that
7842 unlike the C version of this function, the result is an integer with
7843 normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
7844 e.g.,
7845
7846 (inet-pton AF_INET "127.0.0.1") => 2130706433
7847 (inet-pton AF_INET6 "::1") => 1
7848
7849 ** New function: inet-ntop family address
7850
7851 Convert an integer network address into a printable string. Note that
7852 unlike the C version of this function, the input is an integer with
7853 normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
7854 e.g.,
7855
7856 (inet-ntop AF_INET 2130706433) => "127.0.0.1"
7857 (inet-ntop AF_INET6 (- (expt 2 128) 1)) =>
7858 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
7859
7860 ** Deprecated: id
7861
7862 Use `identity' instead.
7863
7864 ** Deprecated: -1+
7865
7866 Use `1-' instead.
7867
7868 ** Deprecated: return-it
7869
7870 Do without it.
7871
7872 ** Deprecated: string-character-length
7873
7874 Use `string-length' instead.
7875
7876 ** Deprecated: flags
7877
7878 Use `logior' instead.
7879
7880 ** Deprecated: close-all-ports-except.
7881
7882 This was intended for closing ports in a child process after a fork,
7883 but it has the undesirable side effect of flushing buffers.
7884 port-for-each is more flexible.
7885
7886 ** The (ice-9 popen) module now attempts to set up file descriptors in
7887 the child process from the current Scheme ports, instead of using the
7888 current values of file descriptors 0, 1, and 2 in the parent process.
7889
7890 ** Removed function: builtin-weak-bindings
7891
7892 There is no such concept as a weak binding any more.
7893
7894 ** Removed constants: bignum-radix, scm-line-incrementors
7895
7896 ** define-method: New syntax mandatory.
7897
7898 The new method syntax is now mandatory:
7899
7900 (define-method (NAME ARG-SPEC ...) BODY ...)
7901 (define-method (NAME ARG-SPEC ... . REST-ARG) BODY ...)
7902
7903 ARG-SPEC ::= ARG-NAME | (ARG-NAME TYPE)
7904 REST-ARG ::= ARG-NAME
7905
7906 If you have old code using the old syntax, import
7907 (oop goops old-define-method) before (oop goops) as in:
7908
7909 (use-modules (oop goops old-define-method) (oop goops))
7910
7911 ** Deprecated function: builtin-variable
7912 Removed function: builtin-bindings
7913
7914 There is no longer a distinction between builtin or other variables.
7915 Use module system operations for all variables.
7916
7917 ** Lazy-catch handlers are no longer allowed to return.
7918
7919 That is, a call to `throw', `error', etc is now guaranteed to not
7920 return.
7921
7922 ** Bugfixes for (ice-9 getopt-long)
7923
7924 This module is now tested using test-suite/tests/getopt-long.test.
7925 The following bugs have been fixed:
7926
7927 *** Parsing for options that are specified to have `optional' args now checks
7928 if the next element is an option instead of unconditionally taking it as the
7929 option arg.
7930
7931 *** An error is now thrown for `--opt=val' when the option description
7932 does not specify `(value #t)' or `(value optional)'. This condition used to
7933 be accepted w/o error, contrary to the documentation.
7934
7935 *** The error message for unrecognized options is now more informative.
7936 It used to be "not a record", an artifact of the implementation.
7937
7938 *** The error message for `--opt' terminating the arg list (no value), when
7939 `(value #t)' is specified, is now more informative. It used to be "not enough
7940 args".
7941
7942 *** "Clumped" single-char args now preserve trailing string, use it as arg.
7943 The expansion used to be like so:
7944
7945 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "--xyz")
7946
7947 Note that the "5d" is dropped. Now it is like so:
7948
7949 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "5d" "--xyz")
7950
7951 This enables single-char options to have adjoining arguments as long as their
7952 constituent characters are not potential single-char options.
7953
7954 ** (ice-9 session) procedure `arity' now works with (ice-9 optargs) `lambda*'
7955
7956 The `lambda*' and derivative forms in (ice-9 optargs) now set a procedure
7957 property `arglist', which can be retrieved by `arity'. The result is that
7958 `arity' can give more detailed information than before:
7959
7960 Before:
7961
7962 guile> (use-modules (ice-9 optargs))
7963 guile> (define* (foo #:optional a b c) a)
7964 guile> (arity foo)
7965 0 or more arguments in `lambda*:G0'.
7966
7967 After:
7968
7969 guile> (arity foo)
7970 3 optional arguments: `a', `b' and `c'.
7971 guile> (define* (bar a b #:key c d #:allow-other-keys) a)
7972 guile> (arity bar)
7973 2 required arguments: `a' and `b', 2 keyword arguments: `c'
7974 and `d', other keywords allowed.
7975 guile> (define* (baz a b #:optional c #:rest r) a)
7976 guile> (arity baz)
7977 2 required arguments: `a' and `b', 1 optional argument: `c',
7978 the rest in `r'.
7979
7980 * Changes to the C interface
7981
7982 ** Types have been renamed from scm_*_t to scm_t_*.
7983
7984 This has been done for POSIX sake. It reserves identifiers ending
7985 with "_t". What a concept.
7986
7987 The old names are still available with status `deprecated'.
7988
7989 ** scm_t_bits (former scm_bits_t) is now a unsigned type.
7990
7991 ** Deprecated features have been removed.
7992
7993 *** Macros removed
7994
7995 SCM_INPORTP, SCM_OUTPORTP SCM_ICHRP, SCM_ICHR, SCM_MAKICHR
7996 SCM_SETJMPBUF SCM_NSTRINGP SCM_NRWSTRINGP SCM_NVECTORP SCM_DOUBLE_CELLP
7997
7998 *** C Functions removed
7999
8000 scm_sysmissing scm_tag scm_tc16_flo scm_tc_flo
8001 scm_fseek - replaced by scm_seek.
8002 gc-thunk - replaced by after-gc-hook.
8003 gh_int2scmb - replaced by gh_bool2scm.
8004 scm_tc_dblr - replaced by scm_tc16_real.
8005 scm_tc_dblc - replaced by scm_tc16_complex.
8006 scm_list_star - replaced by scm_cons_star.
8007
8008 ** Deprecated: scm_makfromstr
8009
8010 Use scm_mem2string instead.
8011
8012 ** Deprecated: scm_make_shared_substring
8013
8014 Explicit shared substrings will disappear from Guile.
8015
8016 Instead, "normal" strings will be implemented using sharing
8017 internally, combined with a copy-on-write strategy.
8018
8019 ** Deprecated: scm_read_only_string_p
8020
8021 The concept of read-only strings will disappear in next release of
8022 Guile.
8023
8024 ** Deprecated: scm_sloppy_memq, scm_sloppy_memv, scm_sloppy_member
8025
8026 Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
8027
8028 ** New functions: scm_call_0, scm_call_1, scm_call_2, scm_call_3
8029
8030 Call a procedure with the indicated number of arguments. See "Fly
8031 Evaluation" in the manual.
8032
8033 ** New functions: scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3
8034
8035 Call a procedure with the indicated number of arguments and a list of
8036 further arguments. See "Fly Evaluation" in the manual.
8037
8038 ** New functions: scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5
8039
8040 Create a list of the given number of elements. See "List
8041 Constructors" in the manual.
8042
8043 ** Renamed function: scm_listify has been replaced by scm_list_n.
8044
8045 ** Deprecated macros: SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4,
8046 SCM_LIST5, SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9.
8047
8048 Use functions scm_list_N instead.
8049
8050 ** New function: scm_c_read (SCM port, void *buffer, scm_sizet size)
8051
8052 Used by an application to read arbitrary number of bytes from a port.
8053 Same semantics as libc read, except that scm_c_read only returns less
8054 than SIZE bytes if at end-of-file.
8055
8056 Warning: Doesn't update port line and column counts!
8057
8058 ** New function: scm_c_write (SCM port, const void *ptr, scm_sizet size)
8059
8060 Used by an application to write arbitrary number of bytes to an SCM
8061 port. Similar semantics as libc write. However, unlike libc
8062 write, scm_c_write writes the requested number of bytes and has no
8063 return value.
8064
8065 Warning: Doesn't update port line and column counts!
8066
8067 ** New function: scm_init_guile ()
8068
8069 In contrast to scm_boot_guile, scm_init_guile will return normally
8070 after initializing Guile. It is not available on all systems, tho.
8071
8072 ** New functions: scm_str2symbol, scm_mem2symbol
8073
8074 The function scm_str2symbol takes a const char* pointing to a zero-terminated
8075 field of characters and creates a scheme symbol object from that C string.
8076 The function scm_mem2symbol takes a const char* and a number of characters and
8077 creates a symbol from the characters in that memory area.
8078
8079 ** New functions: scm_primitive_make_property
8080 scm_primitive_property_ref
8081 scm_primitive_property_set_x
8082 scm_primitive_property_del_x
8083
8084 These functions implement a new way to deal with object properties.
8085 See libguile/properties.c for their documentation.
8086
8087 ** New function: scm_done_free (long size)
8088
8089 This function is the inverse of scm_done_malloc. Use it to report the
8090 amount of smob memory you free. The previous method, which involved
8091 calling scm_done_malloc with negative argument, was somewhat
8092 unintuitive (and is still available, of course).
8093
8094 ** New function: scm_c_memq (SCM obj, SCM list)
8095
8096 This function provides a fast C level alternative for scm_memq for the case
8097 that the list parameter is known to be a proper list. The function is a
8098 replacement for scm_sloppy_memq, but is stricter in its requirements on its
8099 list input parameter, since for anything else but a proper list the function's
8100 behaviour is undefined - it may even crash or loop endlessly. Further, for
8101 the case that the object is not found in the list, scm_c_memq returns #f which
8102 is similar to scm_memq, but different from scm_sloppy_memq's behaviour.
8103
8104 ** New functions: scm_remember_upto_here_1, scm_remember_upto_here_2,
8105 scm_remember_upto_here
8106
8107 These functions replace the function scm_remember.
8108
8109 ** Deprecated function: scm_remember
8110
8111 Use one of the new functions scm_remember_upto_here_1,
8112 scm_remember_upto_here_2 or scm_remember_upto_here instead.
8113
8114 ** New function: scm_allocate_string
8115
8116 This function replaces the function scm_makstr.
8117
8118 ** Deprecated function: scm_makstr
8119
8120 Use the new function scm_allocate_string instead.
8121
8122 ** New global variable scm_gc_running_p introduced.
8123
8124 Use this variable to find out if garbage collection is being executed. Up to
8125 now applications have used scm_gc_heap_lock to test if garbage collection was
8126 running, which also works because of the fact that up to know only the garbage
8127 collector has set this variable. But, this is an implementation detail that
8128 may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use
8129 of this variable is (and has been) not fully safe anyway.
8130
8131 ** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH
8132
8133 Use these instead of SCM_LENGTH_MAX.
8134
8135 ** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH,
8136 SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH,
8137 SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH.
8138
8139 Use these instead of SCM_LENGTH.
8140
8141 ** New macros: SCM_SET_CONTINUATION_LENGTH, SCM_SET_STRING_LENGTH,
8142 SCM_SET_SYMBOL_LENGTH, SCM_SET_VECTOR_LENGTH, SCM_SET_UVECTOR_LENGTH,
8143 SCM_SET_BITVECTOR_LENGTH
8144
8145 Use these instead of SCM_SETLENGTH
8146
8147 ** New macros: SCM_STRING_CHARS, SCM_SYMBOL_CHARS, SCM_CCLO_BASE,
8148 SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM,
8149 SCM_ARRAY_MEM
8150
8151 Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or
8152 SCM_VELTS.
8153
8154 ** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS,
8155 SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE,
8156 SCM_SET_VECTOR_BASE
8157
8158 Use these instead of SCM_SETCHARS.
8159
8160 ** New macro: SCM_BITVECTOR_P
8161
8162 ** New macro: SCM_STRING_COERCE_0TERMINATION_X
8163
8164 Use instead of SCM_COERCE_SUBSTR.
8165
8166 ** New macros: SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN
8167
8168 For directory objects, use these instead of SCM_OPDIRP and SCM_OPN.
8169
8170 ** Deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL,
8171 SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL,
8172 SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD,
8173 SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SYMBOL_SLOTS, SCM_SLOTS, SCM_SLOPPY_STRINGP,
8174 SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
8175 SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
8176 SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
8177 SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
8178 SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
8179 SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP,
8180 SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC,
8181 SCM_OPDIRP, SCM_VALIDATE_OPDIR, SCM_WTA, RETURN_SCM_WTA, SCM_CONST_LONG,
8182 SCM_WNA, SCM_FUNC_NAME, SCM_VALIDATE_NUMBER_COPY,
8183 SCM_VALIDATE_NUMBER_DEF_COPY, SCM_SLOPPY_CONSP, SCM_SLOPPY_NCONSP,
8184 SCM_SETAND_CDR, SCM_SETOR_CDR, SCM_SETAND_CAR, SCM_SETOR_CAR
8185
8186 Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
8187 Use scm_memory_error instead of SCM_NALLOC.
8188 Use SCM_STRINGP instead of SCM_SLOPPY_STRINGP.
8189 Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_STRINGORSUBSTR.
8190 Use SCM_FREE_CELL_P instead of SCM_FREEP/SCM_NFREEP
8191 Use a type specific accessor macro instead of SCM_CHARS/SCM_UCHARS.
8192 Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH.
8193 Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING.
8194 Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
8195 Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
8196 Use SCM_STRINGP instead of SCM_RWSTRINGP.
8197 Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
8198 Use SCM_STRING_CHARS instead of SCM_ROCHARS.
8199 Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
8200 Use a type specific setter macro instead of SCM_SETLENGTH.
8201 Use a type specific setter macro instead of SCM_SETCHARS.
8202 Use a type specific length macro instead of SCM_LENGTH_MAX.
8203 Use SCM_GCMARKP instead of SCM_GC8MARKP.
8204 Use SCM_SETGCMARK instead of SCM_SETGC8MARK.
8205 Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK.
8206 Use SCM_TYP16 instead of SCM_GCTYP16.
8207 Use SCM_CDR instead of SCM_GCCDR.
8208 Use SCM_DIR_OPEN_P instead of SCM_OPDIRP.
8209 Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of SCM_WTA.
8210 Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of RETURN_SCM_WTA.
8211 Use SCM_VCELL_INIT instead of SCM_CONST_LONG.
8212 Use SCM_WRONG_NUM_ARGS instead of SCM_WNA.
8213 Use SCM_CONSP instead of SCM_SLOPPY_CONSP.
8214 Use !SCM_CONSP instead of SCM_SLOPPY_NCONSP.
8215
8216 ** Removed function: scm_struct_init
8217
8218 ** Removed variable: scm_symhash_dim
8219
8220 ** Renamed function: scm_make_cont has been replaced by
8221 scm_make_continuation, which has a different interface.
8222
8223 ** Deprecated function: scm_call_catching_errors
8224
8225 Use scm_catch or scm_lazy_catch from throw.[ch] instead.
8226
8227 ** Deprecated function: scm_strhash
8228
8229 Use scm_string_hash instead.
8230
8231 ** Deprecated function: scm_vector_set_length_x
8232
8233 Instead, create a fresh vector of the desired size and copy the contents.
8234
8235 ** scm_gensym has changed prototype
8236
8237 scm_gensym now only takes one argument.
8238
8239 ** Deprecated type tags: scm_tc7_ssymbol, scm_tc7_msymbol, scm_tcs_symbols,
8240 scm_tc7_lvector
8241
8242 There is now only a single symbol type scm_tc7_symbol.
8243 The tag scm_tc7_lvector was not used anyway.
8244
8245 ** Deprecated function: scm_make_smob_type_mfpe, scm_set_smob_mfpe.
8246
8247 Use scm_make_smob_type and scm_set_smob_XXX instead.
8248
8249 ** New function scm_set_smob_apply.
8250
8251 This can be used to set an apply function to a smob type.
8252
8253 ** Deprecated function: scm_strprint_obj
8254
8255 Use scm_object_to_string instead.
8256
8257 ** Deprecated function: scm_wta
8258
8259 Use scm_wrong_type_arg, or another appropriate error signalling function
8260 instead.
8261
8262 ** Explicit support for obarrays has been deprecated.
8263
8264 Use `scm_str2symbol' and the generic hashtable functions instead.
8265
8266 ** The concept of `vcells' has been deprecated.
8267
8268 The data type `variable' is now used exclusively. `Vcells' have been
8269 a low-level concept so you are likely not affected by this change.
8270
8271 *** Deprecated functions: scm_sym2vcell, scm_sysintern,
8272 scm_sysintern0, scm_symbol_value0, scm_intern, scm_intern0.
8273
8274 Use scm_c_define or scm_c_lookup instead, as appropriate.
8275
8276 *** New functions: scm_c_module_lookup, scm_c_lookup,
8277 scm_c_module_define, scm_c_define, scm_module_lookup, scm_lookup,
8278 scm_module_define, scm_define.
8279
8280 These functions work with variables instead of with vcells.
8281
8282 ** New functions for creating and defining `subr's and `gsubr's.
8283
8284 The new functions more clearly distinguish between creating a subr (or
8285 gsubr) object and adding it to the current module.
8286
8287 These new functions are available: scm_c_make_subr, scm_c_define_subr,
8288 scm_c_make_subr_with_generic, scm_c_define_subr_with_generic,
8289 scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
8290 scm_c_define_gsubr_with_generic.
8291
8292 ** Deprecated functions: scm_make_subr, scm_make_subr_opt,
8293 scm_make_subr_with_generic, scm_make_gsubr,
8294 scm_make_gsubr_with_generic.
8295
8296 Use the new ones from above instead.
8297
8298 ** C interface to the module system has changed.
8299
8300 While we suggest that you avoid as many explicit module system
8301 operations from C as possible for the time being, the C interface has
8302 been made more similar to the high-level Scheme module system.
8303
8304 *** New functions: scm_c_define_module, scm_c_use_module,
8305 scm_c_export, scm_c_resolve_module.
8306
8307 They mostly work like their Scheme namesakes. scm_c_define_module
8308 takes a function that is called a context where the new module is
8309 current.
8310
8311 *** Deprecated functions: scm_the_root_module, scm_make_module,
8312 scm_ensure_user_module, scm_load_scheme_module.
8313
8314 Use the new functions instead.
8315
8316 ** Renamed function: scm_internal_with_fluids becomes
8317 scm_c_with_fluids.
8318
8319 scm_internal_with_fluids is available as a deprecated function.
8320
8321 ** New function: scm_c_with_fluid.
8322
8323 Just like scm_c_with_fluids, but takes one fluid and one value instead
8324 of lists of same.
8325
8326 ** Deprecated typedefs: long_long, ulong_long.
8327
8328 They are of questionable utility and they pollute the global
8329 namespace.
8330
8331 ** Deprecated typedef: scm_sizet
8332
8333 It is of questionable utility now that Guile requires ANSI C, and is
8334 oddly named.
8335
8336 ** Deprecated typedefs: scm_port_rw_active, scm_port,
8337 scm_ptob_descriptor, scm_debug_info, scm_debug_frame, scm_fport,
8338 scm_option, scm_rstate, scm_rng, scm_array, scm_array_dim.
8339
8340 Made more compliant with the naming policy by adding a _t at the end.
8341
8342 ** Deprecated functions: scm_mkbig, scm_big2num, scm_adjbig,
8343 scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl
8344
8345 With the exception of the mysterious scm_2ulong2big, they are still
8346 available under new names (scm_i_mkbig etc). These functions are not
8347 intended to be used in user code. You should avoid dealing with
8348 bignums directly, and should deal with numbers in general (which can
8349 be bignums).
8350
8351 ** Change in behavior: scm_num2long, scm_num2ulong
8352
8353 The scm_num2[u]long functions don't any longer accept an inexact
8354 argument. This change in behavior is motivated by concordance with
8355 R5RS: It is more common that a primitive doesn't want to accept an
8356 inexact for an exact.
8357
8358 ** New functions: scm_short2num, scm_ushort2num, scm_int2num,
8359 scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
8360 scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff,
8361 scm_num2size.
8362
8363 These are conversion functions between the various ANSI C integral
8364 types and Scheme numbers. NOTE: The scm_num2xxx functions don't
8365 accept an inexact argument.
8366
8367 ** New functions: scm_float2num, scm_double2num,
8368 scm_num2float, scm_num2double.
8369
8370 These are conversion functions between the two ANSI C float types and
8371 Scheme numbers.
8372
8373 ** New number validation macros:
8374 SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF]
8375
8376 See above.
8377
8378 ** New functions: scm_gc_protect_object, scm_gc_unprotect_object
8379
8380 These are just nicer-named old scm_protect_object and
8381 scm_unprotect_object.
8382
8383 ** Deprecated functions: scm_protect_object, scm_unprotect_object
8384
8385 ** New functions: scm_gc_[un]register_root, scm_gc_[un]register_roots
8386
8387 These functions can be used to register pointers to locations that
8388 hold SCM values.
8389
8390 ** Deprecated function: scm_create_hook.
8391
8392 Its sins are: misleading name, non-modularity and lack of general
8393 usefulness.
8394
8395
8396 Changes since Guile 1.3.4:
8397
8398 * Changes to the distribution
8399
8400 ** Trees from nightly snapshots and CVS now require you to run autogen.sh.
8401
8402 We've changed the way we handle generated files in the Guile source
8403 repository. As a result, the procedure for building trees obtained
8404 from the nightly FTP snapshots or via CVS has changed:
8405 - You must have appropriate versions of autoconf, automake, and
8406 libtool installed on your system. See README for info on how to
8407 obtain these programs.
8408 - Before configuring the tree, you must first run the script
8409 `autogen.sh' at the top of the source tree.
8410
8411 The Guile repository used to contain not only source files, written by
8412 humans, but also some generated files, like configure scripts and
8413 Makefile.in files. Even though the contents of these files could be
8414 derived mechanically from other files present, we thought it would
8415 make the tree easier to build if we checked them into CVS.
8416
8417 However, this approach means that minor differences between
8418 developer's installed tools and habits affected the whole team.
8419 So we have removed the generated files from the repository, and
8420 added the autogen.sh script, which will reconstruct them
8421 appropriately.
8422
8423
8424 ** configure now has experimental options to remove support for certain
8425 features:
8426
8427 --disable-arrays omit array and uniform array support
8428 --disable-posix omit posix interfaces
8429 --disable-networking omit networking interfaces
8430 --disable-regex omit regular expression interfaces
8431
8432 These are likely to become separate modules some day.
8433
8434 ** New configure option --enable-debug-freelist
8435
8436 This enables a debugging version of SCM_NEWCELL(), and also registers
8437 an extra primitive, the setter `gc-set-debug-check-freelist!'.
8438
8439 Configure with the --enable-debug-freelist option to enable
8440 the gc-set-debug-check-freelist! primitive, and then use:
8441
8442 (gc-set-debug-check-freelist! #t) # turn on checking of the freelist
8443 (gc-set-debug-check-freelist! #f) # turn off checking
8444
8445 Checking of the freelist forces a traversal of the freelist and
8446 a garbage collection before each allocation of a cell. This can
8447 slow down the interpreter dramatically, so the setter should be used to
8448 turn on this extra processing only when necessary.
8449
8450 ** New configure option --enable-debug-malloc
8451
8452 Include code for debugging of calls to scm_must_malloc/realloc/free.
8453
8454 Checks that
8455
8456 1. objects freed by scm_must_free has been mallocated by scm_must_malloc
8457 2. objects reallocated by scm_must_realloc has been allocated by
8458 scm_must_malloc
8459 3. reallocated objects are reallocated with the same what string
8460
8461 But, most importantly, it records the number of allocated objects of
8462 each kind. This is useful when searching for memory leaks.
8463
8464 A Guile compiled with this option provides the primitive
8465 `malloc-stats' which returns an alist with pairs of kind and the
8466 number of objects of that kind.
8467
8468 ** All includes are now referenced relative to the root directory
8469
8470 Since some users have had problems with mixups between Guile and
8471 system headers, we have decided to always refer to Guile headers via
8472 their parent directories. This essentially creates a "private name
8473 space" for Guile headers. This means that the compiler only is given
8474 -I options for the root build and root source directory.
8475
8476 ** Header files kw.h and genio.h have been removed.
8477
8478 ** The module (ice-9 getopt-gnu-style) has been removed.
8479
8480 ** New module (ice-9 documentation)
8481
8482 Implements the interface to documentation strings associated with
8483 objects.
8484
8485 ** New module (ice-9 time)
8486
8487 Provides a macro `time', which displays execution time of a given form.
8488
8489 ** New module (ice-9 history)
8490
8491 Loading this module enables value history in the repl.
8492
8493 * Changes to the stand-alone interpreter
8494
8495 ** New command line option --debug
8496
8497 Start Guile with debugging evaluator and backtraces enabled.
8498
8499 This is useful when debugging your .guile init file or scripts.
8500
8501 ** New help facility
8502
8503 Usage: (help NAME) gives documentation about objects named NAME (a symbol)
8504 (help REGEXP) ditto for objects with names matching REGEXP (a string)
8505 (help 'NAME) gives documentation for NAME, even if it is not an object
8506 (help ,EXPR) gives documentation for object returned by EXPR
8507 (help (my module)) gives module commentary for `(my module)'
8508 (help) gives this text
8509
8510 `help' searches among bindings exported from loaded modules, while
8511 `apropos' searches among bindings visible from the "current" module.
8512
8513 Examples: (help help)
8514 (help cons)
8515 (help "output-string")
8516
8517 ** `help' and `apropos' now prints full module names
8518
8519 ** Dynamic linking now uses libltdl from the libtool package.
8520
8521 The old system dependent code for doing dynamic linking has been
8522 replaced with calls to the libltdl functions which do all the hairy
8523 details for us.
8524
8525 The major improvement is that you can now directly pass libtool
8526 library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
8527 will be able to do the best shared library job you can get, via
8528 libltdl.
8529
8530 The way dynamic libraries are found has changed and is not really
8531 portable across platforms, probably. It is therefore recommended to
8532 use absolute filenames when possible.
8533
8534 If you pass a filename without an extension to `dynamic-link', it will
8535 try a few appropriate ones. Thus, the most platform ignorant way is
8536 to specify a name like "libfoo", without any directories and
8537 extensions.
8538
8539 ** Guile COOP threads are now compatible with LinuxThreads
8540
8541 Previously, COOP threading wasn't possible in applications linked with
8542 Linux POSIX threads due to their use of the stack pointer to find the
8543 thread context. This has now been fixed with a workaround which uses
8544 the pthreads to allocate the stack.
8545
8546 ** New primitives: `pkgdata-dir', `site-dir', `library-dir'
8547
8548 ** Positions of erring expression in scripts
8549
8550 With version 1.3.4, the location of the erring expression in Guile
8551 scipts is no longer automatically reported. (This should have been
8552 documented before the 1.3.4 release.)
8553
8554 You can get this information by enabling recording of positions of
8555 source expressions and running the debugging evaluator. Put this at
8556 the top of your script (or in your "site" file):
8557
8558 (read-enable 'positions)
8559 (debug-enable 'debug)
8560
8561 ** Backtraces in scripts
8562
8563 It is now possible to get backtraces in scripts.
8564
8565 Put
8566
8567 (debug-enable 'debug 'backtrace)
8568
8569 at the top of the script.
8570
8571 (The first options enables the debugging evaluator.
8572 The second enables backtraces.)
8573
8574 ** Part of module system symbol lookup now implemented in C
8575
8576 The eval closure of most modules is now implemented in C. Since this
8577 was one of the bottlenecks for loading speed, Guile now loads code
8578 substantially faster than before.
8579
8580 ** Attempting to get the value of an unbound variable now produces
8581 an exception with a key of 'unbound-variable instead of 'misc-error.
8582
8583 ** The initial default output port is now unbuffered if it's using a
8584 tty device. Previously in this situation it was line-buffered.
8585
8586 ** New hook: after-gc-hook
8587
8588 after-gc-hook takes over the role of gc-thunk. This hook is run at
8589 the first SCM_TICK after a GC. (Thus, the code is run at the same
8590 point during evaluation as signal handlers.)
8591
8592 Note that this hook should be used only for diagnostic and debugging
8593 purposes. It is not certain that it will continue to be well-defined
8594 when this hook is run in the future.
8595
8596 C programmers: Note the new C level hooks scm_before_gc_c_hook,
8597 scm_before_sweep_c_hook, scm_after_gc_c_hook.
8598
8599 ** Improvements to garbage collector
8600
8601 Guile 1.4 has a new policy for triggering heap allocation and
8602 determining the sizes of heap segments. It fixes a number of problems
8603 in the old GC.
8604
8605 1. The new policy can handle two separate pools of cells
8606 (2-word/4-word) better. (The old policy would run wild, allocating
8607 more and more memory for certain programs.)
8608
8609 2. The old code would sometimes allocate far too much heap so that the
8610 Guile process became gigantic. The new code avoids this.
8611
8612 3. The old code would sometimes allocate too little so that few cells
8613 were freed at GC so that, in turn, too much time was spent in GC.
8614
8615 4. The old code would often trigger heap allocation several times in a
8616 row. (The new scheme predicts how large the segments needs to be
8617 in order not to need further allocation.)
8618
8619 All in all, the new GC policy will make larger applications more
8620 efficient.
8621
8622 The new GC scheme also is prepared for POSIX threading. Threads can
8623 allocate private pools of cells ("clusters") with just a single
8624 function call. Allocation of single cells from such a cluster can
8625 then proceed without any need of inter-thread synchronization.
8626
8627 ** New environment variables controlling GC parameters
8628
8629 GUILE_MAX_SEGMENT_SIZE Maximal segment size
8630 (default = 2097000)
8631
8632 Allocation of 2-word cell heaps:
8633
8634 GUILE_INIT_SEGMENT_SIZE_1 Size of initial heap segment in bytes
8635 (default = 360000)
8636
8637 GUILE_MIN_YIELD_1 Minimum number of freed cells at each
8638 GC in percent of total heap size
8639 (default = 40)
8640
8641 Allocation of 4-word cell heaps
8642 (used for real numbers and misc other objects):
8643
8644 GUILE_INIT_SEGMENT_SIZE_2, GUILE_MIN_YIELD_2
8645
8646 (See entry "Way for application to customize GC parameters" under
8647 section "Changes to the scm_ interface" below.)
8648
8649 ** Guile now implements reals using 4-word cells
8650
8651 This speeds up computation with reals. (They were earlier allocated
8652 with `malloc'.) There is still some room for optimizations, however.
8653
8654 ** Some further steps toward POSIX thread support have been taken
8655
8656 *** Guile's critical sections (SCM_DEFER/ALLOW_INTS)
8657 don't have much effect any longer, and many of them will be removed in
8658 next release.
8659
8660 *** Signals
8661 are only handled at the top of the evaluator loop, immediately after
8662 I/O, and in scm_equalp.
8663
8664 *** The GC can allocate thread private pools of pairs.
8665
8666 * Changes to Scheme functions and syntax
8667
8668 ** close-input-port and close-output-port are now R5RS
8669
8670 These procedures have been turned into primitives and have R5RS behaviour.
8671
8672 ** New procedure: simple-format PORT MESSAGE ARG1 ...
8673
8674 (ice-9 boot) makes `format' an alias for `simple-format' until possibly
8675 extended by the more sophisticated version in (ice-9 format)
8676
8677 (simple-format port message . args)
8678 Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
8679 MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
8680 the escapes are replaced with corresponding members of ARGS:
8681 ~A formats using `display' and ~S formats using `write'.
8682 If DESTINATION is #t, then use the `current-output-port',
8683 if DESTINATION is #f, then return a string containing the formatted text.
8684 Does not add a trailing newline."
8685
8686 ** string-ref: the second argument is no longer optional.
8687
8688 ** string, list->string: no longer accept strings in their arguments,
8689 only characters, for compatibility with R5RS.
8690
8691 ** New procedure: port-closed? PORT
8692 Returns #t if PORT is closed or #f if it is open.
8693
8694 ** Deprecated: list*
8695
8696 The list* functionality is now provided by cons* (SRFI-1 compliant)
8697
8698 ** New procedure: cons* ARG1 ARG2 ... ARGn
8699
8700 Like `list', but the last arg provides the tail of the constructed list,
8701 returning (cons ARG1 (cons ARG2 (cons ... ARGn))).
8702
8703 Requires at least one argument. If given one argument, that argument
8704 is returned as result.
8705
8706 This function is called `list*' in some other Schemes and in Common LISP.
8707
8708 ** Removed deprecated: serial-map, serial-array-copy!, serial-array-map!
8709
8710 ** New procedure: object-documentation OBJECT
8711
8712 Returns the documentation string associated with OBJECT. The
8713 procedure uses a caching mechanism so that subsequent lookups are
8714 faster.
8715
8716 Exported by (ice-9 documentation).
8717
8718 ** module-name now returns full names of modules
8719
8720 Previously, only the last part of the name was returned (`session' for
8721 `(ice-9 session)'). Ex: `(ice-9 session)'.
8722
8723 * Changes to the gh_ interface
8724
8725 ** Deprecated: gh_int2scmb
8726
8727 Use gh_bool2scm instead.
8728
8729 * Changes to the scm_ interface
8730
8731 ** Guile primitives now carry docstrings!
8732
8733 Thanks to Greg Badros!
8734
8735 ** Guile primitives are defined in a new way: SCM_DEFINE/SCM_DEFINE1/SCM_PROC
8736
8737 Now Guile primitives are defined using the SCM_DEFINE/SCM_DEFINE1/SCM_PROC
8738 macros and must contain a docstring that is extracted into foo.doc using a new
8739 guile-doc-snarf script (that uses guile-doc-snarf.awk).
8740
8741 However, a major overhaul of these macros is scheduled for the next release of
8742 guile.
8743
8744 ** Guile primitives use a new technique for validation of arguments
8745
8746 SCM_VALIDATE_* macros are defined to ease the redundancy and improve
8747 the readability of argument checking.
8748
8749 ** All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
8750
8751 ** New macros: SCM_PACK, SCM_UNPACK
8752
8753 Compose/decompose an SCM value.
8754
8755 The SCM type is now treated as an abstract data type and may be defined as a
8756 long, a void* or as a struct, depending on the architecture and compile time
8757 options. This makes it easier to find several types of bugs, for example when
8758 SCM values are treated as integers without conversion. Values of the SCM type
8759 should be treated as "atomic" values. These macros are used when
8760 composing/decomposing an SCM value, either because you want to access
8761 individual bits, or because you want to treat it as an integer value.
8762
8763 E.g., in order to set bit 7 in an SCM value x, use the expression
8764
8765 SCM_PACK (SCM_UNPACK (x) | 0x80)
8766
8767 ** The name property of hooks is deprecated.
8768 Thus, the use of SCM_HOOK_NAME and scm_make_hook_with_name is deprecated.
8769
8770 You can emulate this feature by using object properties.
8771
8772 ** Deprecated macros: SCM_INPORTP, SCM_OUTPORTP, SCM_CRDY, SCM_ICHRP,
8773 SCM_ICHR, SCM_MAKICHR, SCM_SETJMPBUF, SCM_NSTRINGP, SCM_NRWSTRINGP,
8774 SCM_NVECTORP
8775
8776 These macros will be removed in a future release of Guile.
8777
8778 ** The following types, functions and macros from numbers.h are deprecated:
8779 scm_dblproc, SCM_UNEGFIXABLE, SCM_FLOBUFLEN, SCM_INEXP, SCM_CPLXP, SCM_REAL,
8780 SCM_IMAG, SCM_REALPART, scm_makdbl, SCM_SINGP, SCM_NUM2DBL, SCM_NO_BIGDIG
8781
8782 ** Port internals: the rw_random variable in the scm_port structure
8783 must be set to non-zero in any random access port. In recent Guile
8784 releases it was only set for bidirectional random-access ports.
8785
8786 ** Port internals: the seek ptob procedure is now responsible for
8787 resetting the buffers if required. The change was made so that in the
8788 special case of reading the current position (i.e., seek p 0 SEEK_CUR)
8789 the fport and strport ptobs can avoid resetting the buffers,
8790 in particular to avoid discarding unread chars. An existing port
8791 type can be fixed by adding something like the following to the
8792 beginning of the ptob seek procedure:
8793
8794 if (pt->rw_active == SCM_PORT_READ)
8795 scm_end_input (object);
8796 else if (pt->rw_active == SCM_PORT_WRITE)
8797 ptob->flush (object);
8798
8799 although to actually avoid resetting the buffers and discard unread
8800 chars requires further hacking that depends on the characteristics
8801 of the ptob.
8802
8803 ** Deprecated functions: scm_fseek, scm_tag
8804
8805 These functions are no longer used and will be removed in a future version.
8806
8807 ** The scm_sysmissing procedure is no longer used in libguile.
8808 Unless it turns out to be unexpectedly useful to somebody, it will be
8809 removed in a future version.
8810
8811 ** The format of error message strings has changed
8812
8813 The two C procedures: scm_display_error and scm_error, as well as the
8814 primitive `scm-error', now use scm_simple_format to do their work.
8815 This means that the message strings of all code must be updated to use
8816 ~A where %s was used before, and ~S where %S was used before.
8817
8818 During the period when there still are a lot of old Guiles out there,
8819 you might want to support both old and new versions of Guile.
8820
8821 There are basically two methods to achieve this. Both methods use
8822 autoconf. Put
8823
8824 AC_CHECK_FUNCS(scm_simple_format)
8825
8826 in your configure.in.
8827
8828 Method 1: Use the string concatenation features of ANSI C's
8829 preprocessor.
8830
8831 In C:
8832
8833 #ifdef HAVE_SCM_SIMPLE_FORMAT
8834 #define FMT_S "~S"
8835 #else
8836 #define FMT_S "%S"
8837 #endif
8838
8839 Then represent each of your error messages using a preprocessor macro:
8840
8841 #define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!"
8842
8843 In Scheme:
8844
8845 (define fmt-s (if (defined? 'simple-format) "~S" "%S"))
8846 (define make-message string-append)
8847
8848 (define e-spider-error (make-message "There's a spider in your " fmt-s "!!!"))
8849
8850 Method 2: Use the oldfmt function found in doc/oldfmt.c.
8851
8852 In C:
8853
8854 scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"),
8855 ...);
8856
8857 In Scheme:
8858
8859 (scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!")
8860 ...)
8861
8862
8863 ** Deprecated: coop_mutex_init, coop_condition_variable_init
8864
8865 Don't use the functions coop_mutex_init and
8866 coop_condition_variable_init. They will change.
8867
8868 Use scm_mutex_init and scm_cond_init instead.
8869
8870 ** New function: int scm_cond_timedwait (scm_cond_t *COND, scm_mutex_t *MUTEX, const struct timespec *ABSTIME)
8871 `scm_cond_timedwait' atomically unlocks MUTEX and waits on
8872 COND, as `scm_cond_wait' does, but it also bounds the duration
8873 of the wait. If COND has not been signaled before time ABSTIME,
8874 the mutex MUTEX is re-acquired and `scm_cond_timedwait'
8875 returns the error code `ETIMEDOUT'.
8876
8877 The ABSTIME parameter specifies an absolute time, with the same
8878 origin as `time' and `gettimeofday': an ABSTIME of 0 corresponds
8879 to 00:00:00 GMT, January 1, 1970.
8880
8881 ** New function: scm_cond_broadcast (scm_cond_t *COND)
8882 `scm_cond_broadcast' restarts all the threads that are waiting
8883 on the condition variable COND. Nothing happens if no threads are
8884 waiting on COND.
8885
8886 ** New function: scm_key_create (scm_key_t *KEY, void (*destr_function) (void *))
8887 `scm_key_create' allocates a new TSD key. The key is stored in
8888 the location pointed to by KEY. There is no limit on the number
8889 of keys allocated at a given time. The value initially associated
8890 with the returned key is `NULL' in all currently executing threads.
8891
8892 The DESTR_FUNCTION argument, if not `NULL', specifies a destructor
8893 function associated with the key. When a thread terminates,
8894 DESTR_FUNCTION is called on the value associated with the key in
8895 that thread. The DESTR_FUNCTION is not called if a key is deleted
8896 with `scm_key_delete' or a value is changed with
8897 `scm_setspecific'. The order in which destructor functions are
8898 called at thread termination time is unspecified.
8899
8900 Destructors are not yet implemented.
8901
8902 ** New function: scm_setspecific (scm_key_t KEY, const void *POINTER)
8903 `scm_setspecific' changes the value associated with KEY in the
8904 calling thread, storing the given POINTER instead.
8905
8906 ** New function: scm_getspecific (scm_key_t KEY)
8907 `scm_getspecific' returns the value currently associated with
8908 KEY in the calling thread.
8909
8910 ** New function: scm_key_delete (scm_key_t KEY)
8911 `scm_key_delete' deallocates a TSD key. It does not check
8912 whether non-`NULL' values are associated with that key in the
8913 currently executing threads, nor call the destructor function
8914 associated with the key.
8915
8916 ** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE)
8917
8918 Initialize a C level hook HOOK with associated HOOK_DATA and type
8919 TYPE. (See scm_c_hook_run ().)
8920
8921 ** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP)
8922
8923 Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP
8924 is true, add it last, otherwise first. The same FUNC can be added
8925 multiple times if FUNC_DATA differ and vice versa.
8926
8927 ** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA)
8928
8929 Remove hook function FUNC with associated FUNC_DATA from HOOK. A
8930 function is only removed if both FUNC and FUNC_DATA matches.
8931
8932 ** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA)
8933
8934 Run hook HOOK passing DATA to the hook functions.
8935
8936 If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value
8937 returned is undefined.
8938
8939 If TYPE is SCM_C_HOOK_OR, hook functions are run until a function
8940 returns a non-NULL value. This value is returned as the result of
8941 scm_c_hook_run. If all functions return NULL, NULL is returned.
8942
8943 If TYPE is SCM_C_HOOK_AND, hook functions are run until a function
8944 returns a NULL value, and NULL is returned. If all functions returns
8945 a non-NULL value, the last value is returned.
8946
8947 ** New C level GC hooks
8948
8949 Five new C level hooks has been added to the garbage collector.
8950
8951 scm_before_gc_c_hook
8952 scm_after_gc_c_hook
8953
8954 are run before locking and after unlocking the heap. The system is
8955 thus in a mode where evaluation can take place. (Except that
8956 scm_before_gc_c_hook must not allocate new cells.)
8957
8958 scm_before_mark_c_hook
8959 scm_before_sweep_c_hook
8960 scm_after_sweep_c_hook
8961
8962 are run when the heap is locked. These are intended for extension of
8963 the GC in a modular fashion. Examples are the weaks and guardians
8964 modules.
8965
8966 ** Way for application to customize GC parameters
8967
8968 The application can set up other default values for the GC heap
8969 allocation parameters
8970
8971 GUILE_INIT_HEAP_SIZE_1, GUILE_MIN_YIELD_1,
8972 GUILE_INIT_HEAP_SIZE_2, GUILE_MIN_YIELD_2,
8973 GUILE_MAX_SEGMENT_SIZE,
8974
8975 by setting
8976
8977 scm_default_init_heap_size_1, scm_default_min_yield_1,
8978 scm_default_init_heap_size_2, scm_default_min_yield_2,
8979 scm_default_max_segment_size
8980
8981 respectively before callong scm_boot_guile.
8982
8983 (See entry "New environment variables ..." in section
8984 "Changes to the stand-alone interpreter" above.)
8985
8986 ** scm_protect_object/scm_unprotect_object now nest
8987
8988 This means that you can call scm_protect_object multiple times on an
8989 object and count on the object being protected until
8990 scm_unprotect_object has been call the same number of times.
8991
8992 The functions also have better time complexity.
8993
8994 Still, it is usually possible to structure the application in a way
8995 that you don't need to use these functions. For example, if you use a
8996 protected standard Guile list to keep track of live objects rather
8997 than some custom data type, objects will die a natural death when they
8998 are no longer needed.
8999
9000 ** Deprecated type tags: scm_tc16_flo, scm_tc_flo, scm_tc_dblr, scm_tc_dblc
9001
9002 Guile does not provide the float representation for inexact real numbers any
9003 more. Now, only doubles are used to represent inexact real numbers. Further,
9004 the tag names scm_tc_dblr and scm_tc_dblc have been changed to scm_tc16_real
9005 and scm_tc16_complex, respectively.
9006
9007 ** Removed deprecated type scm_smobfuns
9008
9009 ** Removed deprecated function scm_newsmob
9010
9011 ** Warning: scm_make_smob_type_mfpe might become deprecated in a future release
9012
9013 There is an ongoing discussion among the developers whether to
9014 deprecate `scm_make_smob_type_mfpe' or not. Please use the current
9015 standard interface (scm_make_smob_type, scm_set_smob_XXX) in new code
9016 until this issue has been settled.
9017
9018 ** Removed deprecated type tag scm_tc16_kw
9019
9020 ** Added type tag scm_tc16_keyword
9021
9022 (This was introduced already in release 1.3.4 but was not documented
9023 until now.)
9024
9025 ** gdb_print now prints "*** Guile not initialized ***" until Guile initialized
9026
9027 * Changes to system call interfaces:
9028
9029 ** The "select" procedure now tests port buffers for the ability to
9030 provide input or accept output. Previously only the underlying file
9031 descriptors were checked.
9032
9033 ** New variable PIPE_BUF: the maximum number of bytes that can be
9034 atomically written to a pipe.
9035
9036 ** If a facility is not available on the system when Guile is
9037 compiled, the corresponding primitive procedure will not be defined.
9038 Previously it would have been defined but would throw a system-error
9039 exception if called. Exception handlers which catch this case may
9040 need minor modification: an error will be thrown with key
9041 'unbound-variable instead of 'system-error. Alternatively it's
9042 now possible to use `defined?' to check whether the facility is
9043 available.
9044
9045 ** Procedures which depend on the timezone should now give the correct
9046 result on systems which cache the TZ environment variable, even if TZ
9047 is changed without calling tzset.
9048
9049 * Changes to the networking interfaces:
9050
9051 ** New functions: htons, ntohs, htonl, ntohl: for converting short and
9052 long integers between network and host format. For now, it's not
9053 particularly convenient to do this kind of thing, but consider:
9054
9055 (define write-network-long
9056 (lambda (value port)
9057 (let ((v (make-uniform-vector 1 1 0)))
9058 (uniform-vector-set! v 0 (htonl value))
9059 (uniform-vector-write v port))))
9060
9061 (define read-network-long
9062 (lambda (port)
9063 (let ((v (make-uniform-vector 1 1 0)))
9064 (uniform-vector-read! v port)
9065 (ntohl (uniform-vector-ref v 0)))))
9066
9067 ** If inet-aton fails, it now throws an error with key 'misc-error
9068 instead of 'system-error, since errno is not relevant.
9069
9070 ** Certain gethostbyname/gethostbyaddr failures now throw errors with
9071 specific keys instead of 'system-error. The latter is inappropriate
9072 since errno will not have been set. The keys are:
9073 'host-not-found, 'try-again, 'no-recovery and 'no-data.
9074
9075 ** sethostent, setnetent, setprotoent, setservent: now take an
9076 optional argument STAYOPEN, which specifies whether the database
9077 remains open after a database entry is accessed randomly (e.g., using
9078 gethostbyname for the hosts database.) The default is #f. Previously
9079 #t was always used.
9080
9081
9082 Changes since Guile 1.3.2:
9083
9084 * Changes to the stand-alone interpreter
9085
9086 ** Debugger
9087
9088 An initial version of the Guile debugger written by Chris Hanson has
9089 been added. The debugger is still under development but is included
9090 in the distribution anyway since it is already quite useful.
9091
9092 Type
9093
9094 (debug)
9095
9096 after an error to enter the debugger. Type `help' inside the debugger
9097 for a description of available commands.
9098
9099 If you prefer to have stack frames numbered and printed in
9100 anti-chronological order and prefer up in the stack to be down on the
9101 screen as is the case in gdb, you can put
9102
9103 (debug-enable 'backwards)
9104
9105 in your .guile startup file. (However, this means that Guile can't
9106 use indentation to indicate stack level.)
9107
9108 The debugger is autoloaded into Guile at the first use.
9109
9110 ** Further enhancements to backtraces
9111
9112 There is a new debug option `width' which controls the maximum width
9113 on the screen of printed stack frames. Fancy printing parameters
9114 ("level" and "length" as in Common LISP) are adaptively adjusted for
9115 each stack frame to give maximum information while still fitting
9116 within the bounds. If the stack frame can't be made to fit by
9117 adjusting parameters, it is simply cut off at the end. This is marked
9118 with a `$'.
9119
9120 ** Some modules are now only loaded when the repl is started
9121
9122 The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
9123 regex) are now loaded into (guile-user) only if the repl has been
9124 started. The effect is that the startup time for scripts has been
9125 reduced to 30% of what it was previously.
9126
9127 Correctly written scripts load the modules they require at the top of
9128 the file and should not be affected by this change.
9129
9130 ** Hooks are now represented as smobs
9131
9132 * Changes to Scheme functions and syntax
9133
9134 ** Readline support has changed again.
9135
9136 The old (readline-activator) module is gone. Use (ice-9 readline)
9137 instead, which now contains all readline functionality. So the code
9138 to activate readline is now
9139
9140 (use-modules (ice-9 readline))
9141 (activate-readline)
9142
9143 This should work at any time, including from the guile prompt.
9144
9145 To avoid confusion about the terms of Guile's license, please only
9146 enable readline for your personal use; please don't make it the
9147 default for others. Here is why we make this rather odd-sounding
9148 request:
9149
9150 Guile is normally licensed under a weakened form of the GNU General
9151 Public License, which allows you to link code with Guile without
9152 placing that code under the GPL. This exception is important to some
9153 people.
9154
9155 However, since readline is distributed under the GNU General Public
9156 License, when you link Guile with readline, either statically or
9157 dynamically, you effectively change Guile's license to the strict GPL.
9158 Whenever you link any strictly GPL'd code into Guile, uses of Guile
9159 which are normally permitted become forbidden. This is a rather
9160 non-obvious consequence of the licensing terms.
9161
9162 So, to make sure things remain clear, please let people choose for
9163 themselves whether to link GPL'd libraries like readline with Guile.
9164
9165 ** regexp-substitute/global has changed slightly, but incompatibly.
9166
9167 If you include a function in the item list, the string of the match
9168 object it receives is the same string passed to
9169 regexp-substitute/global, not some suffix of that string.
9170 Correspondingly, the match's positions are relative to the entire
9171 string, not the suffix.
9172
9173 If the regexp can match the empty string, the way matches are chosen
9174 from the string has changed. regexp-substitute/global recognizes the
9175 same set of matches that list-matches does; see below.
9176
9177 ** New function: list-matches REGEXP STRING [FLAGS]
9178
9179 Return a list of match objects, one for every non-overlapping, maximal
9180 match of REGEXP in STRING. The matches appear in left-to-right order.
9181 list-matches only reports matches of the empty string if there are no
9182 other matches which begin on, end at, or include the empty match's
9183 position.
9184
9185 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
9186
9187 ** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
9188
9189 For each match of REGEXP in STRING, apply PROC to the match object,
9190 and the last value PROC returned, or INIT for the first call. Return
9191 the last value returned by PROC. We apply PROC to the matches as they
9192 appear from left to right.
9193
9194 This function recognizes matches according to the same criteria as
9195 list-matches.
9196
9197 Thus, you could define list-matches like this:
9198
9199 (define (list-matches regexp string . flags)
9200 (reverse! (apply fold-matches regexp string '() cons flags)))
9201
9202 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
9203
9204 ** Hooks
9205
9206 *** New function: hook? OBJ
9207
9208 Return #t if OBJ is a hook, otherwise #f.
9209
9210 *** New function: make-hook-with-name NAME [ARITY]
9211
9212 Return a hook with name NAME and arity ARITY. The default value for
9213 ARITY is 0. The only effect of NAME is that it will appear when the
9214 hook object is printed to ease debugging.
9215
9216 *** New function: hook-empty? HOOK
9217
9218 Return #t if HOOK doesn't contain any procedures, otherwise #f.
9219
9220 *** New function: hook->list HOOK
9221
9222 Return a list of the procedures that are called when run-hook is
9223 applied to HOOK.
9224
9225 ** `map' signals an error if its argument lists are not all the same length.
9226
9227 This is the behavior required by R5RS, so this change is really a bug
9228 fix. But it seems to affect a lot of people's code, so we're
9229 mentioning it here anyway.
9230
9231 ** Print-state handling has been made more transparent
9232
9233 Under certain circumstances, ports are represented as a port with an
9234 associated print state. Earlier, this pair was represented as a pair
9235 (see "Some magic has been added to the printer" below). It is now
9236 indistinguishable (almost; see `get-print-state') from a port on the
9237 user level.
9238
9239 *** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
9240
9241 Return a new port with the associated print state PRINT-STATE.
9242
9243 *** New function: get-print-state OUTPUT-PORT
9244
9245 Return the print state associated with this port if it exists,
9246 otherwise return #f.
9247
9248 *** New function: directory-stream? OBJECT
9249
9250 Returns true iff OBJECT is a directory stream --- the sort of object
9251 returned by `opendir'.
9252
9253 ** New function: using-readline?
9254
9255 Return #t if readline is in use in the current repl.
9256
9257 ** structs will be removed in 1.4
9258
9259 Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
9260 and use GOOPS objects as the fundamental record type.
9261
9262 * Changes to the scm_ interface
9263
9264 ** structs will be removed in 1.4
9265
9266 The entire current struct interface (struct.c, struct.h) will be
9267 replaced in Guile 1.4. We will merge GOOPS into libguile and use
9268 GOOPS objects as the fundamental record type.
9269
9270 ** The internal representation of subr's has changed
9271
9272 Instead of giving a hint to the subr name, the CAR field of the subr
9273 now contains an index to a subr entry in scm_subr_table.
9274
9275 *** New variable: scm_subr_table
9276
9277 An array of subr entries. A subr entry contains the name, properties
9278 and documentation associated with the subr. The properties and
9279 documentation slots are not yet used.
9280
9281 ** A new scheme for "forwarding" calls to a builtin to a generic function
9282
9283 It is now possible to extend the functionality of some Guile
9284 primitives by letting them defer a call to a GOOPS generic function on
9285 argument mismatch. This means that there is no loss of efficiency in
9286 normal evaluation.
9287
9288 Example:
9289
9290 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
9291 (define-method + ((x <string>) (y <string>))
9292 (string-append x y))
9293
9294 + will still be as efficient as usual in numerical calculations, but
9295 can also be used for concatenating strings.
9296
9297 Who will be the first one to extend Guile's numerical tower to
9298 rationals? :) [OK, there a few other things to fix before this can
9299 be made in a clean way.]
9300
9301 *** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
9302
9303 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
9304
9305 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
9306
9307 These do the same job as SCM_PROC and SCM_PROC1, but they also define
9308 a variable GENERIC which can be used by the dispatch macros below.
9309
9310 [This is experimental code which may change soon.]
9311
9312 *** New macros for forwarding control to a generic on arg type error
9313
9314 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
9315
9316 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
9317
9318 These correspond to the scm_wta function call, and have the same
9319 behaviour until the user has called the GOOPS primitive
9320 `enable-primitive-generic!'. After that, these macros will apply the
9321 generic function GENERIC to the argument(s) instead of calling
9322 scm_wta.
9323
9324 [This is experimental code which may change soon.]
9325
9326 *** New macros for argument testing with generic dispatch
9327
9328 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
9329
9330 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
9331
9332 These correspond to the SCM_ASSERT macro, but will defer control to
9333 GENERIC on error after `enable-primitive-generic!' has been called.
9334
9335 [This is experimental code which may change soon.]
9336
9337 ** New function: SCM scm_eval_body (SCM body, SCM env)
9338
9339 Evaluates the body of a special form.
9340
9341 ** The internal representation of struct's has changed
9342
9343 Previously, four slots were allocated for the procedure(s) of entities
9344 and operators. The motivation for this representation had to do with
9345 the structure of the evaluator, the wish to support tail-recursive
9346 generic functions, and efficiency. Since the generic function
9347 dispatch mechanism has changed, there is no longer a need for such an
9348 expensive representation, and the representation has been simplified.
9349
9350 This should not make any difference for most users.
9351
9352 ** GOOPS support has been cleaned up.
9353
9354 Some code has been moved from eval.c to objects.c and code in both of
9355 these compilation units has been cleaned up and better structured.
9356
9357 *** New functions for applying generic functions
9358
9359 New function: SCM scm_apply_generic (GENERIC, ARGS)
9360 New function: SCM scm_call_generic_0 (GENERIC)
9361 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
9362 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
9363 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
9364
9365 ** Deprecated function: scm_make_named_hook
9366
9367 It is now replaced by:
9368
9369 ** New function: SCM scm_create_hook (const char *name, int arity)
9370
9371 Creates a hook in the same way as make-hook above but also
9372 binds a variable named NAME to it.
9373
9374 This is the typical way of creating a hook from C code.
9375
9376 Currently, the variable is created in the "current" module.
9377 This might change when we get the new module system.
9378
9379 [The behaviour is identical to scm_make_named_hook.]
9380
9381
9382
9383 Changes since Guile 1.3:
9384
9385 * Changes to mailing lists
9386
9387 ** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
9388
9389 See the README file to find current addresses for all the Guile
9390 mailing lists.
9391
9392 * Changes to the distribution
9393
9394 ** Readline support is no longer included with Guile by default.
9395
9396 Based on the different license terms of Guile and Readline, we
9397 concluded that Guile should not *by default* cause the linking of
9398 Readline into an application program. Readline support is now offered
9399 as a separate module, which is linked into an application only when
9400 you explicitly specify it.
9401
9402 Although Guile is GNU software, its distribution terms add a special
9403 exception to the usual GNU General Public License (GPL). Guile's
9404 license includes a clause that allows you to link Guile with non-free
9405 programs. We add this exception so as not to put Guile at a
9406 disadvantage vis-a-vis other extensibility packages that support other
9407 languages.
9408
9409 In contrast, the GNU Readline library is distributed under the GNU
9410 General Public License pure and simple. This means that you may not
9411 link Readline, even dynamically, into an application unless it is
9412 distributed under a free software license that is compatible the GPL.
9413
9414 Because of this difference in distribution terms, an application that
9415 can use Guile may not be able to use Readline. Now users will be
9416 explicitly offered two independent decisions about the use of these
9417 two packages.
9418
9419 You can activate the readline support by issuing
9420
9421 (use-modules (readline-activator))
9422 (activate-readline)
9423
9424 from your ".guile" file, for example.
9425
9426 * Changes to the stand-alone interpreter
9427
9428 ** All builtins now print as primitives.
9429 Previously builtin procedures not belonging to the fundamental subr
9430 types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
9431 Now, they print as #<primitive-procedure NAME>.
9432
9433 ** Backtraces slightly more intelligible.
9434 gsubr-apply and macro transformer application frames no longer appear
9435 in backtraces.
9436
9437 * Changes to Scheme functions and syntax
9438
9439 ** Guile now correctly handles internal defines by rewriting them into
9440 their equivalent letrec. Previously, internal defines would
9441 incrementally add to the innermost environment, without checking
9442 whether the restrictions specified in RnRS were met. This lead to the
9443 correct behaviour when these restriction actually were met, but didn't
9444 catch all illegal uses. Such an illegal use could lead to crashes of
9445 the Guile interpreter or other unwanted results. An example of
9446 incorrect internal defines that made Guile behave erratically:
9447
9448 (let ()
9449 (define a 1)
9450 (define (b) a)
9451 (define c (1+ (b)))
9452 (define d 3)
9453
9454 (b))
9455
9456 => 2
9457
9458 The problem with this example is that the definition of `c' uses the
9459 value of `b' directly. This confuses the meoization machine of Guile
9460 so that the second call of `b' (this time in a larger environment that
9461 also contains bindings for `c' and `d') refers to the binding of `c'
9462 instead of `a'. You could also make Guile crash with a variation on
9463 this theme:
9464
9465 (define (foo flag)
9466 (define a 1)
9467 (define (b flag) (if flag a 1))
9468 (define c (1+ (b flag)))
9469 (define d 3)
9470
9471 (b #t))
9472
9473 (foo #f)
9474 (foo #t)
9475
9476 From now on, Guile will issue an `Unbound variable: b' error message
9477 for both examples.
9478
9479 ** Hooks
9480
9481 A hook contains a list of functions which should be called on
9482 particular occasions in an existing program. Hooks are used for
9483 customization.
9484
9485 A window manager might have a hook before-window-map-hook. The window
9486 manager uses the function run-hooks to call all functions stored in
9487 before-window-map-hook each time a window is mapped. The user can
9488 store functions in the hook using add-hook!.
9489
9490 In Guile, hooks are first class objects.
9491
9492 *** New function: make-hook [N_ARGS]
9493
9494 Return a hook for hook functions which can take N_ARGS arguments.
9495 The default value for N_ARGS is 0.
9496
9497 (See also scm_make_named_hook below.)
9498
9499 *** New function: add-hook! HOOK PROC [APPEND_P]
9500
9501 Put PROC at the beginning of the list of functions stored in HOOK.
9502 If APPEND_P is supplied, and non-false, put PROC at the end instead.
9503
9504 PROC must be able to take the number of arguments specified when the
9505 hook was created.
9506
9507 If PROC already exists in HOOK, then remove it first.
9508
9509 *** New function: remove-hook! HOOK PROC
9510
9511 Remove PROC from the list of functions in HOOK.
9512
9513 *** New function: reset-hook! HOOK
9514
9515 Clear the list of hook functions stored in HOOK.
9516
9517 *** New function: run-hook HOOK ARG1 ...
9518
9519 Run all hook functions stored in HOOK with arguments ARG1 ... .
9520 The number of arguments supplied must correspond to the number given
9521 when the hook was created.
9522
9523 ** The function `dynamic-link' now takes optional keyword arguments.
9524 The only keyword argument that is currently defined is `:global
9525 BOOL'. With it, you can control whether the shared library will be
9526 linked in global mode or not. In global mode, the symbols from the
9527 linked library can be used to resolve references from other
9528 dynamically linked libraries. In non-global mode, the linked
9529 library is essentially invisible and can only be accessed via
9530 `dynamic-func', etc. The default is now to link in global mode.
9531 Previously, the default has been non-global mode.
9532
9533 The `#:global' keyword is only effective on platforms that support
9534 the dlopen family of functions.
9535
9536 ** New function `provided?'
9537
9538 - Function: provided? FEATURE
9539 Return true iff FEATURE is supported by this installation of
9540 Guile. FEATURE must be a symbol naming a feature; the global
9541 variable `*features*' is a list of available features.
9542
9543 ** Changes to the module (ice-9 expect):
9544
9545 *** The expect-strings macro now matches `$' in a regular expression
9546 only at a line-break or end-of-file by default. Previously it would
9547 match the end of the string accumulated so far. The old behaviour
9548 can be obtained by setting the variable `expect-strings-exec-flags'
9549 to 0.
9550
9551 *** The expect-strings macro now uses a variable `expect-strings-exec-flags'
9552 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
9553 in a regular expression will still match before a line-break or
9554 end-of-file. The default is `regexp/noteol'.
9555
9556 *** The expect-strings macro now uses a variable
9557 `expect-strings-compile-flags' for the flags to be supplied to
9558 `make-regexp'. The default is `regexp/newline', which was previously
9559 hard-coded.
9560
9561 *** The expect macro now supplies two arguments to a match procedure:
9562 the current accumulated string and a flag to indicate whether
9563 end-of-file has been reached. Previously only the string was supplied.
9564 If end-of-file is reached, the match procedure will be called an
9565 additional time with the same accumulated string as the previous call
9566 but with the flag set.
9567
9568 ** New module (ice-9 format), implementing the Common Lisp `format' function.
9569
9570 This code, and the documentation for it that appears here, was
9571 borrowed from SLIB, with minor adaptations for Guile.
9572
9573 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
9574 An almost complete implementation of Common LISP format description
9575 according to the CL reference book `Common LISP' from Guy L.
9576 Steele, Digital Press. Backward compatible to most of the
9577 available Scheme format implementations.
9578
9579 Returns `#t', `#f' or a string; has side effect of printing
9580 according to FORMAT-STRING. If DESTINATION is `#t', the output is
9581 to the current output port and `#t' is returned. If DESTINATION
9582 is `#f', a formatted string is returned as the result of the call.
9583 NEW: If DESTINATION is a string, DESTINATION is regarded as the
9584 format string; FORMAT-STRING is then the first argument and the
9585 output is returned as a string. If DESTINATION is a number, the
9586 output is to the current error port if available by the
9587 implementation. Otherwise DESTINATION must be an output port and
9588 `#t' is returned.
9589
9590 FORMAT-STRING must be a string. In case of a formatting error
9591 format returns `#f' and prints a message on the current output or
9592 error port. Characters are output as if the string were output by
9593 the `display' function with the exception of those prefixed by a
9594 tilde (~). For a detailed description of the FORMAT-STRING syntax
9595 please consult a Common LISP format reference manual. For a test
9596 suite to verify this format implementation load `formatst.scm'.
9597 Please send bug reports to `[email protected]'.
9598
9599 Note: `format' is not reentrant, i.e. only one `format'-call may
9600 be executed at a time.
9601
9602
9603 *** Format Specification (Format version 3.0)
9604
9605 Please consult a Common LISP format reference manual for a detailed
9606 description of the format string syntax. For a demonstration of the
9607 implemented directives see `formatst.scm'.
9608
9609 This implementation supports directive parameters and modifiers (`:'
9610 and `@' characters). Multiple parameters must be separated by a comma
9611 (`,'). Parameters can be numerical parameters (positive or negative),
9612 character parameters (prefixed by a quote character (`''), variable
9613 parameters (`v'), number of rest arguments parameter (`#'), empty and
9614 default parameters. Directive characters are case independent. The
9615 general form of a directive is:
9616
9617 DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
9618
9619 DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
9620
9621 *** Implemented CL Format Control Directives
9622
9623 Documentation syntax: Uppercase characters represent the
9624 corresponding control directive characters. Lowercase characters
9625 represent control directive parameter descriptions.
9626
9627 `~A'
9628 Any (print as `display' does).
9629 `~@A'
9630 left pad.
9631
9632 `~MINCOL,COLINC,MINPAD,PADCHARA'
9633 full padding.
9634
9635 `~S'
9636 S-expression (print as `write' does).
9637 `~@S'
9638 left pad.
9639
9640 `~MINCOL,COLINC,MINPAD,PADCHARS'
9641 full padding.
9642
9643 `~D'
9644 Decimal.
9645 `~@D'
9646 print number sign always.
9647
9648 `~:D'
9649 print comma separated.
9650
9651 `~MINCOL,PADCHAR,COMMACHARD'
9652 padding.
9653
9654 `~X'
9655 Hexadecimal.
9656 `~@X'
9657 print number sign always.
9658
9659 `~:X'
9660 print comma separated.
9661
9662 `~MINCOL,PADCHAR,COMMACHARX'
9663 padding.
9664
9665 `~O'
9666 Octal.
9667 `~@O'
9668 print number sign always.
9669
9670 `~:O'
9671 print comma separated.
9672
9673 `~MINCOL,PADCHAR,COMMACHARO'
9674 padding.
9675
9676 `~B'
9677 Binary.
9678 `~@B'
9679 print number sign always.
9680
9681 `~:B'
9682 print comma separated.
9683
9684 `~MINCOL,PADCHAR,COMMACHARB'
9685 padding.
9686
9687 `~NR'
9688 Radix N.
9689 `~N,MINCOL,PADCHAR,COMMACHARR'
9690 padding.
9691
9692 `~@R'
9693 print a number as a Roman numeral.
9694
9695 `~:@R'
9696 print a number as an "old fashioned" Roman numeral.
9697
9698 `~:R'
9699 print a number as an ordinal English number.
9700
9701 `~:@R'
9702 print a number as a cardinal English number.
9703
9704 `~P'
9705 Plural.
9706 `~@P'
9707 prints `y' and `ies'.
9708
9709 `~:P'
9710 as `~P but jumps 1 argument backward.'
9711
9712 `~:@P'
9713 as `~@P but jumps 1 argument backward.'
9714
9715 `~C'
9716 Character.
9717 `~@C'
9718 prints a character as the reader can understand it (i.e. `#\'
9719 prefixing).
9720
9721 `~:C'
9722 prints a character as emacs does (eg. `^C' for ASCII 03).
9723
9724 `~F'
9725 Fixed-format floating-point (prints a flonum like MMM.NNN).
9726 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
9727 `~@F'
9728 If the number is positive a plus sign is printed.
9729
9730 `~E'
9731 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
9732 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
9733 `~@E'
9734 If the number is positive a plus sign is printed.
9735
9736 `~G'
9737 General floating-point (prints a flonum either fixed or
9738 exponential).
9739 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
9740 `~@G'
9741 If the number is positive a plus sign is printed.
9742
9743 `~$'
9744 Dollars floating-point (prints a flonum in fixed with signs
9745 separated).
9746 `~DIGITS,SCALE,WIDTH,PADCHAR$'
9747 `~@$'
9748 If the number is positive a plus sign is printed.
9749
9750 `~:@$'
9751 A sign is always printed and appears before the padding.
9752
9753 `~:$'
9754 The sign appears before the padding.
9755
9756 `~%'
9757 Newline.
9758 `~N%'
9759 print N newlines.
9760
9761 `~&'
9762 print newline if not at the beginning of the output line.
9763 `~N&'
9764 prints `~&' and then N-1 newlines.
9765
9766 `~|'
9767 Page Separator.
9768 `~N|'
9769 print N page separators.
9770
9771 `~~'
9772 Tilde.
9773 `~N~'
9774 print N tildes.
9775
9776 `~'<newline>
9777 Continuation Line.
9778 `~:'<newline>
9779 newline is ignored, white space left.
9780
9781 `~@'<newline>
9782 newline is left, white space ignored.
9783
9784 `~T'
9785 Tabulation.
9786 `~@T'
9787 relative tabulation.
9788
9789 `~COLNUM,COLINCT'
9790 full tabulation.
9791
9792 `~?'
9793 Indirection (expects indirect arguments as a list).
9794 `~@?'
9795 extracts indirect arguments from format arguments.
9796
9797 `~(STR~)'
9798 Case conversion (converts by `string-downcase').
9799 `~:(STR~)'
9800 converts by `string-capitalize'.
9801
9802 `~@(STR~)'
9803 converts by `string-capitalize-first'.
9804
9805 `~:@(STR~)'
9806 converts by `string-upcase'.
9807
9808 `~*'
9809 Argument Jumping (jumps 1 argument forward).
9810 `~N*'
9811 jumps N arguments forward.
9812
9813 `~:*'
9814 jumps 1 argument backward.
9815
9816 `~N:*'
9817 jumps N arguments backward.
9818
9819 `~@*'
9820 jumps to the 0th argument.
9821
9822 `~N@*'
9823 jumps to the Nth argument (beginning from 0)
9824
9825 `~[STR0~;STR1~;...~;STRN~]'
9826 Conditional Expression (numerical clause conditional).
9827 `~N['
9828 take argument from N.
9829
9830 `~@['
9831 true test conditional.
9832
9833 `~:['
9834 if-else-then conditional.
9835
9836 `~;'
9837 clause separator.
9838
9839 `~:;'
9840 default clause follows.
9841
9842 `~{STR~}'
9843 Iteration (args come from the next argument (a list)).
9844 `~N{'
9845 at most N iterations.
9846
9847 `~:{'
9848 args from next arg (a list of lists).
9849
9850 `~@{'
9851 args from the rest of arguments.
9852
9853 `~:@{'
9854 args from the rest args (lists).
9855
9856 `~^'
9857 Up and out.
9858 `~N^'
9859 aborts if N = 0
9860
9861 `~N,M^'
9862 aborts if N = M
9863
9864 `~N,M,K^'
9865 aborts if N <= M <= K
9866
9867 *** Not Implemented CL Format Control Directives
9868
9869 `~:A'
9870 print `#f' as an empty list (see below).
9871
9872 `~:S'
9873 print `#f' as an empty list (see below).
9874
9875 `~<~>'
9876 Justification.
9877
9878 `~:^'
9879 (sorry I don't understand its semantics completely)
9880
9881 *** Extended, Replaced and Additional Control Directives
9882
9883 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
9884 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
9885 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
9886 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
9887 `~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
9888 COMMAWIDTH is the number of characters between two comma
9889 characters.
9890
9891 `~I'
9892 print a R4RS complex number as `~F~@Fi' with passed parameters for
9893 `~F'.
9894
9895 `~Y'
9896 Pretty print formatting of an argument for scheme code lists.
9897
9898 `~K'
9899 Same as `~?.'
9900
9901 `~!'
9902 Flushes the output if format DESTINATION is a port.
9903
9904 `~_'
9905 Print a `#\space' character
9906 `~N_'
9907 print N `#\space' characters.
9908
9909 `~/'
9910 Print a `#\tab' character
9911 `~N/'
9912 print N `#\tab' characters.
9913
9914 `~NC'
9915 Takes N as an integer representation for a character. No arguments
9916 are consumed. N is converted to a character by `integer->char'. N
9917 must be a positive decimal number.
9918
9919 `~:S'
9920 Print out readproof. Prints out internal objects represented as
9921 `#<...>' as strings `"#<...>"' so that the format output can always
9922 be processed by `read'.
9923
9924 `~:A'
9925 Print out readproof. Prints out internal objects represented as
9926 `#<...>' as strings `"#<...>"' so that the format output can always
9927 be processed by `read'.
9928
9929 `~Q'
9930 Prints information and a copyright notice on the format
9931 implementation.
9932 `~:Q'
9933 prints format version.
9934
9935 `~F, ~E, ~G, ~$'
9936 may also print number strings, i.e. passing a number as a string
9937 and format it accordingly.
9938
9939 *** Configuration Variables
9940
9941 The format module exports some configuration variables to suit the
9942 systems and users needs. There should be no modification necessary for
9943 the configuration that comes with Guile. Format detects automatically
9944 if the running scheme system implements floating point numbers and
9945 complex numbers.
9946
9947 format:symbol-case-conv
9948 Symbols are converted by `symbol->string' so the case type of the
9949 printed symbols is implementation dependent.
9950 `format:symbol-case-conv' is a one arg closure which is either
9951 `#f' (no conversion), `string-upcase', `string-downcase' or
9952 `string-capitalize'. (default `#f')
9953
9954 format:iobj-case-conv
9955 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
9956 implementation internal objects. (default `#f')
9957
9958 format:expch
9959 The character prefixing the exponent value in `~E' printing.
9960 (default `#\E')
9961
9962 *** Compatibility With Other Format Implementations
9963
9964 SLIB format 2.x:
9965 See `format.doc'.
9966
9967 SLIB format 1.4:
9968 Downward compatible except for padding support and `~A', `~S',
9969 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
9970 `printf' padding support which is completely replaced by the CL
9971 `format' padding style.
9972
9973 MIT C-Scheme 7.1:
9974 Downward compatible except for `~', which is not documented
9975 (ignores all characters inside the format string up to a newline
9976 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
9977 numerical and variable parameters and `:/@' modifiers in the CL
9978 sense).
9979
9980 Elk 1.5/2.0:
9981 Downward compatible except for `~A' and `~S' which print in
9982 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
9983 directive parameters or modifiers)).
9984
9985 Scheme->C 01nov91:
9986 Downward compatible except for an optional destination parameter:
9987 S2C accepts a format call without a destination which returns a
9988 formatted string. This is equivalent to a #f destination in S2C.
9989 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
9990 parameters or modifiers)).
9991
9992
9993 ** Changes to string-handling functions.
9994
9995 These functions were added to support the (ice-9 format) module, above.
9996
9997 *** New function: string-upcase STRING
9998 *** New function: string-downcase STRING
9999
10000 These are non-destructive versions of the existing string-upcase! and
10001 string-downcase! functions.
10002
10003 *** New function: string-capitalize! STRING
10004 *** New function: string-capitalize STRING
10005
10006 These functions convert the first letter of each word in the string to
10007 upper case. Thus:
10008
10009 (string-capitalize "howdy there")
10010 => "Howdy There"
10011
10012 As with the other functions, string-capitalize! modifies the string in
10013 place, while string-capitalize returns a modified copy of its argument.
10014
10015 *** New function: string-ci->symbol STRING
10016
10017 Return a symbol whose name is STRING, but having the same case as if
10018 the symbol had be read by `read'.
10019
10020 Guile can be configured to be sensitive or insensitive to case
10021 differences in Scheme identifiers. If Guile is case-insensitive, all
10022 symbols are converted to lower case on input. The `string-ci->symbol'
10023 function returns a symbol whose name in STRING, transformed as Guile
10024 would if STRING were input.
10025
10026 *** New function: substring-move! STRING1 START END STRING2 START
10027
10028 Copy the substring of STRING1 from START (inclusive) to END
10029 (exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
10030 string, and the source and destination areas may overlap; in all
10031 cases, the function behaves as if all the characters were copied
10032 simultanously.
10033
10034 *** Extended functions: substring-move-left! substring-move-right!
10035
10036 These functions now correctly copy arbitrarily overlapping substrings;
10037 they are both synonyms for substring-move!.
10038
10039
10040 ** New module (ice-9 getopt-long), with the function `getopt-long'.
10041
10042 getopt-long is a function for parsing command-line arguments in a
10043 manner consistent with other GNU programs.
10044
10045 (getopt-long ARGS GRAMMAR)
10046 Parse the arguments ARGS according to the argument list grammar GRAMMAR.
10047
10048 ARGS should be a list of strings. Its first element should be the
10049 name of the program; subsequent elements should be the arguments
10050 that were passed to the program on the command line. The
10051 `program-arguments' procedure returns a list of this form.
10052
10053 GRAMMAR is a list of the form:
10054 ((OPTION (PROPERTY VALUE) ...) ...)
10055
10056 Each OPTION should be a symbol. `getopt-long' will accept a
10057 command-line option named `--OPTION'.
10058 Each option can have the following (PROPERTY VALUE) pairs:
10059
10060 (single-char CHAR) --- Accept `-CHAR' as a single-character
10061 equivalent to `--OPTION'. This is how to specify traditional
10062 Unix-style flags.
10063 (required? BOOL) --- If BOOL is true, the option is required.
10064 getopt-long will raise an error if it is not found in ARGS.
10065 (value BOOL) --- If BOOL is #t, the option accepts a value; if
10066 it is #f, it does not; and if it is the symbol
10067 `optional', the option may appear in ARGS with or
10068 without a value.
10069 (predicate FUNC) --- If the option accepts a value (i.e. you
10070 specified `(value #t)' for this option), then getopt
10071 will apply FUNC to the value, and throw an exception
10072 if it returns #f. FUNC should be a procedure which
10073 accepts a string and returns a boolean value; you may
10074 need to use quasiquotes to get it into GRAMMAR.
10075
10076 The (PROPERTY VALUE) pairs may occur in any order, but each
10077 property may occur only once. By default, options do not have
10078 single-character equivalents, are not required, and do not take
10079 values.
10080
10081 In ARGS, single-character options may be combined, in the usual
10082 Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
10083 accepts values, then it must be the last option in the
10084 combination; the value is the next argument. So, for example, using
10085 the following grammar:
10086 ((apples (single-char #\a))
10087 (blimps (single-char #\b) (value #t))
10088 (catalexis (single-char #\c) (value #t)))
10089 the following argument lists would be acceptable:
10090 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
10091 for "blimps" and "catalexis")
10092 ("-ab" "bang" "-c" "couth") (same)
10093 ("-ac" "couth" "-b" "bang") (same)
10094 ("-abc" "couth" "bang") (an error, since `-b' is not the
10095 last option in its combination)
10096
10097 If an option's value is optional, then `getopt-long' decides
10098 whether it has a value by looking at what follows it in ARGS. If
10099 the next element is a string, and it does not appear to be an
10100 option itself, then that string is the option's value.
10101
10102 The value of a long option can appear as the next element in ARGS,
10103 or it can follow the option name, separated by an `=' character.
10104 Thus, using the same grammar as above, the following argument lists
10105 are equivalent:
10106 ("--apples" "Braeburn" "--blimps" "Goodyear")
10107 ("--apples=Braeburn" "--blimps" "Goodyear")
10108 ("--blimps" "Goodyear" "--apples=Braeburn")
10109
10110 If the option "--" appears in ARGS, argument parsing stops there;
10111 subsequent arguments are returned as ordinary arguments, even if
10112 they resemble options. So, in the argument list:
10113 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
10114 `getopt-long' will recognize the `apples' option as having the
10115 value "Granny Smith", but it will not recognize the `blimp'
10116 option; it will return the strings "--blimp" and "Goodyear" as
10117 ordinary argument strings.
10118
10119 The `getopt-long' function returns the parsed argument list as an
10120 assocation list, mapping option names --- the symbols from GRAMMAR
10121 --- onto their values, or #t if the option does not accept a value.
10122 Unused options do not appear in the alist.
10123
10124 All arguments that are not the value of any option are returned
10125 as a list, associated with the empty list.
10126
10127 `getopt-long' throws an exception if:
10128 - it finds an unrecognized option in ARGS
10129 - a required option is omitted
10130 - an option that requires an argument doesn't get one
10131 - an option that doesn't accept an argument does get one (this can
10132 only happen using the long option `--opt=value' syntax)
10133 - an option predicate fails
10134
10135 So, for example:
10136
10137 (define grammar
10138 `((lockfile-dir (required? #t)
10139 (value #t)
10140 (single-char #\k)
10141 (predicate ,file-is-directory?))
10142 (verbose (required? #f)
10143 (single-char #\v)
10144 (value #f))
10145 (x-includes (single-char #\x))
10146 (rnet-server (single-char #\y)
10147 (predicate ,string?))))
10148
10149 (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
10150 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
10151 grammar)
10152 => ((() "foo1" "-fred" "foo2" "foo3")
10153 (rnet-server . "lamprod")
10154 (x-includes . "/usr/include")
10155 (lockfile-dir . "/tmp")
10156 (verbose . #t))
10157
10158 ** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
10159
10160 It will be removed in a few releases.
10161
10162 ** New syntax: lambda*
10163 ** New syntax: define*
10164 ** New syntax: define*-public
10165 ** New syntax: defmacro*
10166 ** New syntax: defmacro*-public
10167 Guile now supports optional arguments.
10168
10169 `lambda*', `define*', `define*-public', `defmacro*' and
10170 `defmacro*-public' are identical to the non-* versions except that
10171 they use an extended type of parameter list that has the following BNF
10172 syntax (parentheses are literal, square brackets indicate grouping,
10173 and `*', `+' and `?' have the usual meaning):
10174
10175 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
10176 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
10177 [[#&rest identifier]|[. identifier]]? ) | [identifier]
10178
10179 ext-var-decl ::= identifier | ( identifier expression )
10180
10181 The semantics are best illustrated with the following documentation
10182 and examples for `lambda*':
10183
10184 lambda* args . body
10185 lambda extended for optional and keyword arguments
10186
10187 lambda* creates a procedure that takes optional arguments. These
10188 are specified by putting them inside brackets at the end of the
10189 paramater list, but before any dotted rest argument. For example,
10190 (lambda* (a b #&optional c d . e) '())
10191 creates a procedure with fixed arguments a and b, optional arguments c
10192 and d, and rest argument e. If the optional arguments are omitted
10193 in a call, the variables for them are unbound in the procedure. This
10194 can be checked with the bound? macro.
10195
10196 lambda* can also take keyword arguments. For example, a procedure
10197 defined like this:
10198 (lambda* (#&key xyzzy larch) '())
10199 can be called with any of the argument lists (#:xyzzy 11)
10200 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
10201 are given as keywords are bound to values.
10202
10203 Optional and keyword arguments can also be given default values
10204 which they take on when they are not present in a call, by giving a
10205 two-item list in place of an optional argument, for example in:
10206 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
10207 foo is a fixed argument, bar is an optional argument with default
10208 value 42, and baz is a keyword argument with default value 73.
10209 Default value expressions are not evaluated unless they are needed
10210 and until the procedure is called.
10211
10212 lambda* now supports two more special parameter list keywords.
10213
10214 lambda*-defined procedures now throw an error by default if a
10215 keyword other than one of those specified is found in the actual
10216 passed arguments. However, specifying #&allow-other-keys
10217 immediately after the kyword argument declarations restores the
10218 previous behavior of ignoring unknown keywords. lambda* also now
10219 guarantees that if the same keyword is passed more than once, the
10220 last one passed is the one that takes effect. For example,
10221 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
10222 #:heads 37 #:tails 42 #:heads 99)
10223 would result in (99 47) being displayed.
10224
10225 #&rest is also now provided as a synonym for the dotted syntax rest
10226 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
10227 all respects to lambda*. This is provided for more similarity to DSSSL,
10228 MIT-Scheme and Kawa among others, as well as for refugees from other
10229 Lisp dialects.
10230
10231 Further documentation may be found in the optargs.scm file itself.
10232
10233 The optional argument module also exports the macros `let-optional',
10234 `let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
10235 are not documented here because they may be removed in the future, but
10236 full documentation is still available in optargs.scm.
10237
10238 ** New syntax: and-let*
10239 Guile now supports the `and-let*' form, described in the draft SRFI-2.
10240
10241 Syntax: (land* (<clause> ...) <body> ...)
10242 Each <clause> should have one of the following forms:
10243 (<variable> <expression>)
10244 (<expression>)
10245 <bound-variable>
10246 Each <variable> or <bound-variable> should be an identifier. Each
10247 <expression> should be a valid expression. The <body> should be a
10248 possibly empty sequence of expressions, like the <body> of a
10249 lambda form.
10250
10251 Semantics: A LAND* expression is evaluated by evaluating the
10252 <expression> or <bound-variable> of each of the <clause>s from
10253 left to right. The value of the first <expression> or
10254 <bound-variable> that evaluates to a false value is returned; the
10255 remaining <expression>s and <bound-variable>s are not evaluated.
10256 The <body> forms are evaluated iff all the <expression>s and
10257 <bound-variable>s evaluate to true values.
10258
10259 The <expression>s and the <body> are evaluated in an environment
10260 binding each <variable> of the preceding (<variable> <expression>)
10261 clauses to the value of the <expression>. Later bindings
10262 shadow earlier bindings.
10263
10264 Guile's and-let* macro was contributed by Michael Livshin.
10265
10266 ** New sorting functions
10267
10268 *** New function: sorted? SEQUENCE LESS?
10269 Returns `#t' when the sequence argument is in non-decreasing order
10270 according to LESS? (that is, there is no adjacent pair `... x y
10271 ...' for which `(less? y x)').
10272
10273 Returns `#f' when the sequence contains at least one out-of-order
10274 pair. It is an error if the sequence is neither a list nor a
10275 vector.
10276
10277 *** New function: merge LIST1 LIST2 LESS?
10278 LIST1 and LIST2 are sorted lists.
10279 Returns the sorted list of all elements in LIST1 and LIST2.
10280
10281 Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
10282 in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
10283 and that a < b1 in LIST1. Then a < b1 < b2 in the result.
10284 (Here "<" should read "comes before".)
10285
10286 *** New procedure: merge! LIST1 LIST2 LESS?
10287 Merges two lists, re-using the pairs of LIST1 and LIST2 to build
10288 the result. If the code is compiled, and LESS? constructs no new
10289 pairs, no pairs at all will be allocated. The first pair of the
10290 result will be either the first pair of LIST1 or the first pair of
10291 LIST2.
10292
10293 *** New function: sort SEQUENCE LESS?
10294 Accepts either a list or a vector, and returns a new sequence
10295 which is sorted. The new sequence is the same type as the input.
10296 Always `(sorted? (sort sequence less?) less?)'. The original
10297 sequence is not altered in any way. The new sequence shares its
10298 elements with the old one; no elements are copied.
10299
10300 *** New procedure: sort! SEQUENCE LESS
10301 Returns its sorted result in the original boxes. No new storage is
10302 allocated at all. Proper usage: (set! slist (sort! slist <))
10303
10304 *** New function: stable-sort SEQUENCE LESS?
10305 Similar to `sort' but stable. That is, if "equal" elements are
10306 ordered a < b in the original sequence, they will have the same order
10307 in the result.
10308
10309 *** New function: stable-sort! SEQUENCE LESS?
10310 Similar to `sort!' but stable.
10311 Uses temporary storage when sorting vectors.
10312
10313 *** New functions: sort-list, sort-list!
10314 Added for compatibility with scsh.
10315
10316 ** New built-in random number support
10317
10318 *** New function: random N [STATE]
10319 Accepts a positive integer or real N and returns a number of the
10320 same type between zero (inclusive) and N (exclusive). The values
10321 returned have a uniform distribution.
10322
10323 The optional argument STATE must be of the type produced by
10324 `copy-random-state' or `seed->random-state'. It defaults to the value
10325 of the variable `*random-state*'. This object is used to maintain the
10326 state of the pseudo-random-number generator and is altered as a side
10327 effect of the `random' operation.
10328
10329 *** New variable: *random-state*
10330 Holds a data structure that encodes the internal state of the
10331 random-number generator that `random' uses by default. The nature
10332 of this data structure is implementation-dependent. It may be
10333 printed out and successfully read back in, but may or may not
10334 function correctly as a random-number state object in another
10335 implementation.
10336
10337 *** New function: copy-random-state [STATE]
10338 Returns a new object of type suitable for use as the value of the
10339 variable `*random-state*' and as a second argument to `random'.
10340 If argument STATE is given, a copy of it is returned. Otherwise a
10341 copy of `*random-state*' is returned.
10342
10343 *** New function: seed->random-state SEED
10344 Returns a new object of type suitable for use as the value of the
10345 variable `*random-state*' and as a second argument to `random'.
10346 SEED is a string or a number. A new state is generated and
10347 initialized using SEED.
10348
10349 *** New function: random:uniform [STATE]
10350 Returns an uniformly distributed inexact real random number in the
10351 range between 0 and 1.
10352
10353 *** New procedure: random:solid-sphere! VECT [STATE]
10354 Fills VECT with inexact real random numbers the sum of whose
10355 squares is less than 1.0. Thinking of VECT as coordinates in
10356 space of dimension N = `(vector-length VECT)', the coordinates are
10357 uniformly distributed within the unit N-shere. The sum of the
10358 squares of the numbers is returned. VECT can be either a vector
10359 or a uniform vector of doubles.
10360
10361 *** New procedure: random:hollow-sphere! VECT [STATE]
10362 Fills VECT with inexact real random numbers the sum of whose squares
10363 is equal to 1.0. Thinking of VECT as coordinates in space of
10364 dimension n = `(vector-length VECT)', the coordinates are uniformly
10365 distributed over the surface of the unit n-shere. VECT can be either
10366 a vector or a uniform vector of doubles.
10367
10368 *** New function: random:normal [STATE]
10369 Returns an inexact real in a normal distribution with mean 0 and
10370 standard deviation 1. For a normal distribution with mean M and
10371 standard deviation D use `(+ M (* D (random:normal)))'.
10372
10373 *** New procedure: random:normal-vector! VECT [STATE]
10374 Fills VECT with inexact real random numbers which are independent and
10375 standard normally distributed (i.e., with mean 0 and variance 1).
10376 VECT can be either a vector or a uniform vector of doubles.
10377
10378 *** New function: random:exp STATE
10379 Returns an inexact real in an exponential distribution with mean 1.
10380 For an exponential distribution with mean U use (* U (random:exp)).
10381
10382 ** The range of logand, logior, logxor, logtest, and logbit? have changed.
10383
10384 These functions now operate on numbers in the range of a C unsigned
10385 long.
10386
10387 These functions used to operate on numbers in the range of a C signed
10388 long; however, this seems inappropriate, because Guile integers don't
10389 overflow.
10390
10391 ** New function: make-guardian
10392 This is an implementation of guardians as described in
10393 R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
10394 Generation-Based Garbage Collector" ACM SIGPLAN Conference on
10395 Programming Language Design and Implementation, June 1993
10396 ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
10397
10398 ** New functions: delq1!, delv1!, delete1!
10399 These procedures behave similar to delq! and friends but delete only
10400 one object if at all.
10401
10402 ** New function: unread-string STRING PORT
10403 Unread STRING to PORT, that is, push it back onto the port so that
10404 next read operation will work on the pushed back characters.
10405
10406 ** unread-char can now be called multiple times
10407 If unread-char is called multiple times, the unread characters will be
10408 read again in last-in first-out order.
10409
10410 ** the procedures uniform-array-read! and uniform-array-write! now
10411 work on any kind of port, not just ports which are open on a file.
10412
10413 ** Now 'l' in a port mode requests line buffering.
10414
10415 ** The procedure truncate-file now works on string ports as well
10416 as file ports. If the size argument is omitted, the current
10417 file position is used.
10418
10419 ** new procedure: seek PORT/FDES OFFSET WHENCE
10420 The arguments are the same as for the old fseek procedure, but it
10421 works on string ports as well as random-access file ports.
10422
10423 ** the fseek procedure now works on string ports, since it has been
10424 redefined using seek.
10425
10426 ** the setvbuf procedure now uses a default size if mode is _IOFBF and
10427 size is not supplied.
10428
10429 ** the newline procedure no longer flushes the port if it's not
10430 line-buffered: previously it did if it was the current output port.
10431
10432 ** open-pipe and close-pipe are no longer primitive procedures, but
10433 an emulation can be obtained using `(use-modules (ice-9 popen))'.
10434
10435 ** the freopen procedure has been removed.
10436
10437 ** new procedure: drain-input PORT
10438 Drains PORT's read buffers (including any pushed-back characters)
10439 and returns the contents as a single string.
10440
10441 ** New function: map-in-order PROC LIST1 LIST2 ...
10442 Version of `map' which guarantees that the procedure is applied to the
10443 lists in serial order.
10444
10445 ** Renamed `serial-array-copy!' and `serial-array-map!' to
10446 `array-copy-in-order!' and `array-map-in-order!'. The old names are
10447 now obsolete and will go away in release 1.5.
10448
10449 ** New syntax: collect BODY1 ...
10450 Version of `begin' which returns a list of the results of the body
10451 forms instead of the result of the last body form. In contrast to
10452 `begin', `collect' allows an empty body.
10453
10454 ** New functions: read-history FILENAME, write-history FILENAME
10455 Read/write command line history from/to file. Returns #t on success
10456 and #f if an error occured.
10457
10458 ** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
10459
10460 These procedures return a list of definitions available in the specified
10461 argument, a relative module reference. In the case of no argument,
10462 `(current-module)' is now consulted for definitions to return, instead
10463 of simply returning #f, the former behavior.
10464
10465 ** The #/ syntax for lists is no longer supported.
10466
10467 Earlier versions of Scheme accepted this syntax, but printed a
10468 warning.
10469
10470 ** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
10471
10472 Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
10473 modules.
10474
10475 * Changes to the gh_ interface
10476
10477 ** gh_scm2doubles
10478
10479 Now takes a second argument which is the result array. If this
10480 pointer is NULL, a new array is malloced (the old behaviour).
10481
10482 ** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
10483 gh_scm2shorts, gh_scm2longs, gh_scm2floats
10484
10485 New functions.
10486
10487 * Changes to the scm_ interface
10488
10489 ** Function: scm_make_named_hook (char* name, int n_args)
10490
10491 Creates a hook in the same way as make-hook above but also
10492 binds a variable named NAME to it.
10493
10494 This is the typical way of creating a hook from C code.
10495
10496 Currently, the variable is created in the "current" module. This
10497 might change when we get the new module system.
10498
10499 ** The smob interface
10500
10501 The interface for creating smobs has changed. For documentation, see
10502 data-rep.info (made from guile-core/doc/data-rep.texi).
10503
10504 *** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
10505
10506 >>> This function will be removed in 1.3.4. <<<
10507
10508 It is replaced by:
10509
10510 *** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
10511 This function adds a new smob type, named NAME, with instance size
10512 SIZE to the system. The return value is a tag that is used in
10513 creating instances of the type. If SIZE is 0, then no memory will
10514 be allocated when instances of the smob are created, and nothing
10515 will be freed by the default free function.
10516
10517 *** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
10518 This function sets the smob marking procedure for the smob type
10519 specified by the tag TC. TC is the tag returned by
10520 `scm_make_smob_type'.
10521
10522 *** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
10523 This function sets the smob freeing procedure for the smob type
10524 specified by the tag TC. TC is the tag returned by
10525 `scm_make_smob_type'.
10526
10527 *** Function: void scm_set_smob_print (tc, print)
10528
10529 - Function: void scm_set_smob_print (long tc,
10530 scm_sizet (*print) (SCM,
10531 SCM,
10532 scm_print_state *))
10533
10534 This function sets the smob printing procedure for the smob type
10535 specified by the tag TC. TC is the tag returned by
10536 `scm_make_smob_type'.
10537
10538 *** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
10539 This function sets the smob equality-testing predicate for the
10540 smob type specified by the tag TC. TC is the tag returned by
10541 `scm_make_smob_type'.
10542
10543 *** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
10544 Make VALUE contain a smob instance of the type with type code TC and
10545 smob data DATA. VALUE must be previously declared as C type `SCM'.
10546
10547 *** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
10548 This macro expands to a block of code that creates a smob instance
10549 of the type with type code TC and smob data DATA, and returns that
10550 `SCM' value. It should be the last piece of code in a block.
10551
10552 ** The interfaces for using I/O ports and implementing port types
10553 (ptobs) have changed significantly. The new interface is based on
10554 shared access to buffers and a new set of ptob procedures.
10555
10556 *** scm_newptob has been removed
10557
10558 It is replaced by:
10559
10560 *** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
10561
10562 - Function: SCM scm_make_port_type (char *type_name,
10563 int (*fill_buffer) (SCM port),
10564 void (*write_flush) (SCM port));
10565
10566 Similarly to the new smob interface, there is a set of function
10567 setters by which the user can customize the behaviour of his port
10568 type. See ports.h (scm_set_port_XXX).
10569
10570 ** scm_strport_to_string: New function: creates a new string from
10571 a string port's buffer.
10572
10573 ** Plug in interface for random number generators
10574 The variable `scm_the_rng' in random.c contains a value and three
10575 function pointers which together define the current random number
10576 generator being used by the Scheme level interface and the random
10577 number library functions.
10578
10579 The user is free to replace the default generator with the generator
10580 of his own choice.
10581
10582 *** Variable: size_t scm_the_rng.rstate_size
10583 The size of the random state type used by the current RNG
10584 measured in chars.
10585
10586 *** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
10587 Given the random STATE, return 32 random bits.
10588
10589 *** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
10590 Seed random state STATE using string S of length N.
10591
10592 *** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
10593 Given random state STATE, return a malloced copy.
10594
10595 ** Default RNG
10596 The default RNG is the MWC (Multiply With Carry) random number
10597 generator described by George Marsaglia at the Department of
10598 Statistics and Supercomputer Computations Research Institute, The
10599 Florida State University (http://stat.fsu.edu/~geo).
10600
10601 It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
10602 passes all tests in the DIEHARD test suite
10603 (http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
10604 costs one multiply and one add on platforms which either supports long
10605 longs (gcc does this on most systems) or have 64 bit longs. The cost
10606 is four multiply on other systems but this can be optimized by writing
10607 scm_i_uniform32 in assembler.
10608
10609 These functions are provided through the scm_the_rng interface for use
10610 by libguile and the application.
10611
10612 *** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
10613 Given the random STATE, return 32 random bits.
10614 Don't use this function directly. Instead go through the plugin
10615 interface (see "Plug in interface" above).
10616
10617 *** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
10618 Initialize STATE using SEED of length N.
10619
10620 *** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
10621 Return a malloc:ed copy of STATE. This function can easily be re-used
10622 in the interfaces to other RNGs.
10623
10624 ** Random number library functions
10625 These functions use the current RNG through the scm_the_rng interface.
10626 It might be a good idea to use these functions from your C code so
10627 that only one random generator is used by all code in your program.
10628
10629 The default random state is stored in:
10630
10631 *** Variable: SCM scm_var_random_state
10632 Contains the vcell of the Scheme variable "*random-state*" which is
10633 used as default state by all random number functions in the Scheme
10634 level interface.
10635
10636 Example:
10637
10638 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
10639
10640 *** Function: scm_rstate *scm_c_default_rstate (void)
10641 This is a convenience function which returns the value of
10642 scm_var_random_state. An error message is generated if this value
10643 isn't a random state.
10644
10645 *** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
10646 Make a new random state from the string SEED of length LENGTH.
10647
10648 It is generally not a good idea to use multiple random states in a
10649 program. While subsequent random numbers generated from one random
10650 state are guaranteed to be reasonably independent, there is no such
10651 guarantee for numbers generated from different random states.
10652
10653 *** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
10654 Return 32 random bits.
10655
10656 *** Function: double scm_c_uniform01 (scm_rstate *STATE)
10657 Return a sample from the uniform(0,1) distribution.
10658
10659 *** Function: double scm_c_normal01 (scm_rstate *STATE)
10660 Return a sample from the normal(0,1) distribution.
10661
10662 *** Function: double scm_c_exp1 (scm_rstate *STATE)
10663 Return a sample from the exp(1) distribution.
10664
10665 *** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
10666 Return a sample from the discrete uniform(0,M) distribution.
10667
10668 *** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
10669 Return a sample from the discrete uniform(0,M) distribution.
10670 M must be a bignum object. The returned value may be an INUM.
10671
10672
10673
10674 Changes in Guile 1.3 (released Monday, October 19, 1998):
10675
10676 * Changes to the distribution
10677
10678 ** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
10679 To avoid conflicts, programs should name environment variables after
10680 themselves, except when there's a common practice establishing some
10681 other convention.
10682
10683 For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
10684 giving the former precedence, and printing a warning message if the
10685 latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
10686
10687 ** The header files related to multi-byte characters have been removed.
10688 They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
10689 which referred to these explicitly will probably need to be rewritten,
10690 since the support for the variant string types has been removed; see
10691 below.
10692
10693 ** The header files append.h and sequences.h have been removed. These
10694 files implemented non-R4RS operations which would encourage
10695 non-portable programming style and less easy-to-read code.
10696
10697 * Changes to the stand-alone interpreter
10698
10699 ** New procedures have been added to implement a "batch mode":
10700
10701 *** Function: batch-mode?
10702
10703 Returns a boolean indicating whether the interpreter is in batch
10704 mode.
10705
10706 *** Function: set-batch-mode?! ARG
10707
10708 If ARG is true, switches the interpreter to batch mode. The `#f'
10709 case has not been implemented.
10710
10711 ** Guile now provides full command-line editing, when run interactively.
10712 To use this feature, you must have the readline library installed.
10713 The Guile build process will notice it, and automatically include
10714 support for it.
10715
10716 The readline library is available via anonymous FTP from any GNU
10717 mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
10718
10719 ** the-last-stack is now a fluid.
10720
10721 * Changes to the procedure for linking libguile with your programs
10722
10723 ** You can now use the `guile-config' utility to build programs that use Guile.
10724
10725 Guile now includes a command-line utility called `guile-config', which
10726 can provide information about how to compile and link programs that
10727 use Guile.
10728
10729 *** `guile-config compile' prints any C compiler flags needed to use Guile.
10730 You should include this command's output on the command line you use
10731 to compile C or C++ code that #includes the Guile header files. It's
10732 usually just a `-I' flag to help the compiler find the Guile headers.
10733
10734
10735 *** `guile-config link' prints any linker flags necessary to link with Guile.
10736
10737 This command writes to its standard output a list of flags which you
10738 must pass to the linker to link your code against the Guile library.
10739 The flags include '-lguile' itself, any other libraries the Guile
10740 library depends upon, and any `-L' flags needed to help the linker
10741 find those libraries.
10742
10743 For example, here is a Makefile rule that builds a program named 'foo'
10744 from the object files ${FOO_OBJECTS}, and links them against Guile:
10745
10746 foo: ${FOO_OBJECTS}
10747 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
10748
10749 Previous Guile releases recommended that you use autoconf to detect
10750 which of a predefined set of libraries were present on your system.
10751 It is more robust to use `guile-config', since it records exactly which
10752 libraries the installed Guile library requires.
10753
10754 This was originally called `build-guile', but was renamed to
10755 `guile-config' before Guile 1.3 was released, to be consistent with
10756 the analogous script for the GTK+ GUI toolkit, which is called
10757 `gtk-config'.
10758
10759
10760 ** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
10761
10762 If you are using the GNU autoconf package to configure your program,
10763 you can use the GUILE_FLAGS autoconf macro to call `guile-config'
10764 (described above) and gather the necessary values for use in your
10765 Makefiles.
10766
10767 The GUILE_FLAGS macro expands to configure script code which runs the
10768 `guile-config' script, to find out where Guile's header files and
10769 libraries are installed. It sets two variables, marked for
10770 substitution, as by AC_SUBST.
10771
10772 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
10773 code that uses Guile header files. This is almost always just a
10774 -I flag.
10775
10776 GUILE_LDFLAGS --- flags to pass to the linker to link a
10777 program against Guile. This includes `-lguile' for the Guile
10778 library itself, any libraries that Guile itself requires (like
10779 -lqthreads), and so on. It may also include a -L flag to tell the
10780 compiler where to find the libraries.
10781
10782 GUILE_FLAGS is defined in the file guile.m4, in the top-level
10783 directory of the Guile distribution. You can copy it into your
10784 package's aclocal.m4 file, and then use it in your configure.in file.
10785
10786 If you are using the `aclocal' program, distributed with GNU automake,
10787 to maintain your aclocal.m4 file, the Guile installation process
10788 installs guile.m4 where aclocal will find it. All you need to do is
10789 use GUILE_FLAGS in your configure.in file, and then run `aclocal';
10790 this will copy the definition of GUILE_FLAGS into your aclocal.m4
10791 file.
10792
10793
10794 * Changes to Scheme functions and syntax
10795
10796 ** Multi-byte strings have been removed, as have multi-byte and wide
10797 ports. We felt that these were the wrong approach to
10798 internationalization support.
10799
10800 ** New function: readline [PROMPT]
10801 Read a line from the terminal, and allow the user to edit it,
10802 prompting with PROMPT. READLINE provides a large set of Emacs-like
10803 editing commands, lets the user recall previously typed lines, and
10804 works on almost every kind of terminal, including dumb terminals.
10805
10806 READLINE assumes that the cursor is at the beginning of the line when
10807 it is invoked. Thus, you can't print a prompt yourself, and then call
10808 READLINE; you need to package up your prompt as a string, pass it to
10809 the function, and let READLINE print the prompt itself. This is
10810 because READLINE needs to know the prompt's screen width.
10811
10812 For Guile to provide this function, you must have the readline
10813 library, version 2.1 or later, installed on your system. Readline is
10814 available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
10815 any GNU mirror site.
10816
10817 See also ADD-HISTORY function.
10818
10819 ** New function: add-history STRING
10820 Add STRING as the most recent line in the history used by the READLINE
10821 command. READLINE does not add lines to the history itself; you must
10822 call ADD-HISTORY to make previous input available to the user.
10823
10824 ** The behavior of the read-line function has changed.
10825
10826 This function now uses standard C library functions to read the line,
10827 for speed. This means that it doesn not respect the value of
10828 scm-line-incrementors; it assumes that lines are delimited with
10829 #\newline.
10830
10831 (Note that this is read-line, the function that reads a line of text
10832 from a port, not readline, the function that reads a line from a
10833 terminal, providing full editing capabilities.)
10834
10835 ** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
10836
10837 This module provides some simple argument parsing. It exports one
10838 function:
10839
10840 Function: getopt-gnu-style ARG-LS
10841 Parse a list of program arguments into an alist of option
10842 descriptions.
10843
10844 Each item in the list of program arguments is examined to see if
10845 it meets the syntax of a GNU long-named option. An argument like
10846 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
10847 returned alist, where MUMBLE is a keyword object with the same
10848 name as the argument. An argument like `--MUMBLE=FROB' produces
10849 an element of the form (MUMBLE . FROB), where FROB is a string.
10850
10851 As a special case, the returned alist also contains a pair whose
10852 car is the symbol `rest'. The cdr of this pair is a list
10853 containing all the items in the argument list that are not options
10854 of the form mentioned above.
10855
10856 The argument `--' is treated specially: all items in the argument
10857 list appearing after such an argument are not examined, and are
10858 returned in the special `rest' list.
10859
10860 This function does not parse normal single-character switches.
10861 You will need to parse them out of the `rest' list yourself.
10862
10863 ** The read syntax for byte vectors and short vectors has changed.
10864
10865 Instead of #bytes(...), write #y(...).
10866
10867 Instead of #short(...), write #h(...).
10868
10869 This may seem nutty, but, like the other uniform vectors, byte vectors
10870 and short vectors want to have the same print and read syntax (and,
10871 more basic, want to have read syntax!). Changing the read syntax to
10872 use multiple characters after the hash sign breaks with the
10873 conventions used in R5RS and the conventions used for the other
10874 uniform vectors. It also introduces complexity in the current reader,
10875 both on the C and Scheme levels. (The Right solution is probably to
10876 change the syntax and prototypes for uniform vectors entirely.)
10877
10878
10879 ** The new module (ice-9 session) provides useful interactive functions.
10880
10881 *** New procedure: (apropos REGEXP OPTION ...)
10882
10883 Display a list of top-level variables whose names match REGEXP, and
10884 the modules they are imported from. Each OPTION should be one of the
10885 following symbols:
10886
10887 value --- Show the value of each matching variable.
10888 shadow --- Show bindings shadowed by subsequently imported modules.
10889 full --- Same as both `shadow' and `value'.
10890
10891 For example:
10892
10893 guile> (apropos "trace" 'full)
10894 debug: trace #<procedure trace args>
10895 debug: untrace #<procedure untrace args>
10896 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
10897 the-scm-module: before-backtrace-hook ()
10898 the-scm-module: backtrace #<primitive-procedure backtrace>
10899 the-scm-module: after-backtrace-hook ()
10900 the-scm-module: has-shown-backtrace-hint? #f
10901 guile>
10902
10903 ** There are new functions and syntax for working with macros.
10904
10905 Guile implements macros as a special object type. Any variable whose
10906 top-level binding is a macro object acts as a macro. The macro object
10907 specifies how the expression should be transformed before evaluation.
10908
10909 *** Macro objects now print in a reasonable way, resembling procedures.
10910
10911 *** New function: (macro? OBJ)
10912 True iff OBJ is a macro object.
10913
10914 *** New function: (primitive-macro? OBJ)
10915 Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
10916 macro transformers, implemented in eval.c rather than Scheme code.
10917
10918 Why do we have this function?
10919 - For symmetry with procedure? and primitive-procedure?,
10920 - to allow custom print procedures to tell whether a macro is
10921 primitive, and display it differently, and
10922 - to allow compilers and user-written evaluators to distinguish
10923 builtin special forms from user-defined ones, which could be
10924 compiled.
10925
10926 *** New function: (macro-type OBJ)
10927 Return a value indicating what kind of macro OBJ is. Possible return
10928 values are:
10929
10930 The symbol `syntax' --- a macro created by procedure->syntax.
10931 The symbol `macro' --- a macro created by procedure->macro.
10932 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
10933 The boolean #f --- if OBJ is not a macro object.
10934
10935 *** New function: (macro-name MACRO)
10936 Return the name of the macro object MACRO's procedure, as returned by
10937 procedure-name.
10938
10939 *** New function: (macro-transformer MACRO)
10940 Return the transformer procedure for MACRO.
10941
10942 *** New syntax: (use-syntax MODULE ... TRANSFORMER)
10943
10944 Specify a new macro expander to use in the current module. Each
10945 MODULE is a module name, with the same meaning as in the `use-modules'
10946 form; each named module's exported bindings are added to the current
10947 top-level environment. TRANSFORMER is an expression evaluated in the
10948 resulting environment which must yield a procedure to use as the
10949 module's eval transformer: every expression evaluated in this module
10950 is passed to this function, and the result passed to the Guile
10951 interpreter.
10952
10953 *** macro-eval! is removed. Use local-eval instead.
10954
10955 ** Some magic has been added to the printer to better handle user
10956 written printing routines (like record printers, closure printers).
10957
10958 The problem is that these user written routines must have access to
10959 the current `print-state' to be able to handle fancy things like
10960 detection of circular references. These print-states have to be
10961 passed to the builtin printing routines (display, write, etc) to
10962 properly continue the print chain.
10963
10964 We didn't want to change all existing print code so that it
10965 explicitly passes thru a print state in addition to a port. Instead,
10966 we extented the possible values that the builtin printing routines
10967 accept as a `port'. In addition to a normal port, they now also take
10968 a pair of a normal port and a print-state. Printing will go to the
10969 port and the print-state will be used to control the detection of
10970 circular references, etc. If the builtin function does not care for a
10971 print-state, it is simply ignored.
10972
10973 User written callbacks are now called with such a pair as their
10974 `port', but because every function now accepts this pair as a PORT
10975 argument, you don't have to worry about that. In fact, it is probably
10976 safest to not check for these pairs.
10977
10978 However, it is sometimes necessary to continue a print chain on a
10979 different port, for example to get a intermediate string
10980 representation of the printed value, mangle that string somehow, and
10981 then to finally print the mangled string. Use the new function
10982
10983 inherit-print-state OLD-PORT NEW-PORT
10984
10985 for this. It constructs a new `port' that prints to NEW-PORT but
10986 inherits the print-state of OLD-PORT.
10987
10988 ** struct-vtable-offset renamed to vtable-offset-user
10989
10990 ** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
10991
10992 ** There is now a third optional argument to make-vtable-vtable
10993 (and fourth to make-struct) when constructing new types (vtables).
10994 This argument initializes field vtable-index-printer of the vtable.
10995
10996 ** The detection of circular references has been extended to structs.
10997 That is, a structure that -- in the process of being printed -- prints
10998 itself does not lead to infinite recursion.
10999
11000 ** There is now some basic support for fluids. Please read
11001 "libguile/fluid.h" to find out more. It is accessible from Scheme with
11002 the following functions and macros:
11003
11004 Function: make-fluid
11005
11006 Create a new fluid object. Fluids are not special variables or
11007 some other extension to the semantics of Scheme, but rather
11008 ordinary Scheme objects. You can store them into variables (that
11009 are still lexically scoped, of course) or into any other place you
11010 like. Every fluid has a initial value of `#f'.
11011
11012 Function: fluid? OBJ
11013
11014 Test whether OBJ is a fluid.
11015
11016 Function: fluid-ref FLUID
11017 Function: fluid-set! FLUID VAL
11018
11019 Access/modify the fluid FLUID. Modifications are only visible
11020 within the current dynamic root (that includes threads).
11021
11022 Function: with-fluids* FLUIDS VALUES THUNK
11023
11024 FLUIDS is a list of fluids and VALUES a corresponding list of
11025 values for these fluids. Before THUNK gets called the values are
11026 installed in the fluids and the old values of the fluids are
11027 saved in the VALUES list. When the flow of control leaves THUNK
11028 or reenters it, the values get swapped again. You might think of
11029 this as a `safe-fluid-excursion'. Note that the VALUES list is
11030 modified by `with-fluids*'.
11031
11032 Macro: with-fluids ((FLUID VALUE) ...) FORM ...
11033
11034 The same as `with-fluids*' but with a different syntax. It looks
11035 just like `let', but both FLUID and VALUE are evaluated. Remember,
11036 fluids are not special variables but ordinary objects. FLUID
11037 should evaluate to a fluid.
11038
11039 ** Changes to system call interfaces:
11040
11041 *** close-port, close-input-port and close-output-port now return a
11042 boolean instead of an `unspecified' object. #t means that the port
11043 was successfully closed, while #f means it was already closed. It is
11044 also now possible for these procedures to raise an exception if an
11045 error occurs (some errors from write can be delayed until close.)
11046
11047 *** the first argument to chmod, fcntl, ftell and fseek can now be a
11048 file descriptor.
11049
11050 *** the third argument to fcntl is now optional.
11051
11052 *** the first argument to chown can now be a file descriptor or a port.
11053
11054 *** the argument to stat can now be a port.
11055
11056 *** The following new procedures have been added (most use scsh
11057 interfaces):
11058
11059 *** procedure: close PORT/FD
11060 Similar to close-port (*note close-port: Closing Ports.), but also
11061 works on file descriptors. A side effect of closing a file
11062 descriptor is that any ports using that file descriptor are moved
11063 to a different file descriptor and have their revealed counts set
11064 to zero.
11065
11066 *** procedure: port->fdes PORT
11067 Returns the integer file descriptor underlying PORT. As a side
11068 effect the revealed count of PORT is incremented.
11069
11070 *** procedure: fdes->ports FDES
11071 Returns a list of existing ports which have FDES as an underlying
11072 file descriptor, without changing their revealed counts.
11073
11074 *** procedure: fdes->inport FDES
11075 Returns an existing input port which has FDES as its underlying
11076 file descriptor, if one exists, and increments its revealed count.
11077 Otherwise, returns a new input port with a revealed count of 1.
11078
11079 *** procedure: fdes->outport FDES
11080 Returns an existing output port which has FDES as its underlying
11081 file descriptor, if one exists, and increments its revealed count.
11082 Otherwise, returns a new output port with a revealed count of 1.
11083
11084 The next group of procedures perform a `dup2' system call, if NEWFD
11085 (an integer) is supplied, otherwise a `dup'. The file descriptor to be
11086 duplicated can be supplied as an integer or contained in a port. The
11087 type of value returned varies depending on which procedure is used.
11088
11089 All procedures also have the side effect when performing `dup2' that
11090 any ports using NEWFD are moved to a different file descriptor and have
11091 their revealed counts set to zero.
11092
11093 *** procedure: dup->fdes PORT/FD [NEWFD]
11094 Returns an integer file descriptor.
11095
11096 *** procedure: dup->inport PORT/FD [NEWFD]
11097 Returns a new input port using the new file descriptor.
11098
11099 *** procedure: dup->outport PORT/FD [NEWFD]
11100 Returns a new output port using the new file descriptor.
11101
11102 *** procedure: dup PORT/FD [NEWFD]
11103 Returns a new port if PORT/FD is a port, with the same mode as the
11104 supplied port, otherwise returns an integer file descriptor.
11105
11106 *** procedure: dup->port PORT/FD MODE [NEWFD]
11107 Returns a new port using the new file descriptor. MODE supplies a
11108 mode string for the port (*note open-file: File Ports.).
11109
11110 *** procedure: setenv NAME VALUE
11111 Modifies the environment of the current process, which is also the
11112 default environment inherited by child processes.
11113
11114 If VALUE is `#f', then NAME is removed from the environment.
11115 Otherwise, the string NAME=VALUE is added to the environment,
11116 replacing any existing string with name matching NAME.
11117
11118 The return value is unspecified.
11119
11120 *** procedure: truncate-file OBJ SIZE
11121 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
11122 can be a string containing a file name or an integer file
11123 descriptor or port open for output on the file. The underlying
11124 system calls are `truncate' and `ftruncate'.
11125
11126 The return value is unspecified.
11127
11128 *** procedure: setvbuf PORT MODE [SIZE]
11129 Set the buffering mode for PORT. MODE can be:
11130 `_IONBF'
11131 non-buffered
11132
11133 `_IOLBF'
11134 line buffered
11135
11136 `_IOFBF'
11137 block buffered, using a newly allocated buffer of SIZE bytes.
11138 However if SIZE is zero or unspecified, the port will be made
11139 non-buffered.
11140
11141 This procedure should not be used after I/O has been performed with
11142 the port.
11143
11144 Ports are usually block buffered by default, with a default buffer
11145 size. Procedures e.g., *Note open-file: File Ports, which accept a
11146 mode string allow `0' to be added to request an unbuffered port.
11147
11148 *** procedure: fsync PORT/FD
11149 Copies any unwritten data for the specified output file descriptor
11150 to disk. If PORT/FD is a port, its buffer is flushed before the
11151 underlying file descriptor is fsync'd. The return value is
11152 unspecified.
11153
11154 *** procedure: open-fdes PATH FLAGS [MODES]
11155 Similar to `open' but returns a file descriptor instead of a port.
11156
11157 *** procedure: execle PATH ENV [ARG] ...
11158 Similar to `execl', but the environment of the new process is
11159 specified by ENV, which must be a list of strings as returned by
11160 the `environ' procedure.
11161
11162 This procedure is currently implemented using the `execve' system
11163 call, but we call it `execle' because of its Scheme calling
11164 interface.
11165
11166 *** procedure: strerror ERRNO
11167 Returns the Unix error message corresponding to ERRNO, an integer.
11168
11169 *** procedure: primitive-exit [STATUS]
11170 Terminate the current process without unwinding the Scheme stack.
11171 This is would typically be useful after a fork. The exit status
11172 is STATUS if supplied, otherwise zero.
11173
11174 *** procedure: times
11175 Returns an object with information about real and processor time.
11176 The following procedures accept such an object as an argument and
11177 return a selected component:
11178
11179 `tms:clock'
11180 The current real time, expressed as time units relative to an
11181 arbitrary base.
11182
11183 `tms:utime'
11184 The CPU time units used by the calling process.
11185
11186 `tms:stime'
11187 The CPU time units used by the system on behalf of the
11188 calling process.
11189
11190 `tms:cutime'
11191 The CPU time units used by terminated child processes of the
11192 calling process, whose status has been collected (e.g., using
11193 `waitpid').
11194
11195 `tms:cstime'
11196 Similarly, the CPU times units used by the system on behalf of
11197 terminated child processes.
11198
11199 ** Removed: list-length
11200 ** Removed: list-append, list-append!
11201 ** Removed: list-reverse, list-reverse!
11202
11203 ** array-map renamed to array-map!
11204
11205 ** serial-array-map renamed to serial-array-map!
11206
11207 ** catch doesn't take #f as first argument any longer
11208
11209 Previously, it was possible to pass #f instead of a key to `catch'.
11210 That would cause `catch' to pass a jump buffer object to the procedure
11211 passed as second argument. The procedure could then use this jump
11212 buffer objekt as an argument to throw.
11213
11214 This mechanism has been removed since its utility doesn't motivate the
11215 extra complexity it introduces.
11216
11217 ** The `#/' notation for lists now provokes a warning message from Guile.
11218 This syntax will be removed from Guile in the near future.
11219
11220 To disable the warning message, set the GUILE_HUSH environment
11221 variable to any non-empty value.
11222
11223 ** The newline character now prints as `#\newline', following the
11224 normal Scheme notation, not `#\nl'.
11225
11226 * Changes to the gh_ interface
11227
11228 ** The gh_enter function now takes care of loading the Guile startup files.
11229 gh_enter works by calling scm_boot_guile; see the remarks below.
11230
11231 ** Function: void gh_write (SCM x)
11232
11233 Write the printed representation of the scheme object x to the current
11234 output port. Corresponds to the scheme level `write'.
11235
11236 ** gh_list_length renamed to gh_length.
11237
11238 ** vector handling routines
11239
11240 Several major changes. In particular, gh_vector() now resembles
11241 (vector ...) (with a caveat -- see manual), and gh_make_vector() now
11242 exists and behaves like (make-vector ...). gh_vset() and gh_vref()
11243 have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
11244 vector-related gh_ functions have been implemented.
11245
11246 ** pair and list routines
11247
11248 Implemented several of the R4RS pair and list functions that were
11249 missing.
11250
11251 ** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
11252
11253 New function. Converts double arrays back and forth between Scheme
11254 and C.
11255
11256 * Changes to the scm_ interface
11257
11258 ** The function scm_boot_guile now takes care of loading the startup files.
11259
11260 Guile's primary initialization function, scm_boot_guile, now takes
11261 care of loading `boot-9.scm', in the `ice-9' module, to initialize
11262 Guile, define the module system, and put together some standard
11263 bindings. It also loads `init.scm', which is intended to hold
11264 site-specific initialization code.
11265
11266 Since Guile cannot operate properly until boot-9.scm is loaded, there
11267 is no reason to separate loading boot-9.scm from Guile's other
11268 initialization processes.
11269
11270 This job used to be done by scm_compile_shell_switches, which didn't
11271 make much sense; in particular, it meant that people using Guile for
11272 non-shell-like applications had to jump through hoops to get Guile
11273 initialized properly.
11274
11275 ** The function scm_compile_shell_switches no longer loads the startup files.
11276 Now, Guile always loads the startup files, whenever it is initialized;
11277 see the notes above for scm_boot_guile and scm_load_startup_files.
11278
11279 ** Function: scm_load_startup_files
11280 This new function takes care of loading Guile's initialization file
11281 (`boot-9.scm'), and the site initialization file, `init.scm'. Since
11282 this is always called by the Guile initialization process, it's
11283 probably not too useful to call this yourself, but it's there anyway.
11284
11285 ** The semantics of smob marking have changed slightly.
11286
11287 The smob marking function (the `mark' member of the scm_smobfuns
11288 structure) is no longer responsible for setting the mark bit on the
11289 smob. The generic smob handling code in the garbage collector will
11290 set this bit. The mark function need only ensure that any other
11291 objects the smob refers to get marked.
11292
11293 Note that this change means that the smob's GC8MARK bit is typically
11294 already set upon entry to the mark function. Thus, marking functions
11295 which look like this:
11296
11297 {
11298 if (SCM_GC8MARKP (ptr))
11299 return SCM_BOOL_F;
11300 SCM_SETGC8MARK (ptr);
11301 ... mark objects to which the smob refers ...
11302 }
11303
11304 are now incorrect, since they will return early, and fail to mark any
11305 other objects the smob refers to. Some code in the Guile library used
11306 to work this way.
11307
11308 ** The semantics of the I/O port functions in scm_ptobfuns have changed.
11309
11310 If you have implemented your own I/O port type, by writing the
11311 functions required by the scm_ptobfuns and then calling scm_newptob,
11312 you will need to change your functions slightly.
11313
11314 The functions in a scm_ptobfuns structure now expect the port itself
11315 as their argument; they used to expect the `stream' member of the
11316 port's scm_port_table structure. This allows functions in an
11317 scm_ptobfuns structure to easily access the port's cell (and any flags
11318 it its CAR), and the port's scm_port_table structure.
11319
11320 Guile now passes the I/O port itself as the `port' argument in the
11321 following scm_ptobfuns functions:
11322
11323 int (*free) (SCM port);
11324 int (*fputc) (int, SCM port);
11325 int (*fputs) (char *, SCM port);
11326 scm_sizet (*fwrite) SCM_P ((char *ptr,
11327 scm_sizet size,
11328 scm_sizet nitems,
11329 SCM port));
11330 int (*fflush) (SCM port);
11331 int (*fgetc) (SCM port);
11332 int (*fclose) (SCM port);
11333
11334 The interfaces to the `mark', `print', `equalp', and `fgets' methods
11335 are unchanged.
11336
11337 If you have existing code which defines its own port types, it is easy
11338 to convert your code to the new interface; simply apply SCM_STREAM to
11339 the port argument to yield the value you code used to expect.
11340
11341 Note that since both the port and the stream have the same type in the
11342 C code --- they are both SCM values --- the C compiler will not remind
11343 you if you forget to update your scm_ptobfuns functions.
11344
11345
11346 ** Function: int scm_internal_select (int fds,
11347 SELECT_TYPE *rfds,
11348 SELECT_TYPE *wfds,
11349 SELECT_TYPE *efds,
11350 struct timeval *timeout);
11351
11352 This is a replacement for the `select' function provided by the OS.
11353 It enables I/O blocking and sleeping to happen for one cooperative
11354 thread without blocking other threads. It also avoids busy-loops in
11355 these situations. It is intended that all I/O blocking and sleeping
11356 will finally go through this function. Currently, this function is
11357 only available on systems providing `gettimeofday' and `select'.
11358
11359 ** Function: SCM scm_internal_stack_catch (SCM tag,
11360 scm_catch_body_t body,
11361 void *body_data,
11362 scm_catch_handler_t handler,
11363 void *handler_data)
11364
11365 A new sibling to the other two C level `catch' functions
11366 scm_internal_catch and scm_internal_lazy_catch. Use it if you want
11367 the stack to be saved automatically into the variable `the-last-stack'
11368 (scm_the_last_stack_var) on error. This is necessary if you want to
11369 use advanced error reporting, such as calling scm_display_error and
11370 scm_display_backtrace. (They both take a stack object as argument.)
11371
11372 ** Function: SCM scm_spawn_thread (scm_catch_body_t body,
11373 void *body_data,
11374 scm_catch_handler_t handler,
11375 void *handler_data)
11376
11377 Spawns a new thread. It does a job similar to
11378 scm_call_with_new_thread but takes arguments more suitable when
11379 spawning threads from application C code.
11380
11381 ** The hook scm_error_callback has been removed. It was originally
11382 intended as a way for the user to install his own error handler. But
11383 that method works badly since it intervenes between throw and catch,
11384 thereby changing the semantics of expressions like (catch #t ...).
11385 The correct way to do it is to use one of the C level catch functions
11386 in throw.c: scm_internal_catch/lazy_catch/stack_catch.
11387
11388 ** Removed functions:
11389
11390 scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
11391 scm_list_reverse, scm_list_reverse_x
11392
11393 ** New macros: SCM_LISTn where n is one of the integers 0-9.
11394
11395 These can be used for pretty list creation from C. The idea is taken
11396 from Erick Gallesio's STk.
11397
11398 ** scm_array_map renamed to scm_array_map_x
11399
11400 ** mbstrings are now removed
11401
11402 This means that the type codes scm_tc7_mb_string and
11403 scm_tc7_mb_substring has been removed.
11404
11405 ** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
11406
11407 Since we no longer support multi-byte strings, these I/O functions
11408 have been simplified, and renamed. Here are their old names, and
11409 their new names and arguments:
11410
11411 scm_gen_putc -> void scm_putc (int c, SCM port);
11412 scm_gen_puts -> void scm_puts (char *s, SCM port);
11413 scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
11414 scm_gen_getc -> void scm_getc (SCM port);
11415
11416
11417 ** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
11418
11419 ** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
11420
11421 SCM_TYP7S now masks away the bit which distinguishes substrings from
11422 strings.
11423
11424 ** scm_catch_body_t: Backward incompatible change!
11425
11426 Body functions to scm_internal_catch and friends do not any longer
11427 take a second argument. This is because it is no longer possible to
11428 pass a #f arg to catch.
11429
11430 ** Calls to scm_protect_object and scm_unprotect now nest properly.
11431
11432 The function scm_protect_object protects its argument from being freed
11433 by the garbage collector. scm_unprotect_object removes that
11434 protection.
11435
11436 These functions now nest properly. That is, for every object O, there
11437 is a counter which scm_protect_object(O) increments and
11438 scm_unprotect_object(O) decrements, if the counter is greater than
11439 zero. Every object's counter is zero when it is first created. If an
11440 object's counter is greater than zero, the garbage collector will not
11441 reclaim its storage.
11442
11443 This allows you to use scm_protect_object in your code without
11444 worrying that some other function you call will call
11445 scm_unprotect_object, and allow it to be freed. Assuming that the
11446 functions you call are well-behaved, and unprotect only those objects
11447 they protect, you can follow the same rule and have confidence that
11448 objects will be freed only at appropriate times.
11449
11450
11451 Changes in Guile 1.2 (released Tuesday, June 24 1997):
11452
11453 * Changes to the distribution
11454
11455 ** Nightly snapshots are now available from ftp.red-bean.com.
11456 The old server, ftp.cyclic.com, has been relinquished to its rightful
11457 owner.
11458
11459 Nightly snapshots of the Guile development sources are now available via
11460 anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
11461
11462 Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
11463 For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
11464
11465 ** To run Guile without installing it, the procedure has changed a bit.
11466
11467 If you used a separate build directory to compile Guile, you'll need
11468 to include the build directory in SCHEME_LOAD_PATH, as well as the
11469 source directory. See the `INSTALL' file for examples.
11470
11471 * Changes to the procedure for linking libguile with your programs
11472
11473 ** The standard Guile load path for Scheme code now includes
11474 $(datadir)/guile (usually /usr/local/share/guile). This means that
11475 you can install your own Scheme files there, and Guile will find them.
11476 (Previous versions of Guile only checked a directory whose name
11477 contained the Guile version number, so you had to re-install or move
11478 your Scheme sources each time you installed a fresh version of Guile.)
11479
11480 The load path also includes $(datadir)/guile/site; we recommend
11481 putting individual Scheme files there. If you want to install a
11482 package with multiple source files, create a directory for them under
11483 $(datadir)/guile.
11484
11485 ** Guile 1.2 will now use the Rx regular expression library, if it is
11486 installed on your system. When you are linking libguile into your own
11487 programs, this means you will have to link against -lguile, -lqt (if
11488 you configured Guile with thread support), and -lrx.
11489
11490 If you are using autoconf to generate configuration scripts for your
11491 application, the following lines should suffice to add the appropriate
11492 libraries to your link command:
11493
11494 ### Find Rx, quickthreads and libguile.
11495 AC_CHECK_LIB(rx, main)
11496 AC_CHECK_LIB(qt, main)
11497 AC_CHECK_LIB(guile, scm_shell)
11498
11499 The Guile 1.2 distribution does not contain sources for the Rx
11500 library, as Guile 1.0 did. If you want to use Rx, you'll need to
11501 retrieve it from a GNU FTP site and install it separately.
11502
11503 * Changes to Scheme functions and syntax
11504
11505 ** The dynamic linking features of Guile are now enabled by default.
11506 You can disable them by giving the `--disable-dynamic-linking' option
11507 to configure.
11508
11509 (dynamic-link FILENAME)
11510
11511 Find the object file denoted by FILENAME (a string) and link it
11512 into the running Guile application. When everything works out,
11513 return a Scheme object suitable for representing the linked object
11514 file. Otherwise an error is thrown. How object files are
11515 searched is system dependent.
11516
11517 (dynamic-object? VAL)
11518
11519 Determine whether VAL represents a dynamically linked object file.
11520
11521 (dynamic-unlink DYNOBJ)
11522
11523 Unlink the indicated object file from the application. DYNOBJ
11524 should be one of the values returned by `dynamic-link'.
11525
11526 (dynamic-func FUNCTION DYNOBJ)
11527
11528 Search the C function indicated by FUNCTION (a string or symbol)
11529 in DYNOBJ and return some Scheme object that can later be used
11530 with `dynamic-call' to actually call this function. Right now,
11531 these Scheme objects are formed by casting the address of the
11532 function to `long' and converting this number to its Scheme
11533 representation.
11534
11535 (dynamic-call FUNCTION DYNOBJ)
11536
11537 Call the C function indicated by FUNCTION and DYNOBJ. The
11538 function is passed no arguments and its return value is ignored.
11539 When FUNCTION is something returned by `dynamic-func', call that
11540 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
11541 etc.), look it up in DYNOBJ; this is equivalent to
11542
11543 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
11544
11545 Interrupts are deferred while the C function is executing (with
11546 SCM_DEFER_INTS/SCM_ALLOW_INTS).
11547
11548 (dynamic-args-call FUNCTION DYNOBJ ARGS)
11549
11550 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
11551 some arguments and return its return value. The C function is
11552 expected to take two arguments and return an `int', just like
11553 `main':
11554
11555 int c_func (int argc, char **argv);
11556
11557 ARGS must be a list of strings and is converted into an array of
11558 `char *'. The array is passed in ARGV and its size in ARGC. The
11559 return value is converted to a Scheme number and returned from the
11560 call to `dynamic-args-call'.
11561
11562 When dynamic linking is disabled or not supported on your system,
11563 the above functions throw errors, but they are still available.
11564
11565 Here is a small example that works on GNU/Linux:
11566
11567 (define libc-obj (dynamic-link "libc.so"))
11568 (dynamic-args-call 'rand libc-obj '())
11569
11570 See the file `libguile/DYNAMIC-LINKING' for additional comments.
11571
11572 ** The #/ syntax for module names is depreciated, and will be removed
11573 in a future version of Guile. Instead of
11574
11575 #/foo/bar/baz
11576
11577 instead write
11578
11579 (foo bar baz)
11580
11581 The latter syntax is more consistent with existing Lisp practice.
11582
11583 ** Guile now does fancier printing of structures. Structures are the
11584 underlying implementation for records, which in turn are used to
11585 implement modules, so all of these object now print differently and in
11586 a more informative way.
11587
11588 The Scheme printer will examine the builtin variable *struct-printer*
11589 whenever it needs to print a structure object. When this variable is
11590 not `#f' it is deemed to be a procedure and will be applied to the
11591 structure object and the output port. When *struct-printer* is `#f'
11592 or the procedure return `#f' the structure object will be printed in
11593 the boring #<struct 80458270> form.
11594
11595 This hook is used by some routines in ice-9/boot-9.scm to implement
11596 type specific printing routines. Please read the comments there about
11597 "printing structs".
11598
11599 One of the more specific uses of structs are records. The printing
11600 procedure that could be passed to MAKE-RECORD-TYPE is now actually
11601 called. It should behave like a *struct-printer* procedure (described
11602 above).
11603
11604 ** Guile now supports a new R4RS-compliant syntax for keywords. A
11605 token of the form #:NAME, where NAME has the same syntax as a Scheme
11606 symbol, is the external representation of the keyword named NAME.
11607 Keyword objects print using this syntax as well, so values containing
11608 keyword objects can be read back into Guile. When used in an
11609 expression, keywords are self-quoting objects.
11610
11611 Guile suports this read syntax, and uses this print syntax, regardless
11612 of the current setting of the `keyword' read option. The `keyword'
11613 read option only controls whether Guile recognizes the `:NAME' syntax,
11614 which is incompatible with R4RS. (R4RS says such token represent
11615 symbols.)
11616
11617 ** Guile has regular expression support again. Guile 1.0 included
11618 functions for matching regular expressions, based on the Rx library.
11619 In Guile 1.1, the Guile/Rx interface was removed to simplify the
11620 distribution, and thus Guile had no regular expression support. Guile
11621 1.2 again supports the most commonly used functions, and supports all
11622 of SCSH's regular expression functions.
11623
11624 If your system does not include a POSIX regular expression library,
11625 and you have not linked Guile with a third-party regexp library such as
11626 Rx, these functions will not be available. You can tell whether your
11627 Guile installation includes regular expression support by checking
11628 whether the `*features*' list includes the `regex' symbol.
11629
11630 *** regexp functions
11631
11632 By default, Guile supports POSIX extended regular expressions. That
11633 means that the characters `(', `)', `+' and `?' are special, and must
11634 be escaped if you wish to match the literal characters.
11635
11636 This regular expression interface was modeled after that implemented
11637 by SCSH, the Scheme Shell. It is intended to be upwardly compatible
11638 with SCSH regular expressions.
11639
11640 **** Function: string-match PATTERN STR [START]
11641 Compile the string PATTERN into a regular expression and compare
11642 it with STR. The optional numeric argument START specifies the
11643 position of STR at which to begin matching.
11644
11645 `string-match' returns a "match structure" which describes what,
11646 if anything, was matched by the regular expression. *Note Match
11647 Structures::. If STR does not match PATTERN at all,
11648 `string-match' returns `#f'.
11649
11650 Each time `string-match' is called, it must compile its PATTERN
11651 argument into a regular expression structure. This operation is
11652 expensive, which makes `string-match' inefficient if the same regular
11653 expression is used several times (for example, in a loop). For better
11654 performance, you can compile a regular expression in advance and then
11655 match strings against the compiled regexp.
11656
11657 **** Function: make-regexp STR [FLAGS]
11658 Compile the regular expression described by STR, and return the
11659 compiled regexp structure. If STR does not describe a legal
11660 regular expression, `make-regexp' throws a
11661 `regular-expression-syntax' error.
11662
11663 FLAGS may be the bitwise-or of one or more of the following:
11664
11665 **** Constant: regexp/extended
11666 Use POSIX Extended Regular Expression syntax when interpreting
11667 STR. If not set, POSIX Basic Regular Expression syntax is used.
11668 If the FLAGS argument is omitted, we assume regexp/extended.
11669
11670 **** Constant: regexp/icase
11671 Do not differentiate case. Subsequent searches using the
11672 returned regular expression will be case insensitive.
11673
11674 **** Constant: regexp/newline
11675 Match-any-character operators don't match a newline.
11676
11677 A non-matching list ([^...]) not containing a newline matches a
11678 newline.
11679
11680 Match-beginning-of-line operator (^) matches the empty string
11681 immediately after a newline, regardless of whether the FLAGS
11682 passed to regexp-exec contain regexp/notbol.
11683
11684 Match-end-of-line operator ($) matches the empty string
11685 immediately before a newline, regardless of whether the FLAGS
11686 passed to regexp-exec contain regexp/noteol.
11687
11688 **** Function: regexp-exec REGEXP STR [START [FLAGS]]
11689 Match the compiled regular expression REGEXP against `str'. If
11690 the optional integer START argument is provided, begin matching
11691 from that position in the string. Return a match structure
11692 describing the results of the match, or `#f' if no match could be
11693 found.
11694
11695 FLAGS may be the bitwise-or of one or more of the following:
11696
11697 **** Constant: regexp/notbol
11698 The match-beginning-of-line operator always fails to match (but
11699 see the compilation flag regexp/newline above) This flag may be
11700 used when different portions of a string are passed to
11701 regexp-exec and the beginning of the string should not be
11702 interpreted as the beginning of the line.
11703
11704 **** Constant: regexp/noteol
11705 The match-end-of-line operator always fails to match (but see the
11706 compilation flag regexp/newline above)
11707
11708 **** Function: regexp? OBJ
11709 Return `#t' if OBJ is a compiled regular expression, or `#f'
11710 otherwise.
11711
11712 Regular expressions are commonly used to find patterns in one string
11713 and replace them with the contents of another string.
11714
11715 **** Function: regexp-substitute PORT MATCH [ITEM...]
11716 Write to the output port PORT selected contents of the match
11717 structure MATCH. Each ITEM specifies what should be written, and
11718 may be one of the following arguments:
11719
11720 * A string. String arguments are written out verbatim.
11721
11722 * An integer. The submatch with that number is written.
11723
11724 * The symbol `pre'. The portion of the matched string preceding
11725 the regexp match is written.
11726
11727 * The symbol `post'. The portion of the matched string
11728 following the regexp match is written.
11729
11730 PORT may be `#f', in which case nothing is written; instead,
11731 `regexp-substitute' constructs a string from the specified ITEMs
11732 and returns that.
11733
11734 **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
11735 Similar to `regexp-substitute', but can be used to perform global
11736 substitutions on STR. Instead of taking a match structure as an
11737 argument, `regexp-substitute/global' takes two string arguments: a
11738 REGEXP string describing a regular expression, and a TARGET string
11739 which should be matched against this regular expression.
11740
11741 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
11742 exceptions:
11743
11744 * A function may be supplied. When this function is called, it
11745 will be passed one argument: a match structure for a given
11746 regular expression match. It should return a string to be
11747 written out to PORT.
11748
11749 * The `post' symbol causes `regexp-substitute/global' to recurse
11750 on the unmatched portion of STR. This *must* be supplied in
11751 order to perform global search-and-replace on STR; if it is
11752 not present among the ITEMs, then `regexp-substitute/global'
11753 will return after processing a single match.
11754
11755 *** Match Structures
11756
11757 A "match structure" is the object returned by `string-match' and
11758 `regexp-exec'. It describes which portion of a string, if any, matched
11759 the given regular expression. Match structures include: a reference to
11760 the string that was checked for matches; the starting and ending
11761 positions of the regexp match; and, if the regexp included any
11762 parenthesized subexpressions, the starting and ending positions of each
11763 submatch.
11764
11765 In each of the regexp match functions described below, the `match'
11766 argument must be a match structure returned by a previous call to
11767 `string-match' or `regexp-exec'. Most of these functions return some
11768 information about the original target string that was matched against a
11769 regular expression; we will call that string TARGET for easy reference.
11770
11771 **** Function: regexp-match? OBJ
11772 Return `#t' if OBJ is a match structure returned by a previous
11773 call to `regexp-exec', or `#f' otherwise.
11774
11775 **** Function: match:substring MATCH [N]
11776 Return the portion of TARGET matched by subexpression number N.
11777 Submatch 0 (the default) represents the entire regexp match. If
11778 the regular expression as a whole matched, but the subexpression
11779 number N did not match, return `#f'.
11780
11781 **** Function: match:start MATCH [N]
11782 Return the starting position of submatch number N.
11783
11784 **** Function: match:end MATCH [N]
11785 Return the ending position of submatch number N.
11786
11787 **** Function: match:prefix MATCH
11788 Return the unmatched portion of TARGET preceding the regexp match.
11789
11790 **** Function: match:suffix MATCH
11791 Return the unmatched portion of TARGET following the regexp match.
11792
11793 **** Function: match:count MATCH
11794 Return the number of parenthesized subexpressions from MATCH.
11795 Note that the entire regular expression match itself counts as a
11796 subexpression, and failed submatches are included in the count.
11797
11798 **** Function: match:string MATCH
11799 Return the original TARGET string.
11800
11801 *** Backslash Escapes
11802
11803 Sometimes you will want a regexp to match characters like `*' or `$'
11804 exactly. For example, to check whether a particular string represents
11805 a menu entry from an Info node, it would be useful to match it against
11806 a regexp like `^* [^:]*::'. However, this won't work; because the
11807 asterisk is a metacharacter, it won't match the `*' at the beginning of
11808 the string. In this case, we want to make the first asterisk un-magic.
11809
11810 You can do this by preceding the metacharacter with a backslash
11811 character `\'. (This is also called "quoting" the metacharacter, and
11812 is known as a "backslash escape".) When Guile sees a backslash in a
11813 regular expression, it considers the following glyph to be an ordinary
11814 character, no matter what special meaning it would ordinarily have.
11815 Therefore, we can make the above example work by changing the regexp to
11816 `^\* [^:]*::'. The `\*' sequence tells the regular expression engine
11817 to match only a single asterisk in the target string.
11818
11819 Since the backslash is itself a metacharacter, you may force a
11820 regexp to match a backslash in the target string by preceding the
11821 backslash with itself. For example, to find variable references in a
11822 TeX program, you might want to find occurrences of the string `\let\'
11823 followed by any number of alphabetic characters. The regular expression
11824 `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
11825 each match a single backslash in the target string.
11826
11827 **** Function: regexp-quote STR
11828 Quote each special character found in STR with a backslash, and
11829 return the resulting string.
11830
11831 *Very important:* Using backslash escapes in Guile source code (as
11832 in Emacs Lisp or C) can be tricky, because the backslash character has
11833 special meaning for the Guile reader. For example, if Guile encounters
11834 the character sequence `\n' in the middle of a string while processing
11835 Scheme code, it replaces those characters with a newline character.
11836 Similarly, the character sequence `\t' is replaced by a horizontal tab.
11837 Several of these "escape sequences" are processed by the Guile reader
11838 before your code is executed. Unrecognized escape sequences are
11839 ignored: if the characters `\*' appear in a string, they will be
11840 translated to the single character `*'.
11841
11842 This translation is obviously undesirable for regular expressions,
11843 since we want to be able to include backslashes in a string in order to
11844 escape regexp metacharacters. Therefore, to make sure that a backslash
11845 is preserved in a string in your Guile program, you must use *two*
11846 consecutive backslashes:
11847
11848 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
11849
11850 The string in this example is preprocessed by the Guile reader before
11851 any code is executed. The resulting argument to `make-regexp' is the
11852 string `^\* [^:]*', which is what we really want.
11853
11854 This also means that in order to write a regular expression that
11855 matches a single backslash character, the regular expression string in
11856 the source code must include *four* backslashes. Each consecutive pair
11857 of backslashes gets translated by the Guile reader to a single
11858 backslash, and the resulting double-backslash is interpreted by the
11859 regexp engine as matching a single backslash character. Hence:
11860
11861 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
11862
11863 The reason for the unwieldiness of this syntax is historical. Both
11864 regular expression pattern matchers and Unix string processing systems
11865 have traditionally used backslashes with the special meanings described
11866 above. The POSIX regular expression specification and ANSI C standard
11867 both require these semantics. Attempting to abandon either convention
11868 would cause other kinds of compatibility problems, possibly more severe
11869 ones. Therefore, without extending the Scheme reader to support
11870 strings with different quoting conventions (an ungainly and confusing
11871 extension when implemented in other languages), we must adhere to this
11872 cumbersome escape syntax.
11873
11874 * Changes to the gh_ interface
11875
11876 * Changes to the scm_ interface
11877
11878 * Changes to system call interfaces:
11879
11880 ** The value returned by `raise' is now unspecified. It throws an exception
11881 if an error occurs.
11882
11883 *** A new procedure `sigaction' can be used to install signal handlers
11884
11885 (sigaction signum [action] [flags])
11886
11887 signum is the signal number, which can be specified using the value
11888 of SIGINT etc.
11889
11890 If action is omitted, sigaction returns a pair: the CAR is the current
11891 signal hander, which will be either an integer with the value SIG_DFL
11892 (default action) or SIG_IGN (ignore), or the Scheme procedure which
11893 handles the signal, or #f if a non-Scheme procedure handles the
11894 signal. The CDR contains the current sigaction flags for the handler.
11895
11896 If action is provided, it is installed as the new handler for signum.
11897 action can be a Scheme procedure taking one argument, or the value of
11898 SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
11899 whatever signal handler was installed before sigaction was first used.
11900 Flags can optionally be specified for the new handler (SA_RESTART is
11901 always used if the system provides it, so need not be specified.) The
11902 return value is a pair with information about the old handler as
11903 described above.
11904
11905 This interface does not provide access to the "signal blocking"
11906 facility. Maybe this is not needed, since the thread support may
11907 provide solutions to the problem of consistent access to data
11908 structures.
11909
11910 *** A new procedure `flush-all-ports' is equivalent to running
11911 `force-output' on every port open for output.
11912
11913 ** Guile now provides information on how it was built, via the new
11914 global variable, %guile-build-info. This variable records the values
11915 of the standard GNU makefile directory variables as an assocation
11916 list, mapping variable names (symbols) onto directory paths (strings).
11917 For example, to find out where the Guile link libraries were
11918 installed, you can say:
11919
11920 guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
11921
11922
11923 * Changes to the scm_ interface
11924
11925 ** The new function scm_handle_by_message_noexit is just like the
11926 existing scm_handle_by_message function, except that it doesn't call
11927 exit to terminate the process. Instead, it prints a message and just
11928 returns #f. This might be a more appropriate catch-all handler for
11929 new dynamic roots and threads.
11930
11931
11932 Changes in Guile 1.1 (released Friday, May 16 1997):
11933
11934 * Changes to the distribution.
11935
11936 The Guile 1.0 distribution has been split up into several smaller
11937 pieces:
11938 guile-core --- the Guile interpreter itself.
11939 guile-tcltk --- the interface between the Guile interpreter and
11940 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
11941 is a toolkit for building graphical user interfaces.
11942 guile-rgx-ctax --- the interface between Guile and the Rx regular
11943 expression matcher, and the translator for the Ctax
11944 programming language. These are packaged together because the
11945 Ctax translator uses Rx to parse Ctax source code.
11946
11947 This NEWS file describes the changes made to guile-core since the 1.0
11948 release.
11949
11950 We no longer distribute the documentation, since it was either out of
11951 date, or incomplete. As soon as we have current documentation, we
11952 will distribute it.
11953
11954
11955
11956 * Changes to the stand-alone interpreter
11957
11958 ** guile now accepts command-line arguments compatible with SCSH, Olin
11959 Shivers' Scheme Shell.
11960
11961 In general, arguments are evaluated from left to right, but there are
11962 exceptions. The following switches stop argument processing, and
11963 stash all remaining command-line arguments as the value returned by
11964 the (command-line) function.
11965 -s SCRIPT load Scheme source code from FILE, and exit
11966 -c EXPR evalute Scheme expression EXPR, and exit
11967 -- stop scanning arguments; run interactively
11968
11969 The switches below are processed as they are encountered.
11970 -l FILE load Scheme source code from FILE
11971 -e FUNCTION after reading script, apply FUNCTION to
11972 command line arguments
11973 -ds do -s script at this point
11974 --emacs enable Emacs protocol (experimental)
11975 -h, --help display this help and exit
11976 -v, --version display version information and exit
11977 \ read arguments from following script lines
11978
11979 So, for example, here is a Guile script named `ekko' (thanks, Olin)
11980 which re-implements the traditional "echo" command:
11981
11982 #!/usr/local/bin/guile -s
11983 !#
11984 (define (main args)
11985 (map (lambda (arg) (display arg) (display " "))
11986 (cdr args))
11987 (newline))
11988
11989 (main (command-line))
11990
11991 Suppose we invoke this script as follows:
11992
11993 ekko a speckled gecko
11994
11995 Through the magic of Unix script processing (triggered by the `#!'
11996 token at the top of the file), /usr/local/bin/guile receives the
11997 following list of command-line arguments:
11998
11999 ("-s" "./ekko" "a" "speckled" "gecko")
12000
12001 Unix inserts the name of the script after the argument specified on
12002 the first line of the file (in this case, "-s"), and then follows that
12003 with the arguments given to the script. Guile loads the script, which
12004 defines the `main' function, and then applies it to the list of
12005 remaining command-line arguments, ("a" "speckled" "gecko").
12006
12007 In Unix, the first line of a script file must take the following form:
12008
12009 #!INTERPRETER ARGUMENT
12010
12011 where INTERPRETER is the absolute filename of the interpreter
12012 executable, and ARGUMENT is a single command-line argument to pass to
12013 the interpreter.
12014
12015 You may only pass one argument to the interpreter, and its length is
12016 limited. These restrictions can be annoying to work around, so Guile
12017 provides a general mechanism (borrowed from, and compatible with,
12018 SCSH) for circumventing them.
12019
12020 If the ARGUMENT in a Guile script is a single backslash character,
12021 `\', Guile will open the script file, parse arguments from its second
12022 and subsequent lines, and replace the `\' with them. So, for example,
12023 here is another implementation of the `ekko' script:
12024
12025 #!/usr/local/bin/guile \
12026 -e main -s
12027 !#
12028 (define (main args)
12029 (for-each (lambda (arg) (display arg) (display " "))
12030 (cdr args))
12031 (newline))
12032
12033 If the user invokes this script as follows:
12034
12035 ekko a speckled gecko
12036
12037 Unix expands this into
12038
12039 /usr/local/bin/guile \ ekko a speckled gecko
12040
12041 When Guile sees the `\' argument, it replaces it with the arguments
12042 read from the second line of the script, producing:
12043
12044 /usr/local/bin/guile -e main -s ekko a speckled gecko
12045
12046 This tells Guile to load the `ekko' script, and apply the function
12047 `main' to the argument list ("a" "speckled" "gecko").
12048
12049 Here is how Guile parses the command-line arguments:
12050 - Each space character terminates an argument. This means that two
12051 spaces in a row introduce an empty-string argument.
12052 - The tab character is not permitted (unless you quote it with the
12053 backslash character, as described below), to avoid confusion.
12054 - The newline character terminates the sequence of arguments, and will
12055 also terminate a final non-empty argument. (However, a newline
12056 following a space will not introduce a final empty-string argument;
12057 it only terminates the argument list.)
12058 - The backslash character is the escape character. It escapes
12059 backslash, space, tab, and newline. The ANSI C escape sequences
12060 like \n and \t are also supported. These produce argument
12061 constituents; the two-character combination \n doesn't act like a
12062 terminating newline. The escape sequence \NNN for exactly three
12063 octal digits reads as the character whose ASCII code is NNN. As
12064 above, characters produced this way are argument constituents.
12065 Backslash followed by other characters is not allowed.
12066
12067 * Changes to the procedure for linking libguile with your programs
12068
12069 ** Guile now builds and installs a shared guile library, if your
12070 system support shared libraries. (It still builds a static library on
12071 all systems.) Guile automatically detects whether your system
12072 supports shared libraries. To prevent Guile from buildisg shared
12073 libraries, pass the `--disable-shared' flag to the configure script.
12074
12075 Guile takes longer to compile when it builds shared libraries, because
12076 it must compile every file twice --- once to produce position-
12077 independent object code, and once to produce normal object code.
12078
12079 ** The libthreads library has been merged into libguile.
12080
12081 To link a program against Guile, you now need only link against
12082 -lguile and -lqt; -lthreads is no longer needed. If you are using
12083 autoconf to generate configuration scripts for your application, the
12084 following lines should suffice to add the appropriate libraries to
12085 your link command:
12086
12087 ### Find quickthreads and libguile.
12088 AC_CHECK_LIB(qt, main)
12089 AC_CHECK_LIB(guile, scm_shell)
12090
12091 * Changes to Scheme functions
12092
12093 ** Guile Scheme's special syntax for keyword objects is now optional,
12094 and disabled by default.
12095
12096 The syntax variation from R4RS made it difficult to port some
12097 interesting packages to Guile. The routines which accepted keyword
12098 arguments (mostly in the module system) have been modified to also
12099 accept symbols whose names begin with `:'.
12100
12101 To change the keyword syntax, you must first import the (ice-9 debug)
12102 module:
12103 (use-modules (ice-9 debug))
12104
12105 Then you can enable the keyword syntax as follows:
12106 (read-set! keywords 'prefix)
12107
12108 To disable keyword syntax, do this:
12109 (read-set! keywords #f)
12110
12111 ** Many more primitive functions accept shared substrings as
12112 arguments. In the past, these functions required normal, mutable
12113 strings as arguments, although they never made use of this
12114 restriction.
12115
12116 ** The uniform array functions now operate on byte vectors. These
12117 functions are `array-fill!', `serial-array-copy!', `array-copy!',
12118 `serial-array-map', `array-map', `array-for-each', and
12119 `array-index-map!'.
12120
12121 ** The new functions `trace' and `untrace' implement simple debugging
12122 support for Scheme functions.
12123
12124 The `trace' function accepts any number of procedures as arguments,
12125 and tells the Guile interpreter to display each procedure's name and
12126 arguments each time the procedure is invoked. When invoked with no
12127 arguments, `trace' returns the list of procedures currently being
12128 traced.
12129
12130 The `untrace' function accepts any number of procedures as arguments,
12131 and tells the Guile interpreter not to trace them any more. When
12132 invoked with no arguments, `untrace' untraces all curretly traced
12133 procedures.
12134
12135 The tracing in Guile has an advantage over most other systems: we
12136 don't create new procedure objects, but mark the procedure objects
12137 themselves. This means that anonymous and internal procedures can be
12138 traced.
12139
12140 ** The function `assert-repl-prompt' has been renamed to
12141 `set-repl-prompt!'. It takes one argument, PROMPT.
12142 - If PROMPT is #f, the Guile read-eval-print loop will not prompt.
12143 - If PROMPT is a string, we use it as a prompt.
12144 - If PROMPT is a procedure accepting no arguments, we call it, and
12145 display the result as a prompt.
12146 - Otherwise, we display "> ".
12147
12148 ** The new function `eval-string' reads Scheme expressions from a
12149 string and evaluates them, returning the value of the last expression
12150 in the string. If the string contains no expressions, it returns an
12151 unspecified value.
12152
12153 ** The new function `thunk?' returns true iff its argument is a
12154 procedure of zero arguments.
12155
12156 ** `defined?' is now a builtin function, instead of syntax. This
12157 means that its argument should be quoted. It returns #t iff its
12158 argument is bound in the current module.
12159
12160 ** The new syntax `use-modules' allows you to add new modules to your
12161 environment without re-typing a complete `define-module' form. It
12162 accepts any number of module names as arguments, and imports their
12163 public bindings into the current module.
12164
12165 ** The new function (module-defined? NAME MODULE) returns true iff
12166 NAME, a symbol, is defined in MODULE, a module object.
12167
12168 ** The new function `builtin-bindings' creates and returns a hash
12169 table containing copies of all the root module's bindings.
12170
12171 ** The new function `builtin-weak-bindings' does the same as
12172 `builtin-bindings', but creates a doubly-weak hash table.
12173
12174 ** The `equal?' function now considers variable objects to be
12175 equivalent if they have the same name and the same value.
12176
12177 ** The new function `command-line' returns the command-line arguments
12178 given to Guile, as a list of strings.
12179
12180 When using guile as a script interpreter, `command-line' returns the
12181 script's arguments; those processed by the interpreter (like `-s' or
12182 `-c') are omitted. (In other words, you get the normal, expected
12183 behavior.) Any application that uses scm_shell to process its
12184 command-line arguments gets this behavior as well.
12185
12186 ** The new function `load-user-init' looks for a file called `.guile'
12187 in the user's home directory, and loads it if it exists. This is
12188 mostly for use by the code generated by scm_compile_shell_switches,
12189 but we thought it might also be useful in other circumstances.
12190
12191 ** The new function `log10' returns the base-10 logarithm of its
12192 argument.
12193
12194 ** Changes to I/O functions
12195
12196 *** The functions `read', `primitive-load', `read-and-eval!', and
12197 `primitive-load-path' no longer take optional arguments controlling
12198 case insensitivity and a `#' parser.
12199
12200 Case sensitivity is now controlled by a read option called
12201 `case-insensitive'. The user can add new `#' syntaxes with the
12202 `read-hash-extend' function (see below).
12203
12204 *** The new function `read-hash-extend' allows the user to change the
12205 syntax of Guile Scheme in a somewhat controlled way.
12206
12207 (read-hash-extend CHAR PROC)
12208 When parsing S-expressions, if we read a `#' character followed by
12209 the character CHAR, use PROC to parse an object from the stream.
12210 If PROC is #f, remove any parsing procedure registered for CHAR.
12211
12212 The reader applies PROC to two arguments: CHAR and an input port.
12213
12214 *** The new functions read-delimited and read-delimited! provide a
12215 general mechanism for doing delimited input on streams.
12216
12217 (read-delimited DELIMS [PORT HANDLE-DELIM])
12218 Read until we encounter one of the characters in DELIMS (a string),
12219 or end-of-file. PORT is the input port to read from; it defaults to
12220 the current input port. The HANDLE-DELIM parameter determines how
12221 the terminating character is handled; it should be one of the
12222 following symbols:
12223
12224 'trim omit delimiter from result
12225 'peek leave delimiter character in input stream
12226 'concat append delimiter character to returned value
12227 'split return a pair: (RESULT . TERMINATOR)
12228
12229 HANDLE-DELIM defaults to 'peek.
12230
12231 (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
12232 A side-effecting variant of `read-delimited'.
12233
12234 The data is written into the string BUF at the indices in the
12235 half-open interval [START, END); the default interval is the whole
12236 string: START = 0 and END = (string-length BUF). The values of
12237 START and END must specify a well-defined interval in BUF, i.e.
12238 0 <= START <= END <= (string-length BUF).
12239
12240 It returns NBYTES, the number of bytes read. If the buffer filled
12241 up without a delimiter character being found, it returns #f. If the
12242 port is at EOF when the read starts, it returns the EOF object.
12243
12244 If an integer is returned (i.e., the read is successfully terminated
12245 by reading a delimiter character), then the HANDLE-DELIM parameter
12246 determines how to handle the terminating character. It is described
12247 above, and defaults to 'peek.
12248
12249 (The descriptions of these functions were borrowed from the SCSH
12250 manual, by Olin Shivers and Brian Carlstrom.)
12251
12252 *** The `%read-delimited!' function is the primitive used to implement
12253 `read-delimited' and `read-delimited!'.
12254
12255 (%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
12256
12257 This returns a pair of values: (TERMINATOR . NUM-READ).
12258 - TERMINATOR describes why the read was terminated. If it is a
12259 character or the eof object, then that is the value that terminated
12260 the read. If it is #f, the function filled the buffer without finding
12261 a delimiting character.
12262 - NUM-READ is the number of characters read into BUF.
12263
12264 If the read is successfully terminated by reading a delimiter
12265 character, then the gobble? parameter determines what to do with the
12266 terminating character. If true, the character is removed from the
12267 input stream; if false, the character is left in the input stream
12268 where a subsequent read operation will retrieve it. In either case,
12269 the character is also the first value returned by the procedure call.
12270
12271 (The descriptions of this function was borrowed from the SCSH manual,
12272 by Olin Shivers and Brian Carlstrom.)
12273
12274 *** The `read-line' and `read-line!' functions have changed; they now
12275 trim the terminator by default; previously they appended it to the
12276 returned string. For the old behavior, use (read-line PORT 'concat).
12277
12278 *** The functions `uniform-array-read!' and `uniform-array-write!' now
12279 take new optional START and END arguments, specifying the region of
12280 the array to read and write.
12281
12282 *** The `ungetc-char-ready?' function has been removed. We feel it's
12283 inappropriate for an interface to expose implementation details this
12284 way.
12285
12286 ** Changes to the Unix library and system call interface
12287
12288 *** The new fcntl function provides access to the Unix `fcntl' system
12289 call.
12290
12291 (fcntl PORT COMMAND VALUE)
12292 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
12293 Values for COMMAND are:
12294
12295 F_DUPFD duplicate a file descriptor
12296 F_GETFD read the descriptor's close-on-exec flag
12297 F_SETFD set the descriptor's close-on-exec flag to VALUE
12298 F_GETFL read the descriptor's flags, as set on open
12299 F_SETFL set the descriptor's flags, as set on open to VALUE
12300 F_GETOWN return the process ID of a socket's owner, for SIGIO
12301 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
12302 FD_CLOEXEC not sure what this is
12303
12304 For details, see the documentation for the fcntl system call.
12305
12306 *** The arguments to `select' have changed, for compatibility with
12307 SCSH. The TIMEOUT parameter may now be non-integral, yielding the
12308 expected behavior. The MILLISECONDS parameter has been changed to
12309 MICROSECONDS, to more closely resemble the underlying system call.
12310 The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
12311 corresponding return set will be the same.
12312
12313 *** The arguments to the `mknod' system call have changed. They are
12314 now:
12315
12316 (mknod PATH TYPE PERMS DEV)
12317 Create a new file (`node') in the file system. PATH is the name of
12318 the file to create. TYPE is the kind of file to create; it should
12319 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
12320 permission bits to give the newly created file. If TYPE is
12321 'block-special or 'char-special, DEV specifies which device the
12322 special file refers to; its interpretation depends on the kind of
12323 special file being created.
12324
12325 *** The `fork' function has been renamed to `primitive-fork', to avoid
12326 clashing with various SCSH forks.
12327
12328 *** The `recv' and `recvfrom' functions have been renamed to `recv!'
12329 and `recvfrom!'. They no longer accept a size for a second argument;
12330 you must pass a string to hold the received value. They no longer
12331 return the buffer. Instead, `recv' returns the length of the message
12332 received, and `recvfrom' returns a pair containing the packet's length
12333 and originating address.
12334
12335 *** The file descriptor datatype has been removed, as have the
12336 `read-fd', `write-fd', `close', `lseek', and `dup' functions.
12337 We plan to replace these functions with a SCSH-compatible interface.
12338
12339 *** The `create' function has been removed; it's just a special case
12340 of `open'.
12341
12342 *** There are new functions to break down process termination status
12343 values. In the descriptions below, STATUS is a value returned by
12344 `waitpid'.
12345
12346 (status:exit-val STATUS)
12347 If the child process exited normally, this function returns the exit
12348 code for the child process (i.e., the value passed to exit, or
12349 returned from main). If the child process did not exit normally,
12350 this function returns #f.
12351
12352 (status:stop-sig STATUS)
12353 If the child process was suspended by a signal, this function
12354 returns the signal that suspended the child. Otherwise, it returns
12355 #f.
12356
12357 (status:term-sig STATUS)
12358 If the child process terminated abnormally, this function returns
12359 the signal that terminated the child. Otherwise, this function
12360 returns false.
12361
12362 POSIX promises that exactly one of these functions will return true on
12363 a valid STATUS value.
12364
12365 These functions are compatible with SCSH.
12366
12367 *** There are new accessors and setters for the broken-out time vectors
12368 returned by `localtime', `gmtime', and that ilk. They are:
12369
12370 Component Accessor Setter
12371 ========================= ============ ============
12372 seconds tm:sec set-tm:sec
12373 minutes tm:min set-tm:min
12374 hours tm:hour set-tm:hour
12375 day of the month tm:mday set-tm:mday
12376 month tm:mon set-tm:mon
12377 year tm:year set-tm:year
12378 day of the week tm:wday set-tm:wday
12379 day in the year tm:yday set-tm:yday
12380 daylight saving time tm:isdst set-tm:isdst
12381 GMT offset, seconds tm:gmtoff set-tm:gmtoff
12382 name of time zone tm:zone set-tm:zone
12383
12384 *** There are new accessors for the vectors returned by `uname',
12385 describing the host system:
12386
12387 Component Accessor
12388 ============================================== ================
12389 name of the operating system implementation utsname:sysname
12390 network name of this machine utsname:nodename
12391 release level of the operating system utsname:release
12392 version level of the operating system utsname:version
12393 machine hardware platform utsname:machine
12394
12395 *** There are new accessors for the vectors returned by `getpw',
12396 `getpwnam', `getpwuid', and `getpwent', describing entries from the
12397 system's user database:
12398
12399 Component Accessor
12400 ====================== =================
12401 user name passwd:name
12402 user password passwd:passwd
12403 user id passwd:uid
12404 group id passwd:gid
12405 real name passwd:gecos
12406 home directory passwd:dir
12407 shell program passwd:shell
12408
12409 *** There are new accessors for the vectors returned by `getgr',
12410 `getgrnam', `getgrgid', and `getgrent', describing entries from the
12411 system's group database:
12412
12413 Component Accessor
12414 ======================= ============
12415 group name group:name
12416 group password group:passwd
12417 group id group:gid
12418 group members group:mem
12419
12420 *** There are new accessors for the vectors returned by `gethost',
12421 `gethostbyaddr', `gethostbyname', and `gethostent', describing
12422 internet hosts:
12423
12424 Component Accessor
12425 ========================= ===============
12426 official name of host hostent:name
12427 alias list hostent:aliases
12428 host address type hostent:addrtype
12429 length of address hostent:length
12430 list of addresses hostent:addr-list
12431
12432 *** There are new accessors for the vectors returned by `getnet',
12433 `getnetbyaddr', `getnetbyname', and `getnetent', describing internet
12434 networks:
12435
12436 Component Accessor
12437 ========================= ===============
12438 official name of net netent:name
12439 alias list netent:aliases
12440 net number type netent:addrtype
12441 net number netent:net
12442
12443 *** There are new accessors for the vectors returned by `getproto',
12444 `getprotobyname', `getprotobynumber', and `getprotoent', describing
12445 internet protocols:
12446
12447 Component Accessor
12448 ========================= ===============
12449 official protocol name protoent:name
12450 alias list protoent:aliases
12451 protocol number protoent:proto
12452
12453 *** There are new accessors for the vectors returned by `getserv',
12454 `getservbyname', `getservbyport', and `getservent', describing
12455 internet protocols:
12456
12457 Component Accessor
12458 ========================= ===============
12459 official service name servent:name
12460 alias list servent:aliases
12461 port number servent:port
12462 protocol to use servent:proto
12463
12464 *** There are new accessors for the sockaddr structures returned by
12465 `accept', `getsockname', `getpeername', `recvfrom!':
12466
12467 Component Accessor
12468 ======================================== ===============
12469 address format (`family') sockaddr:fam
12470 path, for file domain addresses sockaddr:path
12471 address, for internet domain addresses sockaddr:addr
12472 TCP or UDP port, for internet sockaddr:port
12473
12474 *** The `getpwent', `getgrent', `gethostent', `getnetent',
12475 `getprotoent', and `getservent' functions now return #f at the end of
12476 the user database. (They used to throw an exception.)
12477
12478 Note that calling MUMBLEent function is equivalent to calling the
12479 corresponding MUMBLE function with no arguments.
12480
12481 *** The `setpwent', `setgrent', `sethostent', `setnetent',
12482 `setprotoent', and `setservent' routines now take no arguments.
12483
12484 *** The `gethost', `getproto', `getnet', and `getserv' functions now
12485 provide more useful information when they throw an exception.
12486
12487 *** The `lnaof' function has been renamed to `inet-lnaof'.
12488
12489 *** Guile now claims to have the `current-time' feature.
12490
12491 *** The `mktime' function now takes an optional second argument ZONE,
12492 giving the time zone to use for the conversion. ZONE should be a
12493 string, in the same format as expected for the "TZ" environment variable.
12494
12495 *** The `strptime' function now returns a pair (TIME . COUNT), where
12496 TIME is the parsed time as a vector, and COUNT is the number of
12497 characters from the string left unparsed. This function used to
12498 return the remaining characters as a string.
12499
12500 *** The `gettimeofday' function has replaced the old `time+ticks' function.
12501 The return value is now (SECONDS . MICROSECONDS); the fractional
12502 component is no longer expressed in "ticks".
12503
12504 *** The `ticks/sec' constant has been removed, in light of the above change.
12505
12506 * Changes to the gh_ interface
12507
12508 ** gh_eval_str() now returns an SCM object which is the result of the
12509 evaluation
12510
12511 ** gh_scm2str() now copies the Scheme data to a caller-provided C
12512 array
12513
12514 ** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
12515 and returns the array
12516
12517 ** gh_scm2str0() is gone: there is no need to distinguish
12518 null-terminated from non-null-terminated, since gh_scm2newstr() allows
12519 the user to interpret the data both ways.
12520
12521 * Changes to the scm_ interface
12522
12523 ** The new function scm_symbol_value0 provides an easy way to get a
12524 symbol's value from C code:
12525
12526 SCM scm_symbol_value0 (char *NAME)
12527 Return the value of the symbol named by the null-terminated string
12528 NAME in the current module. If the symbol named NAME is unbound in
12529 the current module, return SCM_UNDEFINED.
12530
12531 ** The new function scm_sysintern0 creates new top-level variables,
12532 without assigning them a value.
12533
12534 SCM scm_sysintern0 (char *NAME)
12535 Create a new Scheme top-level variable named NAME. NAME is a
12536 null-terminated string. Return the variable's value cell.
12537
12538 ** The function scm_internal_catch is the guts of catch. It handles
12539 all the mechanics of setting up a catch target, invoking the catch
12540 body, and perhaps invoking the handler if the body does a throw.
12541
12542 The function is designed to be usable from C code, but is general
12543 enough to implement all the semantics Guile Scheme expects from throw.
12544
12545 TAG is the catch tag. Typically, this is a symbol, but this function
12546 doesn't actually care about that.
12547
12548 BODY is a pointer to a C function which runs the body of the catch;
12549 this is the code you can throw from. We call it like this:
12550 BODY (BODY_DATA, JMPBUF)
12551 where:
12552 BODY_DATA is just the BODY_DATA argument we received; we pass it
12553 through to BODY as its first argument. The caller can make
12554 BODY_DATA point to anything useful that BODY might need.
12555 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
12556 which we have just created and initialized.
12557
12558 HANDLER is a pointer to a C function to deal with a throw to TAG,
12559 should one occur. We call it like this:
12560 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
12561 where
12562 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
12563 same idea as BODY_DATA above.
12564 THROWN_TAG is the tag that the user threw to; usually this is
12565 TAG, but it could be something else if TAG was #t (i.e., a
12566 catch-all), or the user threw to a jmpbuf.
12567 THROW_ARGS is the list of arguments the user passed to the THROW
12568 function.
12569
12570 BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
12571 is just a pointer we pass through to HANDLER. We don't actually
12572 use either of those pointers otherwise ourselves. The idea is
12573 that, if our caller wants to communicate something to BODY or
12574 HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
12575 HANDLER can then use. Think of it as a way to make BODY and
12576 HANDLER closures, not just functions; MUMBLE_DATA points to the
12577 enclosed variables.
12578
12579 Of course, it's up to the caller to make sure that any data a
12580 MUMBLE_DATA needs is protected from GC. A common way to do this is
12581 to make MUMBLE_DATA a pointer to data stored in an automatic
12582 structure variable; since the collector must scan the stack for
12583 references anyway, this assures that any references in MUMBLE_DATA
12584 will be found.
12585
12586 ** The new function scm_internal_lazy_catch is exactly like
12587 scm_internal_catch, except:
12588
12589 - It does not unwind the stack (this is the major difference).
12590 - If handler returns, its value is returned from the throw.
12591 - BODY always receives #f as its JMPBUF argument (since there's no
12592 jmpbuf associated with a lazy catch, because we don't unwind the
12593 stack.)
12594
12595 ** scm_body_thunk is a new body function you can pass to
12596 scm_internal_catch if you want the body to be like Scheme's `catch'
12597 --- a thunk, or a function of one argument if the tag is #f.
12598
12599 BODY_DATA is a pointer to a scm_body_thunk_data structure, which
12600 contains the Scheme procedure to invoke as the body, and the tag
12601 we're catching. If the tag is #f, then we pass JMPBUF (created by
12602 scm_internal_catch) to the body procedure; otherwise, the body gets
12603 no arguments.
12604
12605 ** scm_handle_by_proc is a new handler function you can pass to
12606 scm_internal_catch if you want the handler to act like Scheme's catch
12607 --- call a procedure with the tag and the throw arguments.
12608
12609 If the user does a throw to this catch, this function runs a handler
12610 procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
12611 variable holding the Scheme procedure object to invoke. It ought to
12612 be a pointer to an automatic variable (i.e., one living on the stack),
12613 or the procedure object should be otherwise protected from GC.
12614
12615 ** scm_handle_by_message is a new handler function to use with
12616 `scm_internal_catch' if you want Guile to print a message and die.
12617 It's useful for dealing with throws to uncaught keys at the top level.
12618
12619 HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
12620 message header to print; if zero, we use "guile" instead. That
12621 text is followed by a colon, then the message described by ARGS.
12622
12623 ** The return type of scm_boot_guile is now void; the function does
12624 not return a value, and indeed, never returns at all.
12625
12626 ** The new function scm_shell makes it easy for user applications to
12627 process command-line arguments in a way that is compatible with the
12628 stand-alone guile interpreter (which is in turn compatible with SCSH,
12629 the Scheme shell).
12630
12631 To use the scm_shell function, first initialize any guile modules
12632 linked into your application, and then call scm_shell with the values
12633 of ARGC and ARGV your `main' function received. scm_shell will add
12634 any SCSH-style meta-arguments from the top of the script file to the
12635 argument vector, and then process the command-line arguments. This
12636 generally means loading a script file or starting up an interactive
12637 command interpreter. For details, see "Changes to the stand-alone
12638 interpreter" above.
12639
12640 ** The new functions scm_get_meta_args and scm_count_argv help you
12641 implement the SCSH-style meta-argument, `\'.
12642
12643 char **scm_get_meta_args (int ARGC, char **ARGV)
12644 If the second element of ARGV is a string consisting of a single
12645 backslash character (i.e. "\\" in Scheme notation), open the file
12646 named by the following argument, parse arguments from it, and return
12647 the spliced command line. The returned array is terminated by a
12648 null pointer.
12649
12650 For details of argument parsing, see above, under "guile now accepts
12651 command-line arguments compatible with SCSH..."
12652
12653 int scm_count_argv (char **ARGV)
12654 Count the arguments in ARGV, assuming it is terminated by a null
12655 pointer.
12656
12657 For an example of how these functions might be used, see the source
12658 code for the function scm_shell in libguile/script.c.
12659
12660 You will usually want to use scm_shell instead of calling this
12661 function yourself.
12662
12663 ** The new function scm_compile_shell_switches turns an array of
12664 command-line arguments into Scheme code to carry out the actions they
12665 describe. Given ARGC and ARGV, it returns a Scheme expression to
12666 evaluate, and calls scm_set_program_arguments to make any remaining
12667 command-line arguments available to the Scheme code. For example,
12668 given the following arguments:
12669
12670 -e main -s ekko a speckled gecko
12671
12672 scm_set_program_arguments will return the following expression:
12673
12674 (begin (load "ekko") (main (command-line)) (quit))
12675
12676 You will usually want to use scm_shell instead of calling this
12677 function yourself.
12678
12679 ** The function scm_shell_usage prints a usage message appropriate for
12680 an interpreter that uses scm_compile_shell_switches to handle its
12681 command-line arguments.
12682
12683 void scm_shell_usage (int FATAL, char *MESSAGE)
12684 Print a usage message to the standard error output. If MESSAGE is
12685 non-zero, write it before the usage message, followed by a newline.
12686 If FATAL is non-zero, exit the process, using FATAL as the
12687 termination status. (If you want to be compatible with Guile,
12688 always use 1 as the exit status when terminating due to command-line
12689 usage problems.)
12690
12691 You will usually want to use scm_shell instead of calling this
12692 function yourself.
12693
12694 ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
12695 expressions. It used to return SCM_EOL. Earth-shattering.
12696
12697 ** The macros for declaring scheme objects in C code have been
12698 rearranged slightly. They are now:
12699
12700 SCM_SYMBOL (C_NAME, SCHEME_NAME)
12701 Declare a static SCM variable named C_NAME, and initialize it to
12702 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
12703 be a C identifier, and SCHEME_NAME should be a C string.
12704
12705 SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
12706 Just like SCM_SYMBOL, but make C_NAME globally visible.
12707
12708 SCM_VCELL (C_NAME, SCHEME_NAME)
12709 Create a global variable at the Scheme level named SCHEME_NAME.
12710 Declare a static SCM variable named C_NAME, and initialize it to
12711 point to the Scheme variable's value cell.
12712
12713 SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
12714 Just like SCM_VCELL, but make C_NAME globally visible.
12715
12716 The `guile-snarf' script writes initialization code for these macros
12717 to its standard output, given C source code as input.
12718
12719 The SCM_GLOBAL macro is gone.
12720
12721 ** The scm_read_line and scm_read_line_x functions have been replaced
12722 by Scheme code based on the %read-delimited! procedure (known to C
12723 code as scm_read_delimited_x). See its description above for more
12724 information.
12725
12726 ** The function scm_sys_open has been renamed to scm_open. It now
12727 returns a port instead of an FD object.
12728
12729 * The dynamic linking support has changed. For more information, see
12730 libguile/DYNAMIC-LINKING.
12731
12732
12733 Guile 1.0b3
12734
12735 User-visible changes from Thursday, September 5, 1996 until Guile 1.0
12736 (Sun 5 Jan 1997):
12737
12738 * Changes to the 'guile' program:
12739
12740 ** Guile now loads some new files when it starts up. Guile first
12741 searches the load path for init.scm, and loads it if found. Then, if
12742 Guile is not being used to execute a script, and the user's home
12743 directory contains a file named `.guile', Guile loads that.
12744
12745 ** You can now use Guile as a shell script interpreter.
12746
12747 To paraphrase the SCSH manual:
12748
12749 When Unix tries to execute an executable file whose first two
12750 characters are the `#!', it treats the file not as machine code to
12751 be directly executed by the native processor, but as source code
12752 to be executed by some interpreter. The interpreter to use is
12753 specified immediately after the #! sequence on the first line of
12754 the source file. The kernel reads in the name of the interpreter,
12755 and executes that instead. It passes the interpreter the source
12756 filename as its first argument, with the original arguments
12757 following. Consult the Unix man page for the `exec' system call
12758 for more information.
12759
12760 Now you can use Guile as an interpreter, using a mechanism which is a
12761 compatible subset of that provided by SCSH.
12762
12763 Guile now recognizes a '-s' command line switch, whose argument is the
12764 name of a file of Scheme code to load. It also treats the two
12765 characters `#!' as the start of a comment, terminated by `!#'. Thus,
12766 to make a file of Scheme code directly executable by Unix, insert the
12767 following two lines at the top of the file:
12768
12769 #!/usr/local/bin/guile -s
12770 !#
12771
12772 Guile treats the argument of the `-s' command-line switch as the name
12773 of a file of Scheme code to load, and treats the sequence `#!' as the
12774 start of a block comment, terminated by `!#'.
12775
12776 For example, here's a version of 'echo' written in Scheme:
12777
12778 #!/usr/local/bin/guile -s
12779 !#
12780 (let loop ((args (cdr (program-arguments))))
12781 (if (pair? args)
12782 (begin
12783 (display (car args))
12784 (if (pair? (cdr args))
12785 (display " "))
12786 (loop (cdr args)))))
12787 (newline)
12788
12789 Why does `#!' start a block comment terminated by `!#', instead of the
12790 end of the line? That is the notation SCSH uses, and although we
12791 don't yet support the other SCSH features that motivate that choice,
12792 we would like to be backward-compatible with any existing Guile
12793 scripts once we do. Furthermore, if the path to Guile on your system
12794 is too long for your kernel, you can start the script with this
12795 horrible hack:
12796
12797 #!/bin/sh
12798 exec /really/long/path/to/guile -s "$0" ${1+"$@"}
12799 !#
12800
12801 Note that some very old Unix systems don't support the `#!' syntax.
12802
12803
12804 ** You can now run Guile without installing it.
12805
12806 Previous versions of the interactive Guile interpreter (`guile')
12807 couldn't start up unless Guile's Scheme library had been installed;
12808 they used the value of the environment variable `SCHEME_LOAD_PATH'
12809 later on in the startup process, but not to find the startup code
12810 itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
12811 code.
12812
12813 To run Guile without installing it, build it in the normal way, and
12814 then set the environment variable `SCHEME_LOAD_PATH' to a
12815 colon-separated list of directories, including the top-level directory
12816 of the Guile sources. For example, if you unpacked Guile so that the
12817 full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
12818 you might say
12819
12820 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
12821
12822
12823 ** Guile's read-eval-print loop no longer prints #<unspecified>
12824 results. If the user wants to see this, she can evaluate the
12825 expression (assert-repl-print-unspecified #t), perhaps in her startup
12826 file.
12827
12828 ** Guile no longer shows backtraces by default when an error occurs;
12829 however, it does display a message saying how to get one, and how to
12830 request that they be displayed by default. After an error, evaluate
12831 (backtrace)
12832 to see a backtrace, and
12833 (debug-enable 'backtrace)
12834 to see them by default.
12835
12836
12837
12838 * Changes to Guile Scheme:
12839
12840 ** Guile now distinguishes between #f and the empty list.
12841
12842 This is for compatibility with the IEEE standard, the (possibly)
12843 upcoming Revised^5 Report on Scheme, and many extant Scheme
12844 implementations.
12845
12846 Guile used to have #f and '() denote the same object, to make Scheme's
12847 type system more compatible with Emacs Lisp's. However, the change
12848 caused too much trouble for Scheme programmers, and we found another
12849 way to reconcile Emacs Lisp with Scheme that didn't require this.
12850
12851
12852 ** Guile's delq, delv, delete functions, and their destructive
12853 counterparts, delq!, delv!, and delete!, now remove all matching
12854 elements from the list, not just the first. This matches the behavior
12855 of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
12856 functions which inspired them.
12857
12858 I recognize that this change may break code in subtle ways, but it
12859 seems best to make the change before the FSF's first Guile release,
12860 rather than after.
12861
12862
12863 ** The compiled-library-path function has been deleted from libguile.
12864
12865 ** The facilities for loading Scheme source files have changed.
12866
12867 *** The variable %load-path now tells Guile which directories to search
12868 for Scheme code. Its value is a list of strings, each of which names
12869 a directory.
12870
12871 *** The variable %load-extensions now tells Guile which extensions to
12872 try appending to a filename when searching the load path. Its value
12873 is a list of strings. Its default value is ("" ".scm").
12874
12875 *** (%search-load-path FILENAME) searches the directories listed in the
12876 value of the %load-path variable for a Scheme file named FILENAME,
12877 with all the extensions listed in %load-extensions. If it finds a
12878 match, then it returns its full filename. If FILENAME is absolute, it
12879 returns it unchanged. Otherwise, it returns #f.
12880
12881 %search-load-path will not return matches that refer to directories.
12882
12883 *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
12884 uses %seach-load-path to find a file named FILENAME, and loads it if
12885 it finds it. If it can't read FILENAME for any reason, it throws an
12886 error.
12887
12888 The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
12889 `read' function.
12890
12891 *** load uses the same searching semantics as primitive-load.
12892
12893 *** The functions %try-load, try-load-with-path, %load, load-with-path,
12894 basic-try-load-with-path, basic-load-with-path, try-load-module-with-
12895 path, and load-module-with-path have been deleted. The functions
12896 above should serve their purposes.
12897
12898 *** If the value of the variable %load-hook is a procedure,
12899 `primitive-load' applies its value to the name of the file being
12900 loaded (without the load path directory name prepended). If its value
12901 is #f, it is ignored. Otherwise, an error occurs.
12902
12903 This is mostly useful for printing load notification messages.
12904
12905
12906 ** The function `eval!' is no longer accessible from the scheme level.
12907 We can't allow operations which introduce glocs into the scheme level,
12908 because Guile's type system can't handle these as data. Use `eval' or
12909 `read-and-eval!' (see below) as replacement.
12910
12911 ** The new function read-and-eval! reads an expression from PORT,
12912 evaluates it, and returns the result. This is more efficient than
12913 simply calling `read' and `eval', since it is not necessary to make a
12914 copy of the expression for the evaluator to munge.
12915
12916 Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
12917 for the `read' function.
12918
12919
12920 ** The function `int?' has been removed; its definition was identical
12921 to that of `integer?'.
12922
12923 ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
12924 use the R4RS names for these functions.
12925
12926 ** The function object-properties no longer returns the hash handle;
12927 it simply returns the object's property list.
12928
12929 ** Many functions have been changed to throw errors, instead of
12930 returning #f on failure. The point of providing exception handling in
12931 the language is to simplify the logic of user code, but this is less
12932 useful if Guile's primitives don't throw exceptions.
12933
12934 ** The function `fileno' has been renamed from `%fileno'.
12935
12936 ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
12937
12938
12939 * Changes to Guile's C interface:
12940
12941 ** The library's initialization procedure has been simplified.
12942 scm_boot_guile now has the prototype:
12943
12944 void scm_boot_guile (int ARGC,
12945 char **ARGV,
12946 void (*main_func) (),
12947 void *closure);
12948
12949 scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
12950 MAIN_FUNC should do all the work of the program (initializing other
12951 packages, reading user input, etc.) before returning. When MAIN_FUNC
12952 returns, call exit (0); this function never returns. If you want some
12953 other exit value, MAIN_FUNC may call exit itself.
12954
12955 scm_boot_guile arranges for program-arguments to return the strings
12956 given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
12957 scm_set_program_arguments with the final list, so Scheme code will
12958 know which arguments have been processed.
12959
12960 scm_boot_guile establishes a catch-all catch handler which prints an
12961 error message and exits the process. This means that Guile exits in a
12962 coherent way when system errors occur and the user isn't prepared to
12963 handle it. If the user doesn't like this behavior, they can establish
12964 their own universal catcher in MAIN_FUNC to shadow this one.
12965
12966 Why must the caller do all the real work from MAIN_FUNC? The garbage
12967 collector assumes that all local variables of type SCM will be above
12968 scm_boot_guile's stack frame on the stack. If you try to manipulate
12969 SCM values after this function returns, it's the luck of the draw
12970 whether the GC will be able to find the objects you allocate. So,
12971 scm_boot_guile function exits, rather than returning, to discourage
12972 people from making that mistake.
12973
12974 The IN, OUT, and ERR arguments were removed; there are other
12975 convenient ways to override these when desired.
12976
12977 The RESULT argument was deleted; this function should never return.
12978
12979 The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
12980 general.
12981
12982
12983 ** Guile's header files should no longer conflict with your system's
12984 header files.
12985
12986 In order to compile code which #included <libguile.h>, previous
12987 versions of Guile required you to add a directory containing all the
12988 Guile header files to your #include path. This was a problem, since
12989 Guile's header files have names which conflict with many systems'
12990 header files.
12991
12992 Now only <libguile.h> need appear in your #include path; you must
12993 refer to all Guile's other header files as <libguile/mumble.h>.
12994 Guile's installation procedure puts libguile.h in $(includedir), and
12995 the rest in $(includedir)/libguile.
12996
12997
12998 ** Two new C functions, scm_protect_object and scm_unprotect_object,
12999 have been added to the Guile library.
13000
13001 scm_protect_object (OBJ) protects OBJ from the garbage collector.
13002 OBJ will not be freed, even if all other references are dropped,
13003 until someone does scm_unprotect_object (OBJ). Both functions
13004 return OBJ.
13005
13006 Note that calls to scm_protect_object do not nest. You can call
13007 scm_protect_object any number of times on a given object, and the
13008 next call to scm_unprotect_object will unprotect it completely.
13009
13010 Basically, scm_protect_object and scm_unprotect_object just
13011 maintain a list of references to things. Since the GC knows about
13012 this list, all objects it mentions stay alive. scm_protect_object
13013 adds its argument to the list; scm_unprotect_object remove its
13014 argument from the list.
13015
13016
13017 ** scm_eval_0str now returns the value of the last expression
13018 evaluated.
13019
13020 ** The new function scm_read_0str reads an s-expression from a
13021 null-terminated string, and returns it.
13022
13023 ** The new function `scm_stdio_to_port' converts a STDIO file pointer
13024 to a Scheme port object.
13025
13026 ** The new function `scm_set_program_arguments' allows C code to set
13027 the value returned by the Scheme `program-arguments' function.
13028
13029
13030 Older changes:
13031
13032 * Guile no longer includes sophisticated Tcl/Tk support.
13033
13034 The old Tcl/Tk support was unsatisfying to us, because it required the
13035 user to link against the Tcl library, as well as Tk and Guile. The
13036 interface was also un-lispy, in that it preserved Tcl/Tk's practice of
13037 referring to widgets by names, rather than exporting widgets to Scheme
13038 code as a special datatype.
13039
13040 In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
13041 maintainers described some very interesting changes in progress to the
13042 Tcl/Tk internals, which would facilitate clean interfaces between lone
13043 Tk and other interpreters --- even for garbage-collected languages
13044 like Scheme. They expected the new Tk to be publicly available in the
13045 fall of 1996.
13046
13047 Since it seems that Guile might soon have a new, cleaner interface to
13048 lone Tk, and that the old Guile/Tk glue code would probably need to be
13049 completely rewritten, we (Jim Blandy and Richard Stallman) have
13050 decided not to support the old code. We'll spend the time instead on
13051 a good interface to the newer Tk, as soon as it is available.
13052
13053 Until then, gtcltk-lib provides trivial, low-maintenance functionality.
13054
13055
13056 Copyright information:
13057
13058 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
13059
13060 Permission is granted to anyone to make or distribute verbatim copies
13061 of this document as received, in any medium, provided that the
13062 copyright notice and this permission notice are preserved,
13063 thus giving the recipient permission to redistribute in turn.
13064
13065 Permission is granted to distribute modified versions
13066 of this document, or of portions of it,
13067 under the above conditions, provided also that they
13068 carry prominent notices stating who last changed them.
13069
13070
13071 Local variables:
13072 mode: outline
13073 paragraph-separate: "[ ]*$"
13074 end: