Doc updates for srfi-14 character sets
[bpt/guile.git] / NEWS
1 Guile NEWS --- history of user-visible changes.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
3 See the end for copying conditions.
4
5 Please send Guile bug reports to bug-guile@gnu.org.
6
7 \f
8 (During the 1.9 series, we will keep an incremental NEWS for the latest
9 prerelease, and a full NEWS corresponding to 1.8 -> 2.0.)
10
11 Changes in 1.9.3 (since the 1.9.2 prerelease):
12
13 ** SRFI-14 char-sets are modified for Unicode
14
15 The default char-sets are not longer locale dependent and contain
16 characters from the whole Unicode range. There is a new char-set,
17 char-set:designated, which contains all assigned Unicode characters.
18 There is a new debugging function: %char-set-dump.
19
20 ** Character functions operate on Unicode characters
21
22 char-upcase and char-downcase use default Unicode casing rules.
23 Character comparisons such as char<? and char-ci<? are now sorting
24 based on Unicode code points.
25
26 ** Removed deprecated uniform array procedures: scm_make_uve,
27 scm_array_prototype, scm_list_to_uniform_array,
28 scm_dimensions_to_uniform_array, scm_make_ra, scm_shap2ra, scm_cvref,
29 scm_ra_set_contp, scm_aind, scm_raprin1
30
31 These functions have been deprecated since early 2005.
32
33 ** scm_array_p has one argument, not two
34
35 Use of the second argument produced a deprecation warning, so it is
36 unlikely that any code out there actually used this functionality.
37
38 ** Removed deprecated uniform array procedures:
39 dimensions->uniform-array, list->uniform-array, array-prototype
40
41 Instead, use make-typed-array, list->typed-array, or array-type,
42 respectively.
43
44 ** And of course, the usual collection of bugfixes
45
46 Interested users should see the ChangeLog for more information.
47
48 * Changes to Scheme functions and syntax
49
50 ** New readline history functions
51
52 The (ice-9 readline) module now provides add-history, read-history,
53 write-history and clear-history, which wrap the corresponding GNU
54 History library functions.
55
56
57 Changes in 1.9.x (since the 1.8.x series):
58
59 * New modules (see the manual for details)
60
61 ** `(srfi srfi-18)', more sophisticated multithreading support
62 ** `(ice-9 i18n)', internationalization support
63 ** `(rnrs bytevector)', the R6RS bytevector API
64 ** `(rnrs io ports)', a subset of the R6RS I/O port API
65 ** `(system xref)', a cross-referencing facility (FIXME undocumented)
66
67 * Changes to the stand-alone interpreter
68
69 ** Guile now can compile Scheme to bytecode for a custom virtual machine.
70
71 Compiled code loads much faster than Scheme source code, and runs around
72 3 or 4 times as fast, generating much less garbage in the process.
73
74 ** The stack limit is now initialized from the environment.
75
76 If getrlimit(2) is available and a stack limit is set, Guile will set
77 its stack limit to 80% of the rlimit. Otherwise the limit is 160000
78 words, a four-fold increase from the earlier default limit.
79
80 ** New environment variables: GUILE_LOAD_COMPILED_PATH,
81 GUILE_SYSTEM_LOAD_COMPILED_PATH
82
83 GUILE_LOAD_COMPILED_PATH is for compiled files what GUILE_LOAD_PATH is
84 for source files. It is a different path, however, because compiled
85 files are architecture-specific. GUILE_SYSTEM_LOAD_COMPILED_PATH is like
86 GUILE_SYSTEM_PATH.
87
88 ** New read-eval-print loop (REPL) implementation
89
90 Running Guile with no arguments drops the user into the new REPL. While
91 it is self-documenting to an extent, the new REPL has not yet been
92 documented in the manual. This will be fixed before 2.0.
93
94 ** New `guile-tools' commands: `compile', `disassemble'
95
96 Pass the `--help' command-line option to these commands for more
97 information.
98
99 * Changes to Scheme functions and syntax
100
101 ** Procedure removed: `the-environment'
102
103 This procedure was part of the interpreter's execution model, and does
104 not apply to the compiler.
105
106 ** Files loaded with `primitive-load-path' will now be compiled
107 automatically.
108
109 If a compiled .go file corresponding to a .scm file is not found or is
110 not fresh, the .scm file will be compiled on the fly, and the resulting
111 .go file stored away. An advisory note will be printed on the console.
112
113 Note that this mechanism depends on preservation of the .scm and .go
114 modification times; if the .scm or .go files are moved after
115 installation, care should be taken to preserve their original
116 timestamps.
117
118 Autocompiled files will be stored in the $XDG_CACHE_HOME/guile/ccache
119 directory, where $XDG_CACHE_HOME defaults to ~/.cache. This directory
120 will be created if needed.
121
122 To inhibit autocompilation, set the GUILE_AUTO_COMPILE environment
123 variable to 0, or pass --no-autocompile on the Guile command line.
124
125 Note that there is currently a bug here: automatic compilation will
126 sometimes be attempted when it shouldn't.
127
128 For example, the old (lang elisp) modules are meant to be interpreted,
129 not compiled. This bug will be fixed before 2.0. FIXME 2.0: Should say
130 something here about module-transformer called for compile.
131
132 ** New POSIX procedures: `getrlimit' and `setrlimit'
133
134 Note however that the interface of these functions is likely to change
135 in the next prerelease.
136
137 ** New procedure in `(oops goops)': `method-formals'
138
139 ** BUG: (procedure-property func 'arity) does not work on compiled
140 procedures
141
142 This will be fixed one way or another before 2.0.
143
144 ** New procedures in (ice-9 session): `add-value-help-handler!',
145 `remove-value-help-handler!', `add-name-help-handler!'
146 `remove-name-help-handler!', `procedure-arguments',
147
148 The value and name help handlers provide some minimal extensibility to
149 the help interface. Guile-lib's `(texinfo reflection)' uses them, for
150 example, to make stexinfo help documentation available. See those
151 procedures' docstrings for more information.
152
153 `procedure-arguments' describes the arguments that a procedure can take,
154 combining arity and formals. For example:
155
156 (procedure-arguments resolve-interface)
157 => ((required . (name)) (rest . args))
158
159 Additionally, `module-commentary' is now publically exported from
160 `(ice-9 session).
161
162 ** Deprecated: `procedure->memoizing-macro', `procedure->syntax'
163
164 These procedures will not work with syncase expansion, and indeed are
165 not used in the normal course of Guile. They are still used by the old
166 Emacs Lisp support, however.
167
168 ** New language: ECMAScript
169
170 Guile now ships with one other high-level language supported,
171 ECMAScript. The goal is to support all of version 3.1 of the standard,
172 but not all of the libraries are there yet. This support is not yet
173 documented; ask on the mailing list if you are interested.
174
175 ** New language: Brainfuck
176
177 Brainfuck is a toy language that closely models Turing machines. Guile's
178 brainfuck compiler is meant to be an example of implementing other
179 languages. See the manual for details, or
180 http://en.wikipedia.org/wiki/Brainfuck for more information about the
181 Brainfuck language itself.
182
183 ** Defmacros may now have docstrings.
184
185 Indeed, any macro may have a docstring. `object-documentation' from
186 `(ice-9 documentation)' may be used to retrieve the docstring, once you
187 have a macro value -- but see the above note about first-class macros.
188 Docstrings are associated with the syntax transformer procedures.
189
190 ** The psyntax expander now knows how to interpret the @ and @@ special
191 forms.
192
193 ** The psyntax expander is now hygienic with respect to modules.
194
195 Free variables in a macro are scoped in the module that the macro was
196 defined in, not in the module the macro is used in. For example, code
197 like this works now:
198
199 (define-module (foo) #:export (bar))
200 (define (helper x) ...)
201 (define-syntax bar
202 (syntax-rules () ((_ x) (helper x))))
203
204 (define-module (baz) #:use-module (foo))
205 (bar qux)
206
207 It used to be you had to export `helper' from `(foo)' as well.
208 Thankfully, this has been fixed.
209
210 ** New function, `procedure-module'
211
212 While useful on its own, `procedure-module' is used by psyntax on syntax
213 transformers to determine the module in which to scope introduced
214 identifiers.
215
216 ** `eval-case' has been deprecated, and replaced by `eval-when'.
217
218 The semantics of `eval-when' are easier to understand. It is still
219 missing documentation, however.
220
221 ** Guile is now more strict about prohibiting definitions in expression
222 contexts.
223
224 Although previous versions of Guile accepted it, the following
225 expression is not valid, in R5RS or R6RS:
226
227 (if test (define foo 'bar) (define foo 'baz))
228
229 In this specific case, it would be better to do:
230
231 (define foo (if test 'bar 'baz))
232
233 It is certainly possible to circumvent this resriction with e.g.
234 `(module-define! (current-module) 'foo 'baz)'. We would appreciate
235 feedback about this change (a consequence of using psyntax as the
236 default expander), and may choose to revisit this situation before 2.0
237 in response to user feedback.
238
239 ** Defmacros must now produce valid Scheme expressions.
240
241 It used to be that defmacros could unquote in Scheme values, as a way of
242 supporting partial evaluation, and avoiding some hygiene issues. For
243 example:
244
245 (define (helper x) ...)
246 (define-macro (foo bar)
247 `(,helper ,bar))
248
249 Assuming this macro is in the `(baz)' module, the direct translation of
250 this code would be:
251
252 (define (helper x) ...)
253 (define-macro (foo bar)
254 `((@@ (baz) helper) ,bar))
255
256 Of course, one could just use a hygienic macro instead:
257
258 (define-syntax foo
259 (syntax-rules ()
260 ((_ bar) (helper bar))))
261
262 ** Guile's psyntax now supports docstrings and internal definitions.
263
264 The following Scheme is not strictly legal:
265
266 (define (foo)
267 "bar"
268 (define (baz) ...)
269 (baz))
270
271 However its intent is fairly clear. Guile interprets "bar" to be the
272 docstring of `foo', and the definition of `baz' is still in definition
273 context.
274
275 ** Macros need to be defined before their first use.
276
277 It used to be that with lazy memoization, this might work:
278
279 (define (foo x)
280 (ref x))
281 (define-macro (ref x) x)
282 (foo 1) => 1
283
284 But now, the body of `foo' is interpreted to mean a call to the toplevel
285 `ref' function, instead of a macro expansion. The solution is to define
286 macros before code that uses them.
287
288 ** Functions needed by macros at expand-time need to be present at
289 expand-time.
290
291 For example, this code will work at the REPL:
292
293 (define (double-helper x) (* x x))
294 (define-macro (double-literal x) (double-helper x))
295 (double-literal 2) => 4
296
297 But it will not work when a file is compiled, because the definition of
298 `double-helper' is not present at expand-time. The solution is to wrap
299 the definition of `double-helper' in `eval-when':
300
301 (eval-when (load compile eval)
302 (define (double-helper x) (* x x)))
303 (define-macro (double-literal x) (double-helper x))
304 (double-literal 2) => 4
305
306 See the (currently missing) documentation for eval-when for more
307 information.
308
309 ** New variable, %pre-modules-transformer
310
311 Need to document this one some more.
312
313 ** Temporarily removed functions: `macroexpand', `macroexpand-1'
314
315 `macroexpand' will be added back before 2.0. It is unclear how to
316 implement `macroexpand-1' with syntax-case, though PLT Scheme does prove
317 that it is possible.
318
319 ** New reader macros: #' #` #, #,@
320
321 These macros translate, respectively, to `syntax', `quasisyntax',
322 `unsyntax', and `unsyntax-splicing'. See the R6RS for more information.
323 These reader macros may be overridden by `read-hash-extend'.
324
325 ** Incompatible change to #'
326
327 Guile did have a #' hash-extension, by default, which just returned the
328 subsequent datum: #'foo => foo. In the unlikely event that anyone
329 actually used this, this behavior may be reinstated via the
330 `read-hash-extend' mechanism.
331
332 ** Scheme expresssions may be commented out with #;
333
334 #; comments out an entire expression. See SRFI-62 or the R6RS for more
335 information.
336
337 ** `make-stack' with a tail-called procedural narrowing argument no longer
338 works (with compiled procedures)
339
340 It used to be the case that a captured stack could be narrowed to select
341 calls only up to or from a certain procedure, even if that procedure
342 already tail-called another procedure. This was because the debug
343 information from the original procedure was kept on the stack.
344
345 Now with the new compiler, the stack only contains active frames from
346 the current continuation. A narrow to a procedure that is not in the
347 stack will result in an empty stack. To fix this, narrow to a procedure
348 that is active in the current continuation, or narrow to a specific
349 number of stack frames.
350
351 ** backtraces through compiled procedures only show procedures that are
352 active in the current continuation
353
354 Similarly to the previous issue, backtraces in compiled code may be
355 different from backtraces in interpreted code. There are no semantic
356 differences, however. Please mail bug-guile@gnu.org if you see any
357 deficiencies with Guile's backtraces.
358
359 ** syntax-rules and syntax-case macros now propagate source information
360 through to the expanded code
361
362 This should result in better backtraces.
363
364 ** The currying behavior of `define' has been removed.
365
366 Before, `(define ((f a) b) (* a b))' would translate to
367
368 (define f (lambda (a) (lambda (b) (* a b))))
369
370 Now a syntax error is signaled, as this syntax is not supported by
371 default. If there is sufficient demand, this syntax can be supported
372 again by default.
373
374 ** All modules have names now
375
376 Before, you could have anonymous modules: modules without names. Now,
377 because of hygiene and macros, all modules have names. If a module was
378 created without a name, the first time `module-name' is called on it, a
379 fresh name will be lazily generated for it.
380
381 ** Many syntax errors have different texts now
382
383 Syntax errors still throw to the `syntax-error' key, but the arguments
384 are often different now. Perhaps in the future, Guile will switch to
385 using standard SRFI-35 conditions.
386
387 ** Returning multiple values to compiled code will silently truncate the
388 values to the expected number
389
390 For example, the interpreter would raise an error evaluating the form,
391 `(+ (values 1 2) (values 3 4))', because it would see the operands as
392 being two compound "values" objects, to which `+' does not apply.
393
394 The compiler, on the other hand, receives multiple values on the stack,
395 not as a compound object. Given that it must check the number of values
396 anyway, if too many values are provided for a continuation, it chooses
397 to truncate those values, effectively evaluating `(+ 1 3)' instead.
398
399 The idea is that the semantics that the compiler implements is more
400 intuitive, and the use of the interpreter will fade out with time.
401 This behavior is allowed both by the R5RS and the R6RS.
402
403 ** Multiple values in compiled code are not represented by compound
404 objects
405
406 This change may manifest itself in the following situation:
407
408 (let ((val (foo))) (do-something) val)
409
410 In the interpreter, if `foo' returns multiple values, multiple values
411 are produced from the `let' expression. In the compiler, those values
412 are truncated to the first value, and that first value is returned. In
413 the compiler, if `foo' returns no values, an error will be raised, while
414 the interpreter would proceed.
415
416 Both of these behaviors are allowed by R5RS and R6RS. The compiler's
417 behavior is more correct, however. If you wish to preserve a potentially
418 multiply-valued return, you will need to set up a multiple-value
419 continuation, using `call-with-values'.
420
421 ** Defmacros are now implemented in terms of syntax-case.
422
423 The practical ramification of this is that the `defmacro?' predicate has
424 been removed, along with `defmacro-transformer', `macro-table',
425 `xformer-table', `assert-defmacro?!', `set-defmacro-transformer!' and
426 `defmacro:transformer'. This is because defmacros are simply macros. If
427 any of these procedures provided useful facilities to you, we encourage
428 you to contact the Guile developers.
429
430 ** psyntax is now the default expander
431
432 Scheme code is now expanded by default by the psyntax hygienic macro
433 expander. Expansion is performed completely before compilation or
434 interpretation.
435
436 Notably, syntax errors will be signalled before interpretation begins.
437 In the past, many syntax errors were only detected at runtime if the
438 code in question was memoized.
439
440 As part of its expansion, psyntax renames all lexically-bound
441 identifiers. Original identifier names are preserved and given to the
442 compiler, but the interpreter will see the renamed variables, e.g.,
443 `x432' instead of `x'.
444
445 Note that the psyntax that Guile uses is a fork, as Guile already had
446 modules before incompatible modules were added to psyntax -- about 10
447 years ago! Thus there are surely a number of bugs that have been fixed
448 in psyntax since then. If you find one, please notify bug-guile@gnu.org.
449
450 ** syntax-rules and syntax-case are available by default.
451
452 There is no longer any need to import the `(ice-9 syncase)' module
453 (which is now deprecated). The expander may be invoked directly via
454 `sc-expand', though it is normally searched for via the current module
455 transformer.
456
457 Also, the helper routines for syntax-case are available in the default
458 environment as well: `syntax->datum', `datum->syntax',
459 `bound-identifier=?', `free-identifier=?', `generate-temporaries',
460 `identifier?', and `syntax-violation'. See the R6RS for documentation.
461
462 ** Lexical bindings introduced by hygienic macros may not be referenced
463 by nonhygienic macros.
464
465 If a lexical binding is introduced by a hygienic macro, it may not be
466 referenced by a nonhygienic macro. For example, this works:
467
468 (let ()
469 (define-macro (bind-x val body)
470 `(let ((x ,val)) ,body))
471 (define-macro (ref x)
472 x)
473 (bind-x 10 (ref x)))
474
475 But this does not:
476
477 (let ()
478 (define-syntax bind-x
479 (syntax-rules ()
480 ((_ val body) (let ((x val)) body))))
481 (define-macro (ref x)
482 x)
483 (bind-x 10 (ref x)))
484
485 It is not normal to run into this situation with existing code. However,
486 as code is ported over from defmacros to syntax-case, it is possible to
487 run into situations like this. In the future, Guile will probably port
488 its `while' macro to syntax-case, which makes this issue one to know
489 about.
490
491 ** Macros may no longer be referenced as first-class values.
492
493 In the past, you could evaluate e.g. `if', and get its macro value. Now,
494 expanding this form raises a syntax error.
495
496 Macros still /exist/ as first-class values, but they must be
497 /referenced/ via the module system, e.g. `(module-ref (current-module)
498 'if)'.
499
500 This decision may be revisited before the 2.0 release. Feedback welcome
501 to guile-devel@gnu.org (subscription required) or bug-guile@gnu.org (no
502 subscription required).
503
504 ** Unicode characters
505
506 Unicode characters may be entered in octal format via e.g. `#\454', or
507 created via (integer->char 300). A hex external representation will
508 probably be introduced at some point.
509
510 ** Unicode strings
511
512 Internally, strings are now represented either in the `latin-1'
513 encoding, one byte per character, or in UTF-32, with four bytes per
514 character. Strings manage their own allocation, switching if needed.
515
516 Currently no locale conversion is performed. Extended characters may be
517 written in a string using the hexadecimal escapes `\xXX', `\uXXXX', or
518 `\UXXXXXX', for 8-bit, 16-bit, or 24-bit codepoints, respectively.
519
520 ** Global variables `scm_charnames' and `scm_charnums' are removed
521
522 These variables contained the names of control characters and were
523 used when writing characters. While these were global, they were
524 never intended to be public API. They have been replaced with private
525 functions.
526
527 ** EBCDIC support is removed
528
529 There was an EBCDIC compile flag that altered some of the character
530 processing. It appeared that full EBCDIC support was never completed
531 and was unmaintained.
532
533 ** New macro type: syncase-macro
534
535 XXX Need to decide whether to document this for 2.0, probably should:
536 make-syncase-macro, make-extended-syncase-macro, macro-type,
537 syncase-macro-type, syncase-macro-binding
538
539 ** A new `memoize-symbol' evaluator trap has been added.
540
541 This trap can be used for efficiently implementing a Scheme code
542 coverage.
543
544 ** Duplicate bindings among used modules are resolved lazily.
545
546 This slightly improves program startup times.
547
548 ** New thread cancellation and thread cleanup API
549
550 See `cancel-thread', `set-thread-cleanup!', and `thread-cleanup'.
551
552 ** Fix bad interaction between `false-if-exception' and stack-call.
553
554 Exceptions thrown by `false-if-exception' were erronously causing the
555 stack to be saved, causing later errors to show the incorrectly-saved
556 backtrace. This has been fixed.
557
558 ** New global variables: %load-compiled-path, %load-compiled-extensions
559
560 These are analogous to %load-path and %load-extensions.
561
562 ** New procedure, `make-promise'
563
564 `(make-promise (lambda () foo))' is equivalent to `(delay foo)'.
565
566 ** `defined?' may accept a module as its second argument
567
568 Previously it only accepted internal structures from the evaluator.
569
570 ** New entry into %guile-build-info: `ccachedir'
571
572 ** Fix bug in `module-bound?'.
573
574 `module-bound?' was returning true if a module did have a local
575 variable, but one that was unbound, but another imported module bound
576 the variable. This was an error, and was fixed.
577
578 ** `(ice-9 syncase)' has been deprecated.
579
580 As syntax-case is available by default, importing `(ice-9 syncase)' has
581 no effect, and will trigger a deprecation warning.
582
583 ** Removed deprecated uniform array procedures:
584 dimensions->uniform-array, list->uniform-array, array-prototype
585
586 Instead, use make-typed-array, list->typed-array, or array-type,
587 respectively.
588
589 * Changes to the C interface
590
591 ** The GH interface (deprecated in version 1.6, 2001) was removed.
592
593 ** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF
594
595 This makes these internal functions technically not callable from
596 application code.
597
598 ** Functions for handling `scm_option' now no longer require an argument
599 indicating length of the `scm_t_option' array.
600
601 ** scm_primitive_load_path has additional argument, exception_on_error
602
603 ** New C function: scm_module_public_interface
604
605 This procedure corresponds to Scheme's `module-public-interface'.
606
607 ** `scm_stat' has an additional argument, `exception_on_error'
608 ** `scm_primitive_load_path' has an additional argument `exception_on_not_found'
609
610 ** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type
611
612 Previously they would use the `off_t' type, which is fragile since its
613 definition depends on the application's value for `_FILE_OFFSET_BITS'.
614
615 ** The `long_long' C type, deprecated in 1.8, has been removed
616
617 ** Removed deprecated uniform array procedures: scm_make_uve,
618 scm_array_prototype, scm_list_to_uniform_array,
619 scm_dimensions_to_uniform_array, scm_make_ra, scm_shap2ra, scm_cvref,
620 scm_ra_set_contp, scm_aind, scm_raprin1
621
622 These functions have been deprecated since early 2005.
623
624 ** scm_array_p has one argument, not two
625
626 Use of the second argument produced a deprecation warning, so it is
627 unlikely that any code out there actually used this functionality.
628
629 * Changes to the distribution
630
631 ** Guile's license is now LGPLv3+
632
633 In other words the GNU Lesser General Public License, version 3 or
634 later (at the discretion of each person that chooses to redistribute
635 part of Guile).
636
637 ** `guile-config' will be deprecated in favor of `pkg-config'
638
639 `guile-config' has been rewritten to get its information from
640 `pkg-config', so this should be a transparent change. Note however that
641 guile.m4 has yet to be modified to call pkg-config instead of
642 guile-config.
643
644 ** Guile now provides `guile-2.0.pc' instead of `guile-1.8.pc'
645
646 Programs that use `pkg-config' to find Guile or one of its Autoconf
647 macros should now require `guile-2.0' instead of `guile-1.8'.
648
649 ** New installation directory: $(pkglibdir)/1.9/ccache
650
651 If $(libdir) is /usr/lib, for example, Guile will install its .go files
652 to /usr/lib/guile/1.9/ccache. These files are architecture-specific.
653
654 ** New dependency: GNU libunistring.
655
656 See http://www.gnu.org/software/libunistring/, for more information. Our
657 unicode support uses routines from libunistring.
658
659
660 \f
661 Changes in 1.8.8 (since 1.8.7)
662
663 * Bugs fixed
664
665 ** Fix possible buffer overruns when parsing numbers
666 ** Avoid clash with system setjmp/longjmp on IA64
667
668 \f
669 Changes in 1.8.7 (since 1.8.6)
670
671 * New modules (see the manual for details)
672
673 ** `(srfi srfi-98)', an interface to access environment variables
674
675 * Bugs fixed
676
677 ** Fix compilation with `--disable-deprecated'
678 ** Fix %fast-slot-ref/set!, to avoid possible segmentation fault
679 ** Fix MinGW build problem caused by HAVE_STRUCT_TIMESPEC confusion
680 ** Fix build problem when scm_t_timespec is different from struct timespec
681 ** Fix build when compiled with -Wundef -Werror
682 ** More build fixes for `alphaev56-dec-osf5.1b' (Tru64)
683 ** Build fixes for `powerpc-ibm-aix5.3.0.0' (AIX 5.3)
684 ** With GCC, always compile with `-mieee' on `alpha*' and `sh*'
685 ** Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130)
686 ** Fix parsing of SRFI-88/postfix keywords longer than 128 characters
687 ** Fix reading of complex numbers where both parts are inexact decimals
688
689 ** Allow @ macro to work with (ice-9 syncase)
690
691 Previously, use of the @ macro in a module whose code is being
692 transformed by (ice-9 syncase) would cause an "Invalid syntax" error.
693 Now it works as you would expect (giving the value of the specified
694 module binding).
695
696 ** Have `scm_take_locale_symbol ()' return an interned symbol (bug #25865)
697
698 \f
699 Changes in 1.8.6 (since 1.8.5)
700
701 * New features (see the manual for details)
702
703 ** New convenience function `scm_c_symbol_length ()'
704
705 ** Single stepping through code from Emacs
706
707 When you use GDS to evaluate Scheme code from Emacs, you can now use
708 `C-u' to indicate that you want to single step through that code. See
709 `Evaluating Scheme Code' in the manual for more details.
710
711 ** New "guile(1)" man page!
712
713 * Changes to the distribution
714
715 ** Automake's `AM_MAINTAINER_MODE' is no longer used
716
717 Thus, the `--enable-maintainer-mode' configure option is no longer
718 available: Guile is now always configured in "maintainer mode".
719
720 ** `ChangeLog' files are no longer updated
721
722 Instead, changes are detailed in the version control system's logs. See
723 the top-level `ChangeLog' files for details.
724
725
726 * Bugs fixed
727
728 ** `symbol->string' now returns a read-only string, as per R5RS
729 ** Fix incorrect handling of the FLAGS argument of `fold-matches'
730 ** `guile-config link' now prints `-L$libdir' before `-lguile'
731 ** Fix memory corruption involving GOOPS' `class-redefinition'
732 ** Fix possible deadlock in `mutex-lock'
733 ** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro)
734 ** Fix build issue on mips, mipsel, powerpc and ia64 (stack direction)
735 ** Fix build issue on hppa2.0w-hp-hpux11.11 (`dirent64' and `readdir64_r')
736 ** Fix build issue on i386-unknown-freebsd7.0 ("break strict-aliasing rules")
737 ** Fix misleading output from `(help rationalize)'
738 ** Fix build failure on Debian hppa architecture (bad stack growth detection)
739 ** Fix `gcd' when called with a single, negative argument.
740 ** Fix `Stack overflow' errors seen when building on some platforms
741 ** Fix bug when `scm_with_guile ()' was called several times from the
742 same thread
743 ** The handler of SRFI-34 `with-exception-handler' is now invoked in the
744 dynamic environment of the call to `raise'
745 ** Fix potential deadlock in `make-struct'
746 ** Fix compilation problem with libltdl from Libtool 2.2.x
747 ** Fix sloppy bound checking in `string-{ref,set!}' with the empty string
748
749 \f
750 Changes in 1.8.5 (since 1.8.4)
751
752 * Infrastructure changes
753
754 ** Guile repository switched from CVS to Git
755
756 The new repository can be accessed using
757 "git-clone git://git.sv.gnu.org/guile.git", or can be browsed on-line at
758 http://git.sv.gnu.org/gitweb/?p=guile.git . See `README' for details.
759
760 ** Add support for `pkg-config'
761
762 See "Autoconf Support" in the manual for details.
763
764 * New modules (see the manual for details)
765
766 ** `(srfi srfi-88)'
767
768 * New features (see the manual for details)
769
770 ** New `postfix' read option, for SRFI-88 keyword syntax
771 ** Some I/O primitives have been inlined, which improves I/O performance
772 ** New object-based traps infrastructure
773
774 This is a GOOPS-based infrastructure that builds on Guile's low-level
775 evaluator trap calls and facilitates the development of debugging
776 features like single-stepping, breakpoints, tracing and profiling.
777 See the `Traps' node of the manual for details.
778
779 ** New support for working on Guile code from within Emacs
780
781 Guile now incorporates the `GDS' library (previously distributed
782 separately) for working on Guile code from within Emacs. See the
783 `Using Guile In Emacs' node of the manual for details.
784
785 * Bugs fixed
786
787 ** `scm_add_slot ()' no longer segfaults (fixes bug #22369)
788 ** Fixed `(ice-9 match)' for patterns like `((_ ...) ...)'
789
790 Previously, expressions like `(match '((foo) (bar)) (((_ ...) ...) #t))'
791 would trigger an unbound variable error for `match:andmap'.
792
793 ** `(oop goops describe)' now properly provides the `describe' feature
794 ** Fixed `args-fold' from `(srfi srfi-37)'
795
796 Previously, parsing short option names of argument-less options would
797 lead to a stack overflow.
798
799 ** `(srfi srfi-35)' is now visible through `cond-expand'
800 ** Fixed type-checking for the second argument of `eval'
801 ** Fixed type-checking for SRFI-1 `partition'
802 ** Fixed `struct-ref' and `struct-set!' on "light structs"
803 ** Honor struct field access rights in GOOPS
804 ** Changed the storage strategy of source properties, which fixes a deadlock
805 ** Allow compilation of Guile-using programs in C99 mode with GCC 4.3 and later
806 ** Fixed build issue for GNU/Linux on IA64
807 ** Fixed build issues on NetBSD 1.6
808 ** Fixed build issue on Solaris 2.10 x86_64
809 ** Fixed build issue with DEC/Compaq/HP's compiler
810 ** Fixed `scm_from_complex_double' build issue on FreeBSD
811 ** Fixed `alloca' build issue on FreeBSD 6
812 ** Removed use of non-portable makefile constructs
813 ** Fixed shadowing of libc's <random.h> on Tru64, which broke compilation
814 ** Make sure all tests honor `$TMPDIR'
815
816 \f
817 Changes in 1.8.4 (since 1.8.3)
818
819 * Bugs fixed
820
821 ** CR (ASCII 0x0d) is (again) recognized as a token delimiter by the reader
822 ** Fixed a segmentation fault which occurred when displaying the
823 backtrace of a stack with a promise object (made by `delay') in it.
824 ** Make `accept' leave guile mode while blocking
825 ** `scm_c_read ()' and `scm_c_write ()' now type-check their port argument
826 ** Fixed a build problem on AIX (use of func_data identifier)
827 ** Fixed a segmentation fault which occurred when hashx-ref or hashx-set! was
828 called with an associator proc that returns neither a pair nor #f.
829 ** Secondary threads now always return a valid module for (current-module).
830 ** Avoid MacOS build problems caused by incorrect combination of "64"
831 system and library calls.
832 ** `guile-snarf' now honors `$TMPDIR'
833 ** `guile-config compile' now reports CPPFLAGS used at compile-time
834 ** Fixed build with Sun Studio (Solaris 9)
835 ** Fixed wrong-type-arg errors when creating zero length SRFI-4
836 uniform vectors on AIX.
837 ** Fixed a deadlock that occurs upon GC with multiple threads.
838 ** Fixed compile problem with GCC on Solaris and AIX (use of _Complex_I)
839 ** Fixed autotool-derived build problems on AIX 6.1.
840 ** Fixed NetBSD/alpha support
841 ** Fixed MacOS build problem caused by use of rl_get_keymap(_name)
842
843 * New modules (see the manual for details)
844
845 ** `(srfi srfi-69)'
846
847 * Documentation fixes and improvements
848
849 ** Removed premature breakpoint documentation
850
851 The features described are not available in the series of 1.8.x
852 releases, so the documentation was misleading and has been removed.
853
854 ** More about Guile's default *random-state* variable
855
856 ** GOOPS: more about how to use `next-method'
857
858 * Changes to the distribution
859
860 ** Corrected a few files that referred incorrectly to the old GPL + special exception licence
861
862 In fact Guile since 1.8.0 has been licensed with the GNU Lesser
863 General Public License, and the few incorrect files have now been
864 fixed to agree with the rest of the Guile distribution.
865
866 ** Removed unnecessary extra copies of COPYING*
867
868 The distribution now contains a single COPYING.LESSER at its top level.
869
870 \f
871 Changes in 1.8.3 (since 1.8.2)
872
873 * New modules (see the manual for details)
874
875 ** `(srfi srfi-35)'
876 ** `(srfi srfi-37)'
877
878 * Bugs fixed
879
880 ** The `(ice-9 slib)' module now works as expected
881 ** Expressions like "(set! 'x #t)" no longer yield a crash
882 ** Warnings about duplicate bindings now go to stderr
883 ** A memory leak in `make-socket-address' was fixed
884 ** Alignment issues (e.g., on SPARC) in network routines were fixed
885 ** A threading issue that showed up at least on NetBSD was fixed
886 ** Build problems on Solaris and IRIX fixed
887
888 * Implementation improvements
889
890 ** The reader is now faster, which reduces startup time
891 ** Procedures returned by `record-accessor' and `record-modifier' are faster
892
893 \f
894 Changes in 1.8.2 (since 1.8.1):
895
896 * New procedures (see the manual for details)
897
898 ** set-program-arguments
899 ** make-vtable
900
901 * Incompatible changes
902
903 ** The body of a top-level `define' no longer sees the binding being created
904
905 In a top-level `define', the binding being created is no longer visible
906 from the `define' body. This breaks code like
907 "(define foo (begin (set! foo 1) (+ foo 1)))", where `foo' is now
908 unbound in the body. However, such code was not R5RS-compliant anyway,
909 per Section 5.2.1.
910
911 * Bugs fixed
912
913 ** Fractions were not `equal?' if stored in unreduced form.
914 (A subtle problem, since printing a value reduced it, making it work.)
915 ** srfi-60 `copy-bit' failed on 64-bit systems
916 ** "guile --use-srfi" option at the REPL can replace core functions
917 (Programs run with that option were ok, but in the interactive REPL
918 the core bindings got priority, preventing SRFI replacements or
919 extensions.)
920 ** `regexp-exec' doesn't abort() on #\nul in the input or bad flags arg
921 ** `kill' on mingw throws an error for a PID other than oneself
922 ** Procedure names are attached to procedure-with-setters
923 ** Array read syntax works with negative lower bound
924 ** `array-in-bounds?' fix if an array has different lower bounds on each index
925 ** `*' returns exact 0 for "(* inexact 0)"
926 This follows what it always did for "(* 0 inexact)".
927 ** SRFI-19: Value returned by `(current-time time-process)' was incorrect
928 ** SRFI-19: `date->julian-day' did not account for timezone offset
929 ** `ttyname' no longer crashes when passed a non-tty argument
930 ** `inet-ntop' no longer crashes on SPARC when passed an `AF_INET' address
931 ** Small memory leaks have been fixed in `make-fluid' and `add-history'
932 ** GOOPS: Fixed a bug in `method-more-specific?'
933 ** Build problems on Solaris fixed
934 ** Build problems on HP-UX IA64 fixed
935 ** Build problems on MinGW fixed
936
937 \f
938 Changes in 1.8.1 (since 1.8.0):
939
940 * LFS functions are now used to access 64-bit files on 32-bit systems.
941
942 * New procedures (see the manual for details)
943
944 ** primitive-_exit - [Scheme] the-root-module
945 ** scm_primitive__exit - [C]
946 ** make-completion-function - [Scheme] (ice-9 readline)
947 ** scm_c_locale_stringn_to_number - [C]
948 ** scm_srfi1_append_reverse [C]
949 ** scm_srfi1_append_reverse_x [C]
950 ** scm_log - [C]
951 ** scm_log10 - [C]
952 ** scm_exp - [C]
953 ** scm_sqrt - [C]
954
955 * Bugs fixed
956
957 ** Build problems have been fixed on MacOS, SunOS, and QNX.
958
959 ** `strftime' fix sign of %z timezone offset.
960
961 ** A one-dimensional array can now be 'equal?' to a vector.
962
963 ** Structures, records, and SRFI-9 records can now be compared with `equal?'.
964
965 ** SRFI-14 standard char sets are recomputed upon a successful `setlocale'.
966
967 ** `record-accessor' and `record-modifier' now have strict type checks.
968
969 Record accessor and modifier procedures now throw an error if the
970 record type of the record they're given is not the type expected.
971 (Previously accessors returned #f and modifiers silently did nothing).
972
973 ** It is now OK to use both autoload and use-modules on a given module.
974
975 ** `apply' checks the number of arguments more carefully on "0 or 1" funcs.
976
977 Previously there was no checking on primatives like make-vector that
978 accept "one or two" arguments. Now there is.
979
980 ** The srfi-1 assoc function now calls its equality predicate properly.
981
982 Previously srfi-1 assoc would call the equality predicate with the key
983 last. According to the SRFI, the key should be first.
984
985 ** A bug in n-par-for-each and n-for-each-par-map has been fixed.
986
987 ** The array-set! procedure no longer segfaults when given a bit vector.
988
989 ** Bugs in make-shared-array have been fixed.
990
991 ** string<? and friends now follow char<? etc order on 8-bit chars.
992
993 ** The format procedure now handles inf and nan values for ~f correctly.
994
995 ** exact->inexact should no longer overflow when given certain large fractions.
996
997 ** srfi-9 accessor and modifier procedures now have strict record type checks.
998
999 This matches the srfi-9 specification.
1000
1001 ** (ice-9 ftw) procedures won't ignore different files with same inode number.
1002
1003 Previously the (ice-9 ftw) procedures would ignore any file that had
1004 the same inode number as a file they had already seen, even if that
1005 file was on a different device.
1006
1007 \f
1008 Changes in 1.8.0 (changes since the 1.6.x series):
1009
1010 * Changes to the distribution
1011
1012 ** Guile is now licensed with the GNU Lesser General Public License.
1013
1014 ** The manual is now licensed with the GNU Free Documentation License.
1015
1016 ** Guile now requires GNU MP (http://swox.com/gmp).
1017
1018 Guile now uses the GNU MP library for arbitrary precision arithmetic.
1019
1020 ** Guile now has separate private and public configuration headers.
1021
1022 That is, things like HAVE_STRING_H no longer leak from Guile's
1023 headers.
1024
1025 ** Guile now provides and uses an "effective" version number.
1026
1027 Guile now provides scm_effective_version and effective-version
1028 functions which return the "effective" version number. This is just
1029 the normal full version string without the final micro-version number,
1030 so the current effective-version is "1.8". The effective version
1031 should remain unchanged during a stable series, and should be used for
1032 items like the versioned share directory name
1033 i.e. /usr/share/guile/1.8.
1034
1035 Providing an unchanging version number during a stable release for
1036 things like the versioned share directory can be particularly
1037 important for Guile "add-on" packages, since it provides a directory
1038 that they can install to that won't be changed out from under them
1039 with each micro release during a stable series.
1040
1041 ** Thread implementation has changed.
1042
1043 When you configure "--with-threads=null", you will get the usual
1044 threading API (call-with-new-thread, make-mutex, etc), but you can't
1045 actually create new threads. Also, "--with-threads=no" is now
1046 equivalent to "--with-threads=null". This means that the thread API
1047 is always present, although you might not be able to create new
1048 threads.
1049
1050 When you configure "--with-threads=pthreads" or "--with-threads=yes",
1051 you will get threads that are implemented with the portable POSIX
1052 threads. These threads can run concurrently (unlike the previous
1053 "coop" thread implementation), but need to cooperate for things like
1054 the GC.
1055
1056 The default is "pthreads", unless your platform doesn't have pthreads,
1057 in which case "null" threads are used.
1058
1059 See the manual for details, nodes "Initialization", "Multi-Threading",
1060 "Blocking", and others.
1061
1062 ** There is the new notion of 'discouraged' features.
1063
1064 This is a milder form of deprecation.
1065
1066 Things that are discouraged should not be used in new code, but it is
1067 OK to leave them in old code for now. When a discouraged feature is
1068 used, no warning message is printed like there is for 'deprecated'
1069 features. Also, things that are merely discouraged are nevertheless
1070 implemented efficiently, while deprecated features can be very slow.
1071
1072 You can omit discouraged features from libguile by configuring it with
1073 the '--disable-discouraged' option.
1074
1075 ** Deprecation warnings can be controlled at run-time.
1076
1077 (debug-enable 'warn-deprecated) switches them on and (debug-disable
1078 'warn-deprecated) switches them off.
1079
1080 ** Support for SRFI 61, extended cond syntax for multiple values has
1081 been added.
1082
1083 This SRFI is always available.
1084
1085 ** Support for require-extension, SRFI-55, has been added.
1086
1087 The SRFI-55 special form `require-extension' has been added. It is
1088 available at startup, and provides a portable way to load Scheme
1089 extensions. SRFI-55 only requires support for one type of extension,
1090 "srfi"; so a set of SRFIs may be loaded via (require-extension (srfi 1
1091 13 14)).
1092
1093 ** New module (srfi srfi-26) provides support for `cut' and `cute'.
1094
1095 The (srfi srfi-26) module is an implementation of SRFI-26 which
1096 provides the `cut' and `cute' syntax. These may be used to specialize
1097 parameters without currying.
1098
1099 ** New module (srfi srfi-31)
1100
1101 This is an implementation of SRFI-31 which provides a special form
1102 `rec' for recursive evaluation.
1103
1104 ** The modules (srfi srfi-13), (srfi srfi-14) and (srfi srfi-4) have
1105 been merged with the core, making their functionality always
1106 available.
1107
1108 The modules are still available, tho, and you could use them together
1109 with a renaming import, for example.
1110
1111 ** Guile no longer includes its own version of libltdl.
1112
1113 The official version is good enough now.
1114
1115 ** The --enable-htmldoc option has been removed from 'configure'.
1116
1117 Support for translating the documentation into HTML is now always
1118 provided. Use 'make html'.
1119
1120 ** New module (ice-9 serialize):
1121
1122 (serialize FORM1 ...) and (parallelize FORM1 ...) are useful when you
1123 don't trust the thread safety of most of your program, but where you
1124 have some section(s) of code which you consider can run in parallel to
1125 other sections. See ice-9/serialize.scm for more information.
1126
1127 ** The configure option '--disable-arrays' has been removed.
1128
1129 Support for arrays and uniform numeric arrays is now always included
1130 in Guile.
1131
1132 * Changes to the stand-alone interpreter
1133
1134 ** New command line option `-L'.
1135
1136 This option adds a directory to the front of the load path.
1137
1138 ** New command line option `--no-debug'.
1139
1140 Specifying `--no-debug' on the command line will keep the debugging
1141 evaluator turned off, even for interactive sessions.
1142
1143 ** User-init file ~/.guile is now loaded with the debugging evaluator.
1144
1145 Previously, the normal evaluator would have been used. Using the
1146 debugging evaluator gives better error messages.
1147
1148 ** The '-e' option now 'read's its argument.
1149
1150 This is to allow the new '(@ MODULE-NAME VARIABLE-NAME)' construct to
1151 be used with '-e'. For example, you can now write a script like
1152
1153 #! /bin/sh
1154 exec guile -e '(@ (demo) main)' -s "$0" "$@"
1155 !#
1156
1157 (define-module (demo)
1158 :export (main))
1159
1160 (define (main args)
1161 (format #t "Demo: ~a~%" args))
1162
1163
1164 * Changes to Scheme functions and syntax
1165
1166 ** Guardians have changed back to their original semantics
1167
1168 Guardians now behave like described in the paper by Dybvig et al. In
1169 particular, they no longer make guarantees about the order in which
1170 they return objects, and they can no longer be greedy.
1171
1172 They no longer drop cyclic data structures.
1173
1174 The C function scm_make_guardian has been changed incompatibly and no
1175 longer takes the 'greedy_p' argument.
1176
1177 ** New function hashx-remove!
1178
1179 This function completes the set of 'hashx' functions.
1180
1181 ** The concept of dynamic roots has been factored into continuation
1182 barriers and dynamic states.
1183
1184 Each thread has a current dynamic state that carries the values of the
1185 fluids. You can create and copy dynamic states and use them as the
1186 second argument for 'eval'. See "Fluids and Dynamic States" in the
1187 manual.
1188
1189 To restrict the influence that captured continuations can have on the
1190 control flow, you can errect continuation barriers. See "Continuation
1191 Barriers" in the manual.
1192
1193 The function call-with-dynamic-root now essentially temporarily
1194 installs a new dynamic state and errects a continuation barrier.
1195
1196 ** The default load path no longer includes "." at the end.
1197
1198 Automatically loading modules from the current directory should not
1199 happen by default. If you want to allow it in a more controlled
1200 manner, set the environment variable GUILE_LOAD_PATH or the Scheme
1201 variable %load-path.
1202
1203 ** The uniform vector and array support has been overhauled.
1204
1205 It now complies with SRFI-4 and the weird prototype based uniform
1206 array creation has been deprecated. See the manual for more details.
1207
1208 Some non-compatible changes have been made:
1209 - characters can no longer be stored into byte arrays.
1210 - strings and bit vectors are no longer considered to be uniform numeric
1211 vectors.
1212 - array-rank throws an error for non-arrays instead of returning zero.
1213 - array-ref does no longer accept non-arrays when no indices are given.
1214
1215 There is the new notion of 'generalized vectors' and corresponding
1216 procedures like 'generalized-vector-ref'. Generalized vectors include
1217 strings, bitvectors, ordinary vectors, and uniform numeric vectors.
1218
1219 Arrays use generalized vectors as their storage, so that you still
1220 have arrays of characters, bits, etc. However, uniform-array-read!
1221 and uniform-array-write can no longer read/write strings and
1222 bitvectors.
1223
1224 ** There is now support for copy-on-write substrings, mutation-sharing
1225 substrings and read-only strings.
1226
1227 Three new procedures are related to this: substring/shared,
1228 substring/copy, and substring/read-only. See the manual for more
1229 information.
1230
1231 ** Backtraces will now highlight the value that caused the error.
1232
1233 By default, these values are enclosed in "{...}", such as in this
1234 example:
1235
1236 guile> (car 'a)
1237
1238 Backtrace:
1239 In current input:
1240 1: 0* [car {a}]
1241
1242 <unnamed port>:1:1: In procedure car in expression (car (quote a)):
1243 <unnamed port>:1:1: Wrong type (expecting pair): a
1244 ABORT: (wrong-type-arg)
1245
1246 The prefix and suffix used for highlighting can be set via the two new
1247 printer options 'highlight-prefix' and 'highlight-suffix'. For
1248 example, putting this into ~/.guile will output the bad value in bold
1249 on an ANSI terminal:
1250
1251 (print-set! highlight-prefix "\x1b[1m")
1252 (print-set! highlight-suffix "\x1b[22m")
1253
1254
1255 ** 'gettext' support for internationalization has been added.
1256
1257 See the manual for details.
1258
1259 ** New syntax '@' and '@@':
1260
1261 You can now directly refer to variables exported from a module by
1262 writing
1263
1264 (@ MODULE-NAME VARIABLE-NAME)
1265
1266 For example (@ (ice-9 pretty-print) pretty-print) will directly access
1267 the pretty-print variable exported from the (ice-9 pretty-print)
1268 module. You don't need to 'use' that module first. You can also use
1269 '@' as a target of 'set!', as in (set! (@ mod var) val).
1270
1271 The related syntax (@@ MODULE-NAME VARIABLE-NAME) works just like '@',
1272 but it can also access variables that have not been exported. It is
1273 intended only for kluges and temporary fixes and for debugging, not
1274 for ordinary code.
1275
1276 ** Keyword syntax has been made more disciplined.
1277
1278 Previously, the name of a keyword was read as a 'token' but printed as
1279 a symbol. Now, it is read as a general Scheme datum which must be a
1280 symbol.
1281
1282 Previously:
1283
1284 guile> #:12
1285 #:#{12}#
1286 guile> #:#{12}#
1287 #:#{\#{12}\#}#
1288 guile> #:(a b c)
1289 #:#{}#
1290 ERROR: In expression (a b c):
1291 Unbound variable: a
1292 guile> #: foo
1293 #:#{}#
1294 ERROR: Unbound variable: foo
1295
1296 Now:
1297
1298 guile> #:12
1299 ERROR: Wrong type (expecting symbol): 12
1300 guile> #:#{12}#
1301 #:#{12}#
1302 guile> #:(a b c)
1303 ERROR: Wrong type (expecting symbol): (a b c)
1304 guile> #: foo
1305 #:foo
1306
1307 ** The printing of symbols that might look like keywords can be
1308 controlled.
1309
1310 The new printer option 'quote-keywordish-symbols' controls how symbols
1311 are printed that have a colon as their first or last character. The
1312 default now is to only quote a symbol with #{...}# when the read
1313 option 'keywords' is not '#f'. Thus:
1314
1315 guile> (define foo (string->symbol ":foo"))
1316 guile> (read-set! keywords #f)
1317 guile> foo
1318 :foo
1319 guile> (read-set! keywords 'prefix)
1320 guile> foo
1321 #{:foo}#
1322 guile> (print-set! quote-keywordish-symbols #f)
1323 guile> foo
1324 :foo
1325
1326 ** 'while' now provides 'break' and 'continue'
1327
1328 break and continue were previously bound in a while loop, but not
1329 documented, and continue didn't quite work properly. The undocumented
1330 parameter to break which gave a return value for the while has been
1331 dropped.
1332
1333 ** 'call-with-current-continuation' is now also available under the name
1334 'call/cc'.
1335
1336 ** The module system now checks for duplicate bindings.
1337
1338 The module system now can check for name conflicts among imported
1339 bindings.
1340
1341 The behavior can be controlled by specifying one or more 'duplicates'
1342 handlers. For example, to make Guile return an error for every name
1343 collision, write:
1344
1345 (define-module (foo)
1346 :use-module (bar)
1347 :use-module (baz)
1348 :duplicates check)
1349
1350 The new default behavior of the module system when a name collision
1351 has been detected is to
1352
1353 1. Give priority to bindings marked as a replacement.
1354 2. Issue a warning (different warning if overriding core binding).
1355 3. Give priority to the last encountered binding (this corresponds to
1356 the old behavior).
1357
1358 If you want the old behavior back without replacements or warnings you
1359 can add the line:
1360
1361 (default-duplicate-binding-handler 'last)
1362
1363 to your .guile init file.
1364
1365 ** New define-module option: :replace
1366
1367 :replace works as :export, but, in addition, marks the binding as a
1368 replacement.
1369
1370 A typical example is `format' in (ice-9 format) which is a replacement
1371 for the core binding `format'.
1372
1373 ** Adding prefixes to imported bindings in the module system
1374
1375 There is now a new :use-module option :prefix. It can be used to add
1376 a prefix to all imported bindings.
1377
1378 (define-module (foo)
1379 :use-module ((bar) :prefix bar:))
1380
1381 will import all bindings exported from bar, but rename them by adding
1382 the prefix `bar:'.
1383
1384 ** Conflicting generic functions can be automatically merged.
1385
1386 When two imported bindings conflict and they are both generic
1387 functions, the two functions can now be merged automatically. This is
1388 activated with the 'duplicates' handler 'merge-generics'.
1389
1390 ** New function: effective-version
1391
1392 Returns the "effective" version number. This is just the normal full
1393 version string without the final micro-version number. See "Changes
1394 to the distribution" above.
1395
1396 ** New threading functions: parallel, letpar, par-map, and friends
1397
1398 These are convenient ways to run calculations in parallel in new
1399 threads. See "Parallel forms" in the manual for details.
1400
1401 ** New function 'try-mutex'.
1402
1403 This function will attempt to lock a mutex but will return immediately
1404 instead of blocking and indicate failure.
1405
1406 ** Waiting on a condition variable can have a timeout.
1407
1408 The function 'wait-condition-variable' now takes a third, optional
1409 argument that specifies the point in time where the waiting should be
1410 aborted.
1411
1412 ** New function 'broadcast-condition-variable'.
1413
1414 ** New functions 'all-threads' and 'current-thread'.
1415
1416 ** Signals and system asyncs work better with threads.
1417
1418 The function 'sigaction' now takes a fourth, optional, argument that
1419 specifies the thread that the handler should run in. When the
1420 argument is omitted, the handler will run in the thread that called
1421 'sigaction'.
1422
1423 Likewise, 'system-async-mark' takes a second, optional, argument that
1424 specifies the thread that the async should run in. When it is
1425 omitted, the async will run in the thread that called
1426 'system-async-mark'.
1427
1428 C code can use the new functions scm_sigaction_for_thread and
1429 scm_system_async_mark_for_thread to pass the new thread argument.
1430
1431 When a thread blocks on a mutex, a condition variable or is waiting
1432 for IO to be possible, it will still execute system asyncs. This can
1433 be used to interrupt such a thread by making it execute a 'throw', for
1434 example.
1435
1436 ** The function 'system-async' is deprecated.
1437
1438 You can now pass any zero-argument procedure to 'system-async-mark'.
1439 The function 'system-async' will just return its argument unchanged
1440 now.
1441
1442 ** New functions 'call-with-blocked-asyncs' and
1443 'call-with-unblocked-asyncs'
1444
1445 The expression (call-with-blocked-asyncs PROC) will call PROC and will
1446 block execution of system asyncs for the current thread by one level
1447 while PROC runs. Likewise, call-with-unblocked-asyncs will call a
1448 procedure and will unblock the execution of system asyncs by one
1449 level for the current thread.
1450
1451 Only system asyncs are affected by these functions.
1452
1453 ** The functions 'mask-signals' and 'unmask-signals' are deprecated.
1454
1455 Use 'call-with-blocked-asyncs' or 'call-with-unblocked-asyncs'
1456 instead. Those functions are easier to use correctly and can be
1457 nested.
1458
1459 ** New function 'unsetenv'.
1460
1461 ** New macro 'define-syntax-public'.
1462
1463 It works like 'define-syntax' and also exports the defined macro (but
1464 only on top-level).
1465
1466 ** There is support for Infinity and NaNs.
1467
1468 Following PLT Scheme, Guile can now work with infinite numbers, and
1469 'not-a-numbers'.
1470
1471 There is new syntax for numbers: "+inf.0" (infinity), "-inf.0"
1472 (negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as
1473 "+nan.0"). These numbers are inexact and have no exact counterpart.
1474
1475 Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the
1476 sign of the dividend. The infinities are integers, and they answer #t
1477 for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is
1478 not '=' to itself, but '+nan.0' is 'eqv?' to itself.
1479
1480 For example
1481
1482 (/ 1 0.0)
1483 => +inf.0
1484
1485 (/ 0 0.0)
1486 => +nan.0
1487
1488 (/ 0)
1489 ERROR: Numerical overflow
1490
1491 Two new predicates 'inf?' and 'nan?' can be used to test for the
1492 special values.
1493
1494 ** Inexact zero can have a sign.
1495
1496 Guile can now distinguish between plus and minus inexact zero, if your
1497 platform supports this, too. The two zeros are equal according to
1498 '=', but not according to 'eqv?'. For example
1499
1500 (- 0.0)
1501 => -0.0
1502
1503 (= 0.0 (- 0.0))
1504 => #t
1505
1506 (eqv? 0.0 (- 0.0))
1507 => #f
1508
1509 ** Guile now has exact rationals.
1510
1511 Guile can now represent fractions such as 1/3 exactly. Computing with
1512 them is also done exactly, of course:
1513
1514 (* 1/3 3/2)
1515 => 1/2
1516
1517 ** 'floor', 'ceiling', 'round' and 'truncate' now return exact numbers
1518 for exact arguments.
1519
1520 For example: (floor 2) now returns an exact 2 where in the past it
1521 returned an inexact 2.0. Likewise, (floor 5/4) returns an exact 1.
1522
1523 ** inexact->exact no longer returns only integers.
1524
1525 Without exact rationals, the closest exact number was always an
1526 integer, but now inexact->exact returns the fraction that is exactly
1527 equal to a floating point number. For example:
1528
1529 (inexact->exact 1.234)
1530 => 694680242521899/562949953421312
1531
1532 When you want the old behavior, use 'round' explicitly:
1533
1534 (inexact->exact (round 1.234))
1535 => 1
1536
1537 ** New function 'rationalize'.
1538
1539 This function finds a simple fraction that is close to a given real
1540 number. For example (and compare with inexact->exact above):
1541
1542 (rationalize (inexact->exact 1.234) 1/2000)
1543 => 58/47
1544
1545 Note that, as required by R5RS, rationalize returns only then an exact
1546 result when both its arguments are exact.
1547
1548 ** 'odd?' and 'even?' work also for inexact integers.
1549
1550 Previously, (odd? 1.0) would signal an error since only exact integers
1551 were recognized as integers. Now (odd? 1.0) returns #t, (odd? 2.0)
1552 returns #f and (odd? 1.5) signals an error.
1553
1554 ** Guile now has uninterned symbols.
1555
1556 The new function 'make-symbol' will return an uninterned symbol. This
1557 is a symbol that is unique and is guaranteed to remain unique.
1558 However, uninterned symbols can not yet be read back in.
1559
1560 Use the new function 'symbol-interned?' to check whether a symbol is
1561 interned or not.
1562
1563 ** pretty-print has more options.
1564
1565 The function pretty-print from the (ice-9 pretty-print) module can now
1566 also be invoked with keyword arguments that control things like
1567 maximum output width. See the manual for details.
1568
1569 ** Variables have no longer a special behavior for `equal?'.
1570
1571 Previously, comparing two variables with `equal?' would recursivly
1572 compare their values. This is no longer done. Variables are now only
1573 `equal?' if they are `eq?'.
1574
1575 ** `(begin)' is now valid.
1576
1577 You can now use an empty `begin' form. It will yield #<unspecified>
1578 when evaluated and simply be ignored in a definition context.
1579
1580 ** Deprecated: procedure->macro
1581
1582 Change your code to use 'define-macro' or r5rs macros. Also, be aware
1583 that macro expansion will not be done during evaluation, but prior to
1584 evaluation.
1585
1586 ** Soft ports now allow a `char-ready?' procedure
1587
1588 The vector argument to `make-soft-port' can now have a length of
1589 either 5 or 6. (Previously the length had to be 5.) The optional 6th
1590 element is interpreted as an `input-waiting' thunk -- i.e. a thunk
1591 that returns the number of characters that can be read immediately
1592 without the soft port blocking.
1593
1594 ** Deprecated: undefine
1595
1596 There is no replacement for undefine.
1597
1598 ** The functions make-keyword-from-dash-symbol and keyword-dash-symbol
1599 have been discouraged.
1600
1601 They are relics from a time where a keyword like #:foo was used
1602 directly as a Tcl option "-foo" and thus keywords were internally
1603 stored as a symbol with a starting dash. We now store a symbol
1604 without the dash.
1605
1606 Use symbol->keyword and keyword->symbol instead.
1607
1608 ** The `cheap' debug option is now obsolete
1609
1610 Evaluator trap calls are now unconditionally "cheap" - in other words,
1611 they pass a debug object to the trap handler rather than a full
1612 continuation. The trap handler code can capture a full continuation
1613 by using `call-with-current-continuation' in the usual way, if it so
1614 desires.
1615
1616 The `cheap' option is retained for now so as not to break existing
1617 code which gets or sets it, but setting it now has no effect. It will
1618 be removed in the next major Guile release.
1619
1620 ** Evaluator trap calls now support `tweaking'
1621
1622 `Tweaking' means that the trap handler code can modify the Scheme
1623 expression that is about to be evaluated (in the case of an
1624 enter-frame trap) or the value that is being returned (in the case of
1625 an exit-frame trap). The trap handler code indicates that it wants to
1626 do this by returning a pair whose car is the symbol 'instead and whose
1627 cdr is the modified expression or return value.
1628
1629 * Changes to the C interface
1630
1631 ** The functions scm_hash_fn_remove_x and scm_hashx_remove_x no longer
1632 take a 'delete' function argument.
1633
1634 This argument makes no sense since the delete function is used to
1635 remove a pair from an alist, and this must not be configurable.
1636
1637 This is an incompatible change.
1638
1639 ** The GH interface is now subject to the deprecation mechanism
1640
1641 The GH interface has been deprecated for quite some time but now it is
1642 actually removed from Guile when it is configured with
1643 --disable-deprecated.
1644
1645 See the manual "Transitioning away from GH" for more information.
1646
1647 ** A new family of functions for converting between C values and
1648 Scheme values has been added.
1649
1650 These functions follow a common naming scheme and are designed to be
1651 easier to use, thread-safe and more future-proof than the older
1652 alternatives.
1653
1654 - int scm_is_* (...)
1655
1656 These are predicates that return a C boolean: 1 or 0. Instead of
1657 SCM_NFALSEP, you can now use scm_is_true, for example.
1658
1659 - <type> scm_to_<type> (SCM val, ...)
1660
1661 These are functions that convert a Scheme value into an appropriate
1662 C value. For example, you can use scm_to_int to safely convert from
1663 a SCM to an int.
1664
1665 - SCM scm_from_<type> (<type> val, ...)
1666
1667 These functions convert from a C type to a SCM value; for example,
1668 scm_from_int for ints.
1669
1670 There is a huge number of these functions, for numbers, strings,
1671 symbols, vectors, etc. They are documented in the reference manual in
1672 the API section together with the types that they apply to.
1673
1674 ** New functions for dealing with complex numbers in C have been added.
1675
1676 The new functions are scm_c_make_rectangular, scm_c_make_polar,
1677 scm_c_real_part, scm_c_imag_part, scm_c_magnitude and scm_c_angle.
1678 They work like scm_make_rectangular etc but take or return doubles
1679 directly.
1680
1681 ** The function scm_make_complex has been discouraged.
1682
1683 Use scm_c_make_rectangular instead.
1684
1685 ** The INUM macros have been deprecated.
1686
1687 A lot of code uses these macros to do general integer conversions,
1688 although the macros only work correctly with fixnums. Use the
1689 following alternatives.
1690
1691 SCM_INUMP -> scm_is_integer or similar
1692 SCM_NINUMP -> !scm_is_integer or similar
1693 SCM_MAKINUM -> scm_from_int or similar
1694 SCM_INUM -> scm_to_int or similar
1695
1696 SCM_VALIDATE_INUM_* -> Do not use these; scm_to_int, etc. will
1697 do the validating for you.
1698
1699 ** The scm_num2<type> and scm_<type>2num functions and scm_make_real
1700 have been discouraged.
1701
1702 Use the newer scm_to_<type> and scm_from_<type> functions instead for
1703 new code. The functions have been discouraged since they don't fit
1704 the naming scheme.
1705
1706 ** The 'boolean' macros SCM_FALSEP etc have been discouraged.
1707
1708 They have strange names, especially SCM_NFALSEP, and SCM_BOOLP
1709 evaluates its argument twice. Use scm_is_true, etc. instead for new
1710 code.
1711
1712 ** The macro SCM_EQ_P has been discouraged.
1713
1714 Use scm_is_eq for new code, which fits better into the naming
1715 conventions.
1716
1717 ** The macros SCM_CONSP, SCM_NCONSP, SCM_NULLP, and SCM_NNULLP have
1718 been discouraged.
1719
1720 Use the function scm_is_pair or scm_is_null instead.
1721
1722 ** The functions scm_round and scm_truncate have been deprecated and
1723 are now available as scm_c_round and scm_c_truncate, respectively.
1724
1725 These functions occupy the names that scm_round_number and
1726 scm_truncate_number should have.
1727
1728 ** The functions scm_c_string2str, scm_c_substring2str, and
1729 scm_c_symbol2str have been deprecated.
1730
1731 Use scm_to_locale_stringbuf or similar instead, maybe together with
1732 scm_substring.
1733
1734 ** New functions scm_c_make_string, scm_c_string_length,
1735 scm_c_string_ref, scm_c_string_set_x, scm_c_substring,
1736 scm_c_substring_shared, scm_c_substring_copy.
1737
1738 These are like scm_make_string, scm_length, etc. but are slightly
1739 easier to use from C.
1740
1741 ** The macros SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_LENGTH,
1742 SCM_SYMBOL_CHARS, and SCM_SYMBOL_LENGTH have been deprecated.
1743
1744 They export too many assumptions about the implementation of strings
1745 and symbols that are no longer true in the presence of
1746 mutation-sharing substrings and when Guile switches to some form of
1747 Unicode.
1748
1749 When working with strings, it is often best to use the normal string
1750 functions provided by Guile, such as scm_c_string_ref,
1751 scm_c_string_set_x, scm_string_append, etc. Be sure to look in the
1752 manual since many more such functions are now provided than
1753 previously.
1754
1755 When you want to convert a SCM string to a C string, use the
1756 scm_to_locale_string function or similar instead. For symbols, use
1757 scm_symbol_to_string and then work with that string. Because of the
1758 new string representation, scm_symbol_to_string does not need to copy
1759 and is thus quite efficient.
1760
1761 ** Some string, symbol and keyword functions have been discouraged.
1762
1763 They don't fit into the uniform naming scheme and are not explicit
1764 about the character encoding.
1765
1766 Replace according to the following table:
1767
1768 scm_allocate_string -> scm_c_make_string
1769 scm_take_str -> scm_take_locale_stringn
1770 scm_take0str -> scm_take_locale_string
1771 scm_mem2string -> scm_from_locale_stringn
1772 scm_str2string -> scm_from_locale_string
1773 scm_makfrom0str -> scm_from_locale_string
1774 scm_mem2symbol -> scm_from_locale_symboln
1775 scm_mem2uninterned_symbol -> scm_from_locale_stringn + scm_make_symbol
1776 scm_str2symbol -> scm_from_locale_symbol
1777
1778 SCM_SYMBOL_HASH -> scm_hashq
1779 SCM_SYMBOL_INTERNED_P -> scm_symbol_interned_p
1780
1781 scm_c_make_keyword -> scm_from_locale_keyword
1782
1783 ** The functions scm_keyword_to_symbol and sym_symbol_to_keyword are
1784 now also available to C code.
1785
1786 ** SCM_KEYWORDP and SCM_KEYWORDSYM have been deprecated.
1787
1788 Use scm_is_keyword and scm_keyword_to_symbol instead, but note that
1789 the latter returns the true name of the keyword, not the 'dash name',
1790 as SCM_KEYWORDSYM used to do.
1791
1792 ** A new way to access arrays in a thread-safe and efficient way has
1793 been added.
1794
1795 See the manual, node "Accessing Arrays From C".
1796
1797 ** The old uniform vector and bitvector implementations have been
1798 unceremoniously removed.
1799
1800 This implementation exposed the details of the tagging system of
1801 Guile. Use the new C API explained in the manual in node "Uniform
1802 Numeric Vectors" and "Bit Vectors", respectively.
1803
1804 The following macros are gone: SCM_UVECTOR_BASE, SCM_SET_UVECTOR_BASE,
1805 SCM_UVECTOR_MAXLENGTH, SCM_UVECTOR_LENGTH, SCM_MAKE_UVECTOR_TAG,
1806 SCM_SET_UVECTOR_LENGTH, SCM_BITVECTOR_P, SCM_BITVECTOR_BASE,
1807 SCM_SET_BITVECTOR_BASE, SCM_BITVECTOR_MAX_LENGTH,
1808 SCM_BITVECTOR_LENGTH, SCM_MAKE_BITVECTOR_TAG,
1809 SCM_SET_BITVECTOR_LENGTH, SCM_BITVEC_REF, SCM_BITVEC_SET,
1810 SCM_BITVEC_CLR.
1811
1812 ** The macros dealing with vectors have been deprecated.
1813
1814 Use the new functions scm_is_vector, scm_vector_elements,
1815 scm_vector_writable_elements, etc, or scm_is_simple_vector,
1816 SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, etc instead. See the
1817 manual for more details.
1818
1819 Deprecated are SCM_VECTORP, SCM_VELTS, SCM_VECTOR_MAX_LENGTH,
1820 SCM_VECTOR_LENGTH, SCM_VECTOR_REF, SCM_VECTOR_SET, SCM_WRITABLE_VELTS.
1821
1822 The following macros have been removed: SCM_VECTOR_BASE,
1823 SCM_SET_VECTOR_BASE, SCM_MAKE_VECTOR_TAG, SCM_SET_VECTOR_LENGTH,
1824 SCM_VELTS_AS_STACKITEMS, SCM_SETVELTS, SCM_GC_WRITABLE_VELTS.
1825
1826 ** Some C functions and macros related to arrays have been deprecated.
1827
1828 Migrate according to the following table:
1829
1830 scm_make_uve -> scm_make_typed_array, scm_make_u8vector etc.
1831 scm_make_ra -> scm_make_array
1832 scm_shap2ra -> scm_make_array
1833 scm_cvref -> scm_c_generalized_vector_ref
1834 scm_ra_set_contp -> do not use
1835 scm_aind -> scm_array_handle_pos
1836 scm_raprin1 -> scm_display or scm_write
1837
1838 SCM_ARRAYP -> scm_is_array
1839 SCM_ARRAY_NDIM -> scm_c_array_rank
1840 SCM_ARRAY_DIMS -> scm_array_handle_dims
1841 SCM_ARRAY_CONTP -> do not use
1842 SCM_ARRAY_MEM -> do not use
1843 SCM_ARRAY_V -> scm_array_handle_elements or similar
1844 SCM_ARRAY_BASE -> do not use
1845
1846 ** SCM_CELL_WORD_LOC has been deprecated.
1847
1848 Use the new macro SCM_CELL_OBJECT_LOC instead, which returns a pointer
1849 to a SCM, as opposed to a pointer to a scm_t_bits.
1850
1851 This was done to allow the correct use of pointers into the Scheme
1852 heap. Previously, the heap words were of type scm_t_bits and local
1853 variables and function arguments were of type SCM, making it
1854 non-standards-conformant to have a pointer that can point to both.
1855
1856 ** New macros SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, etc.
1857
1858 These macros should be used instead of SCM_CELL_WORD_2/3 to access the
1859 second and third words of double smobs. Likewise for
1860 SCM_SET_SMOB_DATA_2 and SCM_SET_SMOB_DATA_3.
1861
1862 Also, there is SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS that should be
1863 used to get and set the 16 exra bits in the zeroth word of a smob.
1864
1865 And finally, there is SCM_SMOB_OBJECT and SCM_SMOB_SET_OBJECT for
1866 accesing the first immediate word of a smob as a SCM value, and there
1867 is SCM_SMOB_OBJECT_LOC for getting a pointer to the first immediate
1868 smob word. Like wise for SCM_SMOB_OBJECT_2, etc.
1869
1870 ** New way to deal with non-local exits and re-entries.
1871
1872 There is a new set of functions that essentially do what
1873 scm_internal_dynamic_wind does, but in a way that is more convenient
1874 for C code in some situations. Here is a quick example of how to
1875 prevent a potential memory leak:
1876
1877 void
1878 foo ()
1879 {
1880 char *mem;
1881
1882 scm_dynwind_begin (0);
1883
1884 mem = scm_malloc (100);
1885 scm_dynwind_unwind_handler (free, mem, SCM_F_WIND_EXPLICITLY);
1886
1887 /* MEM would leak if BAR throws an error.
1888 SCM_DYNWIND_UNWIND_HANDLER frees it nevertheless.
1889 */
1890
1891 bar ();
1892
1893 scm_dynwind_end ();
1894
1895 /* Because of SCM_F_WIND_EXPLICITLY, MEM will be freed by
1896 SCM_DYNWIND_END as well.
1897 */
1898 }
1899
1900 For full documentation, see the node "Dynamic Wind" in the manual.
1901
1902 ** New function scm_dynwind_free
1903
1904 This function calls 'free' on a given pointer when a dynwind context
1905 is left. Thus the call to scm_dynwind_unwind_handler above could be
1906 replaced with simply scm_dynwind_free (mem).
1907
1908 ** New functions scm_c_call_with_blocked_asyncs and
1909 scm_c_call_with_unblocked_asyncs
1910
1911 Like scm_call_with_blocked_asyncs etc. but for C functions.
1912
1913 ** New functions scm_dynwind_block_asyncs and scm_dynwind_unblock_asyncs
1914
1915 In addition to scm_c_call_with_blocked_asyncs you can now also use
1916 scm_dynwind_block_asyncs in a 'dynwind context' (see above). Likewise for
1917 scm_c_call_with_unblocked_asyncs and scm_dynwind_unblock_asyncs.
1918
1919 ** The macros SCM_DEFER_INTS, SCM_ALLOW_INTS, SCM_REDEFER_INTS,
1920 SCM_REALLOW_INTS have been deprecated.
1921
1922 They do no longer fulfill their original role of blocking signal
1923 delivery. Depending on what you want to achieve, replace a pair of
1924 SCM_DEFER_INTS and SCM_ALLOW_INTS with a dynwind context that locks a
1925 mutex, blocks asyncs, or both. See node "Critical Sections" in the
1926 manual.
1927
1928 ** The value 'scm_mask_ints' is no longer writable.
1929
1930 Previously, you could set scm_mask_ints directly. This is no longer
1931 possible. Use scm_c_call_with_blocked_asyncs and
1932 scm_c_call_with_unblocked_asyncs instead.
1933
1934 ** New way to temporarily set the current input, output or error ports
1935
1936 C code can now use scm_dynwind_current_<foo>_port in a 'dynwind
1937 context' (see above). <foo> is one of "input", "output" or "error".
1938
1939 ** New way to temporarily set fluids
1940
1941 C code can now use scm_dynwind_fluid in a 'dynwind context' (see
1942 above) to temporarily set the value of a fluid.
1943
1944 ** New types scm_t_intmax and scm_t_uintmax.
1945
1946 On platforms that have them, these types are identical to intmax_t and
1947 uintmax_t, respectively. On other platforms, they are identical to
1948 the largest integer types that Guile knows about.
1949
1950 ** The functions scm_unmemocopy and scm_unmemoize have been removed.
1951
1952 You should not have used them.
1953
1954 ** Many public #defines with generic names have been made private.
1955
1956 #defines with generic names like HAVE_FOO or SIZEOF_FOO have been made
1957 private or renamed with a more suitable public name.
1958
1959 ** The macro SCM_TYP16S has been deprecated.
1960
1961 This macro is not intended for public use.
1962
1963 ** The macro SCM_SLOPPY_INEXACTP has been deprecated.
1964
1965 Use scm_is_true (scm_inexact_p (...)) instead.
1966
1967 ** The macro SCM_SLOPPY_REALP has been deprecated.
1968
1969 Use scm_is_real instead.
1970
1971 ** The macro SCM_SLOPPY_COMPLEXP has been deprecated.
1972
1973 Use scm_is_complex instead.
1974
1975 ** Some preprocessor defines have been deprecated.
1976
1977 These defines indicated whether a certain feature was present in Guile
1978 or not. Going forward, assume that the features are always present.
1979
1980 The macros are: USE_THREADS, GUILE_ISELECT, READER_EXTENSIONS,
1981 DEBUG_EXTENSIONS, DYNAMIC_LINKING.
1982
1983 The following macros have been removed completely: MEMOIZE_LOCALS,
1984 SCM_RECKLESS, SCM_CAUTIOUS.
1985
1986 ** The preprocessor define STACK_DIRECTION has been deprecated.
1987
1988 There should be no need to know about the stack direction for ordinary
1989 programs.
1990
1991 ** New function: scm_effective_version
1992
1993 Returns the "effective" version number. This is just the normal full
1994 version string without the final micro-version number. See "Changes
1995 to the distribution" above.
1996
1997 ** The function scm_call_with_new_thread has a new prototype.
1998
1999 Instead of taking a list with the thunk and handler, these two
2000 arguments are now passed directly:
2001
2002 SCM scm_call_with_new_thread (SCM thunk, SCM handler);
2003
2004 This is an incompatible change.
2005
2006 ** New snarfer macro SCM_DEFINE_PUBLIC.
2007
2008 This is like SCM_DEFINE, but also calls scm_c_export for the defined
2009 function in the init section.
2010
2011 ** The snarfer macro SCM_SNARF_INIT is now officially supported.
2012
2013 ** Garbage collector rewrite.
2014
2015 The garbage collector is cleaned up a lot, and now uses lazy
2016 sweeping. This is reflected in the output of (gc-stats); since cells
2017 are being freed when they are allocated, the cells-allocated field
2018 stays roughly constant.
2019
2020 For malloc related triggers, the behavior is changed. It uses the same
2021 heuristic as the cell-triggered collections. It may be tuned with the
2022 environment variables GUILE_MIN_YIELD_MALLOC. This is the percentage
2023 for minimum yield of malloc related triggers. The default is 40.
2024 GUILE_INIT_MALLOC_LIMIT sets the initial trigger for doing a GC. The
2025 default is 200 kb.
2026
2027 Debugging operations for the freelist have been deprecated, along with
2028 the C variables that control garbage collection. The environment
2029 variables GUILE_MAX_SEGMENT_SIZE, GUILE_INIT_SEGMENT_SIZE_2,
2030 GUILE_INIT_SEGMENT_SIZE_1, and GUILE_MIN_YIELD_2 should be used.
2031
2032 For understanding the memory usage of a GUILE program, the routine
2033 gc-live-object-stats returns an alist containing the number of live
2034 objects for every type.
2035
2036
2037 ** The function scm_definedp has been renamed to scm_defined_p
2038
2039 The name scm_definedp is deprecated.
2040
2041 ** The struct scm_cell type has been renamed to scm_t_cell
2042
2043 This is in accordance to Guile's naming scheme for types. Note that
2044 the name scm_cell is now used for a function that allocates and
2045 initializes a new cell (see below).
2046
2047 ** New functions for memory management
2048
2049 A new set of functions for memory management has been added since the
2050 old way (scm_must_malloc, scm_must_free, etc) was error prone and
2051 indeed, Guile itself contained some long standing bugs that could
2052 cause aborts in long running programs.
2053
2054 The new functions are more symmetrical and do not need cooperation
2055 from smob free routines, among other improvements.
2056
2057 The new functions are scm_malloc, scm_realloc, scm_calloc, scm_strdup,
2058 scm_strndup, scm_gc_malloc, scm_gc_calloc, scm_gc_realloc,
2059 scm_gc_free, scm_gc_register_collectable_memory, and
2060 scm_gc_unregister_collectable_memory. Refer to the manual for more
2061 details and for upgrading instructions.
2062
2063 The old functions for memory management have been deprecated. They
2064 are: scm_must_malloc, scm_must_realloc, scm_must_free,
2065 scm_must_strdup, scm_must_strndup, scm_done_malloc, scm_done_free.
2066
2067 ** Declarations of exported features are marked with SCM_API.
2068
2069 Every declaration of a feature that belongs to the exported Guile API
2070 has been marked by adding the macro "SCM_API" to the start of the
2071 declaration. This macro can expand into different things, the most
2072 common of which is just "extern" for Unix platforms. On Win32, it can
2073 be used to control which symbols are exported from a DLL.
2074
2075 If you `#define SCM_IMPORT' before including <libguile.h>, SCM_API
2076 will expand into "__declspec (dllimport) extern", which is needed for
2077 linking to the Guile DLL in Windows.
2078
2079 There are also SCM_RL_IMPORT, SCM_SRFI1314_IMPORT, and
2080 SCM_SRFI4_IMPORT, for the corresponding libraries.
2081
2082 ** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated.
2083
2084 Use the new functions scm_cell and scm_double_cell instead. The old
2085 macros had problems because with them allocation and initialization
2086 was separated and the GC could sometimes observe half initialized
2087 cells. Only careful coding by the user of SCM_NEWCELL and
2088 SCM_NEWCELL2 could make this safe and efficient.
2089
2090 ** CHECK_ENTRY, CHECK_APPLY and CHECK_EXIT have been deprecated.
2091
2092 Use the variables scm_check_entry_p, scm_check_apply_p and scm_check_exit_p
2093 instead.
2094
2095 ** SRCBRKP has been deprecated.
2096
2097 Use scm_c_source_property_breakpoint_p instead.
2098
2099 ** Deprecated: scm_makmacro
2100
2101 Change your code to use either scm_makmmacro or to define macros in
2102 Scheme, using 'define-macro'.
2103
2104 ** New function scm_c_port_for_each.
2105
2106 This function is like scm_port_for_each but takes a pointer to a C
2107 function as the callback instead of a SCM value.
2108
2109 ** The names scm_internal_select, scm_thread_sleep, and
2110 scm_thread_usleep have been discouraged.
2111
2112 Use scm_std_select, scm_std_sleep, scm_std_usleep instead.
2113
2114 ** The GC can no longer be blocked.
2115
2116 The global flags scm_gc_heap_lock and scm_block_gc have been removed.
2117 The GC can now run (partially) concurrently with other code and thus
2118 blocking it is not well defined.
2119
2120 ** Many definitions have been removed that were previously deprecated.
2121
2122 scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify,
2123 scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify,
2124 scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2,
2125 scm_tc16_allocated, SCM_SET_SYMBOL_HASH, SCM_IM_NIL_IFY, SCM_IM_T_IFY,
2126 SCM_IM_0_COND, SCM_IM_0_IFY, SCM_IM_1_IFY, SCM_GC_SET_ALLOCATED,
2127 scm_debug_newcell, scm_debug_newcell2, SCM_HUP_SIGNAL, SCM_INT_SIGNAL,
2128 SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, SCM_ALRM_SIGNAL,
2129 SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, SCM_ORD_SIG,
2130 SCM_NUM_SIGS, scm_top_level_lookup_closure_var,
2131 *top-level-lookup-closure*, scm_system_transformer, scm_eval_3,
2132 scm_eval2, root_module_lookup_closure, SCM_SLOPPY_STRINGP,
2133 SCM_RWSTRINGP, scm_read_only_string_p, scm_make_shared_substring,
2134 scm_tc7_substring, sym_huh, SCM_VARVCELL, SCM_UDVARIABLEP,
2135 SCM_DEFVARIABLEP, scm_mkbig, scm_big2inum, scm_adjbig, scm_normbig,
2136 scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl, SCM_FIXNUM_BIT,
2137 SCM_SETCHARS, SCM_SLOPPY_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
2138 SCM_LENGTH_MAX, SCM_SETLENGTH, SCM_ROSTRINGP, SCM_ROLENGTH,
2139 SCM_ROCHARS, SCM_ROUCHARS, SCM_SUBSTRP, SCM_COERCE_SUBSTR,
2140 scm_sym2vcell, scm_intern, scm_intern0, scm_sysintern, scm_sysintern0,
2141 scm_sysintern0_no_module_lookup, scm_init_symbols_deprecated,
2142 scm_vector_set_length_x, scm_contregs, scm_debug_info,
2143 scm_debug_frame, SCM_DSIDEVAL, SCM_CONST_LONG, SCM_VCELL,
2144 SCM_GLOBAL_VCELL, SCM_VCELL_INIT, SCM_GLOBAL_VCELL_INIT,
2145 SCM_HUGE_LENGTH, SCM_VALIDATE_STRINGORSUBSTR, SCM_VALIDATE_ROSTRING,
2146 SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY,
2147 SCM_VALIDATE_RWSTRING, DIGITS, scm_small_istr2int, scm_istr2int,
2148 scm_istr2flo, scm_istring2number, scm_istr2int, scm_istr2flo,
2149 scm_istring2number, scm_vtable_index_vcell, scm_si_vcell, SCM_ECONSP,
2150 SCM_NECONSP, SCM_GLOC_VAR, SCM_GLOC_VAL, SCM_GLOC_SET_VAL,
2151 SCM_GLOC_VAL_LOC, scm_make_gloc, scm_gloc_p, scm_tc16_variable,
2152 SCM_CHARS, SCM_LENGTH, SCM_SET_STRING_CHARS, SCM_SET_STRING_LENGTH.
2153
2154 * Changes to bundled modules
2155
2156 ** (ice-9 debug)
2157
2158 Using the (ice-9 debug) module no longer automatically switches Guile
2159 to use the debugging evaluator. If you want to switch to the
2160 debugging evaluator (which is needed for backtrace information if you
2161 hit an error), please add an explicit "(debug-enable 'debug)" to your
2162 code just after the code to use (ice-9 debug).
2163
2164 \f
2165 Changes since Guile 1.4:
2166
2167 * Changes to the distribution
2168
2169 ** A top-level TODO file is included.
2170
2171 ** Guile now uses a versioning scheme similar to that of the Linux kernel.
2172
2173 Guile now always uses three numbers to represent the version,
2174 i.e. "1.6.5". The first number, 1, is the major version number, the
2175 second number, 6, is the minor version number, and the third number,
2176 5, is the micro version number. Changes in major version number
2177 indicate major changes in Guile.
2178
2179 Minor version numbers that are even denote stable releases, and odd
2180 minor version numbers denote development versions (which may be
2181 unstable). The micro version number indicates a minor sub-revision of
2182 a given MAJOR.MINOR release.
2183
2184 In keeping with the new scheme, (minor-version) and scm_minor_version
2185 no longer return everything but the major version number. They now
2186 just return the minor version number. Two new functions
2187 (micro-version) and scm_micro_version have been added to report the
2188 micro version number.
2189
2190 In addition, ./GUILE-VERSION now defines GUILE_MICRO_VERSION.
2191
2192 ** New preprocessor definitions are available for checking versions.
2193
2194 version.h now #defines SCM_MAJOR_VERSION, SCM_MINOR_VERSION, and
2195 SCM_MICRO_VERSION to the appropriate integer values.
2196
2197 ** Guile now actively warns about deprecated features.
2198
2199 The new configure option `--enable-deprecated=LEVEL' and the
2200 environment variable GUILE_WARN_DEPRECATED control this mechanism.
2201 See INSTALL and README for more information.
2202
2203 ** Guile is much more likely to work on 64-bit architectures.
2204
2205 Guile now compiles and passes "make check" with only two UNRESOLVED GC
2206 cases on Alpha and ia64 based machines now. Thanks to John Goerzen
2207 for the use of a test machine, and thanks to Stefan Jahn for ia64
2208 patches.
2209
2210 ** New functions: setitimer and getitimer.
2211
2212 These implement a fairly direct interface to the libc functions of the
2213 same name.
2214
2215 ** The #. reader extension is now disabled by default.
2216
2217 For safety reasons, #. evaluation is disabled by default. To
2218 re-enable it, set the fluid read-eval? to #t. For example:
2219
2220 (fluid-set! read-eval? #t)
2221
2222 but make sure you realize the potential security risks involved. With
2223 read-eval? enabled, reading a data file from an untrusted source can
2224 be dangerous.
2225
2226 ** New SRFI modules have been added:
2227
2228 SRFI-0 `cond-expand' is now supported in Guile, without requiring
2229 using a module.
2230
2231 (srfi srfi-1) is a library containing many useful pair- and list-processing
2232 procedures.
2233
2234 (srfi srfi-2) exports and-let*.
2235
2236 (srfi srfi-4) implements homogeneous numeric vector datatypes.
2237
2238 (srfi srfi-6) is a dummy module for now, since guile already provides
2239 all of the srfi-6 procedures by default: open-input-string,
2240 open-output-string, get-output-string.
2241
2242 (srfi srfi-8) exports receive.
2243
2244 (srfi srfi-9) exports define-record-type.
2245
2246 (srfi srfi-10) exports define-reader-ctor and implements the reader
2247 extension #,().
2248
2249 (srfi srfi-11) exports let-values and let*-values.
2250
2251 (srfi srfi-13) implements the SRFI String Library.
2252
2253 (srfi srfi-14) implements the SRFI Character-Set Library.
2254
2255 (srfi srfi-17) implements setter and getter-with-setter and redefines
2256 some accessor procedures as procedures with getters. (such as car,
2257 cdr, vector-ref etc.)
2258
2259 (srfi srfi-19) implements the SRFI Time/Date Library.
2260
2261 ** New scripts / "executable modules"
2262
2263 Subdirectory "scripts" contains Scheme modules that are packaged to
2264 also be executable as scripts. At this time, these scripts are available:
2265
2266 display-commentary
2267 doc-snarf
2268 generate-autoload
2269 punify
2270 read-scheme-source
2271 use2dot
2272
2273 See README there for more info.
2274
2275 These scripts can be invoked from the shell with the new program
2276 "guile-tools", which keeps track of installation directory for you.
2277 For example:
2278
2279 $ guile-tools display-commentary srfi/*.scm
2280
2281 guile-tools is copied to the standard $bindir on "make install".
2282
2283 ** New module (ice-9 stack-catch):
2284
2285 stack-catch is like catch, but saves the current state of the stack in
2286 the fluid the-last-stack. This fluid can be useful when using the
2287 debugger and when re-throwing an error.
2288
2289 ** The module (ice-9 and-let*) has been renamed to (ice-9 and-let-star)
2290
2291 This has been done to prevent problems on lesser operating systems
2292 that can't tolerate `*'s in file names. The exported macro continues
2293 to be named `and-let*', of course.
2294
2295 On systems that support it, there is also a compatibility module named
2296 (ice-9 and-let*). It will go away in the next release.
2297
2298 ** New modules (oop goops) etc.:
2299
2300 (oop goops)
2301 (oop goops describe)
2302 (oop goops save)
2303 (oop goops active-slot)
2304 (oop goops composite-slot)
2305
2306 The Guile Object Oriented Programming System (GOOPS) has been
2307 integrated into Guile. For further information, consult the GOOPS
2308 manual and tutorial in the `doc' directory.
2309
2310 ** New module (ice-9 rdelim).
2311
2312 This exports the following procedures which were previously defined
2313 in the default environment:
2314
2315 read-line read-line! read-delimited read-delimited! %read-delimited!
2316 %read-line write-line
2317
2318 For backwards compatibility the definitions are still imported into the
2319 default environment in this version of Guile. However you should add:
2320
2321 (use-modules (ice-9 rdelim))
2322
2323 to any program which uses the definitions, since this may change in
2324 future.
2325
2326 Alternatively, if guile-scsh is installed, the (scsh rdelim) module
2327 can be used for similar functionality.
2328
2329 ** New module (ice-9 rw)
2330
2331 This is a subset of the (scsh rw) module from guile-scsh. Currently
2332 it defines two procedures:
2333
2334 *** New function: read-string!/partial str [port_or_fdes [start [end]]]
2335
2336 Read characters from a port or file descriptor into a string STR.
2337 A port must have an underlying file descriptor -- a so-called
2338 fport. This procedure is scsh-compatible and can efficiently read
2339 large strings.
2340
2341 *** New function: write-string/partial str [port_or_fdes [start [end]]]
2342
2343 Write characters from a string STR to a port or file descriptor.
2344 A port must have an underlying file descriptor -- a so-called
2345 fport. This procedure is mostly compatible and can efficiently
2346 write large strings.
2347
2348 ** New module (ice-9 match)
2349
2350 This module includes Andrew K. Wright's pattern matcher. See
2351 ice-9/match.scm for brief description or
2352
2353 http://www.star-lab.com/wright/code.html
2354
2355 for complete documentation.
2356
2357 ** New module (ice-9 buffered-input)
2358
2359 This module provides procedures to construct an input port from an
2360 underlying source of input that reads and returns its input in chunks.
2361 The underlying input source is a Scheme procedure, specified by the
2362 caller, which the port invokes whenever it needs more input.
2363
2364 This is useful when building an input port whose back end is Readline
2365 or a UI element such as the GtkEntry widget.
2366
2367 ** Documentation
2368
2369 The reference and tutorial documentation that was previously
2370 distributed separately, as `guile-doc', is now included in the core
2371 Guile distribution. The documentation consists of the following
2372 manuals.
2373
2374 - The Guile Tutorial (guile-tut.texi) contains a tutorial introduction
2375 to using Guile.
2376
2377 - The Guile Reference Manual (guile.texi) contains (or is intended to
2378 contain) reference documentation on all aspects of Guile.
2379
2380 - The GOOPS Manual (goops.texi) contains both tutorial-style and
2381 reference documentation for using GOOPS, Guile's Object Oriented
2382 Programming System.
2383
2384 - The Revised^5 Report on the Algorithmic Language Scheme
2385 (r5rs.texi).
2386
2387 See the README file in the `doc' directory for more details.
2388
2389 ** There are a couple of examples in the examples/ directory now.
2390
2391 * Changes to the stand-alone interpreter
2392
2393 ** New command line option `--use-srfi'
2394
2395 Using this option, SRFI modules can be loaded on startup and be
2396 available right from the beginning. This makes programming portable
2397 Scheme programs easier.
2398
2399 The option `--use-srfi' expects a comma-separated list of numbers,
2400 each representing a SRFI number to be loaded into the interpreter
2401 before starting evaluating a script file or the REPL. Additionally,
2402 the feature identifier for the loaded SRFIs is recognized by
2403 `cond-expand' when using this option.
2404
2405 Example:
2406 $ guile --use-srfi=8,13
2407 guile> (receive (x z) (values 1 2) (+ 1 2))
2408 3
2409 guile> (string-pad "bla" 20)
2410 " bla"
2411
2412 ** Guile now always starts up in the `(guile-user)' module.
2413
2414 Previously, scripts executed via the `-s' option would run in the
2415 `(guile)' module and the repl would run in the `(guile-user)' module.
2416 Now every user action takes place in the `(guile-user)' module by
2417 default.
2418
2419 * Changes to Scheme functions and syntax
2420
2421 ** Character classifiers work for non-ASCII characters.
2422
2423 The predicates `char-alphabetic?', `char-numeric?',
2424 `char-whitespace?', `char-lower?', `char-upper?' and `char-is-both?'
2425 no longer check whether their arguments are ASCII characters.
2426 Previously, a character would only be considered alphabetic when it
2427 was also ASCII, for example.
2428
2429 ** Previously deprecated Scheme functions have been removed:
2430
2431 tag - no replacement.
2432 fseek - replaced by seek.
2433 list* - replaced by cons*.
2434
2435 ** It's now possible to create modules with controlled environments
2436
2437 Example:
2438
2439 (use-modules (ice-9 safe))
2440 (define m (make-safe-module))
2441 ;;; m will now be a module containing only a safe subset of R5RS
2442 (eval '(+ 1 2) m) --> 3
2443 (eval 'load m) --> ERROR: Unbound variable: load
2444
2445 ** Evaluation of "()", the empty list, is now an error.
2446
2447 Previously, the expression "()" evaluated to the empty list. This has
2448 been changed to signal a "missing expression" error. The correct way
2449 to write the empty list as a literal constant is to use quote: "'()".
2450
2451 ** New concept of `Guile Extensions'.
2452
2453 A Guile Extension is just a ordinary shared library that can be linked
2454 at run-time. We found it advantageous to give this simple concept a
2455 dedicated name to distinguish the issues related to shared libraries
2456 from the issues related to the module system.
2457
2458 *** New function: load-extension
2459
2460 Executing (load-extension lib init) is mostly equivalent to
2461
2462 (dynamic-call init (dynamic-link lib))
2463
2464 except when scm_register_extension has been called previously.
2465 Whenever appropriate, you should use `load-extension' instead of
2466 dynamic-link and dynamic-call.
2467
2468 *** New C function: scm_c_register_extension
2469
2470 This function registers a initialization function for use by
2471 `load-extension'. Use it when you don't want specific extensions to
2472 be loaded as shared libraries (for example on platforms that don't
2473 support dynamic linking).
2474
2475 ** Auto-loading of compiled-code modules is deprecated.
2476
2477 Guile used to be able to automatically find and link a shared
2478 library to satisfy requests for a module. For example, the module
2479 `(foo bar)' could be implemented by placing a shared library named
2480 "foo/libbar.so" (or with a different extension) in a directory on the
2481 load path of Guile.
2482
2483 This has been found to be too tricky, and is no longer supported. The
2484 shared libraries are now called "extensions". You should now write a
2485 small Scheme file that calls `load-extension' to load the shared
2486 library and initialize it explicitly.
2487
2488 The shared libraries themselves should be installed in the usual
2489 places for shared libraries, with names like "libguile-foo-bar".
2490
2491 For example, place this into a file "foo/bar.scm"
2492
2493 (define-module (foo bar))
2494
2495 (load-extension "libguile-foo-bar" "foobar_init")
2496
2497 ** Backward incompatible change: eval EXP ENVIRONMENT-SPECIFIER
2498
2499 `eval' is now R5RS, that is it takes two arguments.
2500 The second argument is an environment specifier, i.e. either
2501
2502 (scheme-report-environment 5)
2503 (null-environment 5)
2504 (interaction-environment)
2505
2506 or
2507
2508 any module.
2509
2510 ** The module system has been made more disciplined.
2511
2512 The function `eval' will save and restore the current module around
2513 the evaluation of the specified expression. While this expression is
2514 evaluated, `(current-module)' will now return the right module, which
2515 is the module specified as the second argument to `eval'.
2516
2517 A consequence of this change is that `eval' is not particularly
2518 useful when you want allow the evaluated code to change what module is
2519 designated as the current module and have this change persist from one
2520 call to `eval' to the next. The read-eval-print-loop is an example
2521 where `eval' is now inadequate. To compensate, there is a new
2522 function `primitive-eval' that does not take a module specifier and
2523 that does not save/restore the current module. You should use this
2524 function together with `set-current-module', `current-module', etc
2525 when you want to have more control over the state that is carried from
2526 one eval to the next.
2527
2528 Additionally, it has been made sure that forms that are evaluated at
2529 the top level are always evaluated with respect to the current module.
2530 Previously, subforms of top-level forms such as `begin', `case',
2531 etc. did not respect changes to the current module although these
2532 subforms are at the top-level as well.
2533
2534 To prevent strange behavior, the forms `define-module',
2535 `use-modules', `use-syntax', and `export' have been restricted to only
2536 work on the top level. The forms `define-public' and
2537 `defmacro-public' only export the new binding on the top level. They
2538 behave just like `define' and `defmacro', respectively, when they are
2539 used in a lexical environment.
2540
2541 Also, `export' will no longer silently re-export bindings imported
2542 from a used module. It will emit a `deprecation' warning and will
2543 cease to perform any re-export in the next version. If you actually
2544 want to re-export bindings, use the new `re-export' in place of
2545 `export'. The new `re-export' will not make copies of variables when
2546 rexporting them, as `export' did wrongly.
2547
2548 ** Module system now allows selection and renaming of imported bindings
2549
2550 Previously, when using `use-modules' or the `#:use-module' clause in
2551 the `define-module' form, all the bindings (association of symbols to
2552 values) for imported modules were added to the "current module" on an
2553 as-is basis. This has been changed to allow finer control through two
2554 new facilities: selection and renaming.
2555
2556 You can now select which of the imported module's bindings are to be
2557 visible in the current module by using the `:select' clause. This
2558 clause also can be used to rename individual bindings. For example:
2559
2560 ;; import all bindings no questions asked
2561 (use-modules (ice-9 common-list))
2562
2563 ;; import four bindings, renaming two of them;
2564 ;; the current module sees: every some zonk-y zonk-n
2565 (use-modules ((ice-9 common-list)
2566 :select (every some
2567 (remove-if . zonk-y)
2568 (remove-if-not . zonk-n))))
2569
2570 You can also programmatically rename all selected bindings using the
2571 `:renamer' clause, which specifies a proc that takes a symbol and
2572 returns another symbol. Because it is common practice to use a prefix,
2573 we now provide the convenience procedure `symbol-prefix-proc'. For
2574 example:
2575
2576 ;; import four bindings, renaming two of them specifically,
2577 ;; and all four w/ prefix "CL:";
2578 ;; the current module sees: CL:every CL:some CL:zonk-y CL:zonk-n
2579 (use-modules ((ice-9 common-list)
2580 :select (every some
2581 (remove-if . zonk-y)
2582 (remove-if-not . zonk-n))
2583 :renamer (symbol-prefix-proc 'CL:)))
2584
2585 ;; import four bindings, renaming two of them specifically,
2586 ;; and all four by upcasing.
2587 ;; the current module sees: EVERY SOME ZONK-Y ZONK-N
2588 (define (upcase-symbol sym)
2589 (string->symbol (string-upcase (symbol->string sym))))
2590
2591 (use-modules ((ice-9 common-list)
2592 :select (every some
2593 (remove-if . zonk-y)
2594 (remove-if-not . zonk-n))
2595 :renamer upcase-symbol))
2596
2597 Note that programmatic renaming is done *after* individual renaming.
2598 Also, the above examples show `use-modules', but the same facilities are
2599 available for the `#:use-module' clause of `define-module'.
2600
2601 See manual for more info.
2602
2603 ** The semantics of guardians have changed.
2604
2605 The changes are for the most part compatible. An important criterion
2606 was to keep the typical usage of guardians as simple as before, but to
2607 make the semantics safer and (as a result) more useful.
2608
2609 *** All objects returned from guardians are now properly alive.
2610
2611 It is now guaranteed that any object referenced by an object returned
2612 from a guardian is alive. It's now impossible for a guardian to
2613 return a "contained" object before its "containing" object.
2614
2615 One incompatible (but probably not very important) change resulting
2616 from this is that it is no longer possible to guard objects that
2617 indirectly reference themselves (i.e. are parts of cycles). If you do
2618 so accidentally, you'll get a warning.
2619
2620 *** There are now two types of guardians: greedy and sharing.
2621
2622 If you call (make-guardian #t) or just (make-guardian), you'll get a
2623 greedy guardian, and for (make-guardian #f) a sharing guardian.
2624
2625 Greedy guardians are the default because they are more "defensive".
2626 You can only greedily guard an object once. If you guard an object
2627 more than once, once in a greedy guardian and the rest of times in
2628 sharing guardians, then it is guaranteed that the object won't be
2629 returned from sharing guardians as long as it is greedily guarded
2630 and/or alive.
2631
2632 Guardians returned by calls to `make-guardian' can now take one more
2633 optional parameter, which says whether to throw an error in case an
2634 attempt is made to greedily guard an object that is already greedily
2635 guarded. The default is true, i.e. throw an error. If the parameter
2636 is false, the guardian invocation returns #t if guarding was
2637 successful and #f if it wasn't.
2638
2639 Also, since greedy guarding is, in effect, a side-effecting operation
2640 on objects, a new function is introduced: `destroy-guardian!'.
2641 Invoking this function on a guardian renders it unoperative and, if
2642 the guardian is greedy, clears the "greedily guarded" property of the
2643 objects that were guarded by it, thus undoing the side effect.
2644
2645 Note that all this hair is hardly very important, since guardian
2646 objects are usually permanent.
2647
2648 ** Continuations created by call-with-current-continuation now accept
2649 any number of arguments, as required by R5RS.
2650
2651 ** New function `issue-deprecation-warning'
2652
2653 This function is used to display the deprecation messages that are
2654 controlled by GUILE_WARN_DEPRECATION as explained in the README.
2655
2656 (define (id x)
2657 (issue-deprecation-warning "`id' is deprecated. Use `identity' instead.")
2658 (identity x))
2659
2660 guile> (id 1)
2661 ;; `id' is deprecated. Use `identity' instead.
2662 1
2663 guile> (id 1)
2664 1
2665
2666 ** New syntax `begin-deprecated'
2667
2668 When deprecated features are included (as determined by the configure
2669 option --enable-deprecated), `begin-deprecated' is identical to
2670 `begin'. When deprecated features are excluded, it always evaluates
2671 to `#f', ignoring the body forms.
2672
2673 ** New function `make-object-property'
2674
2675 This function returns a new `procedure with setter' P that can be used
2676 to attach a property to objects. When calling P as
2677
2678 (set! (P obj) val)
2679
2680 where `obj' is any kind of object, it attaches `val' to `obj' in such
2681 a way that it can be retrieved by calling P as
2682
2683 (P obj)
2684
2685 This function will replace procedure properties, symbol properties and
2686 source properties eventually.
2687
2688 ** Module (ice-9 optargs) now uses keywords instead of `#&'.
2689
2690 Instead of #&optional, #&key, etc you should now use #:optional,
2691 #:key, etc. Since #:optional is a keyword, you can write it as just
2692 :optional when (read-set! keywords 'prefix) is active.
2693
2694 The old reader syntax `#&' is still supported, but deprecated. It
2695 will be removed in the next release.
2696
2697 ** New define-module option: pure
2698
2699 Tells the module system not to include any bindings from the root
2700 module.
2701
2702 Example:
2703
2704 (define-module (totally-empty-module)
2705 :pure)
2706
2707 ** New define-module option: export NAME1 ...
2708
2709 Export names NAME1 ...
2710
2711 This option is required if you want to be able to export bindings from
2712 a module which doesn't import one of `define-public' or `export'.
2713
2714 Example:
2715
2716 (define-module (foo)
2717 :pure
2718 :use-module (ice-9 r5rs)
2719 :export (bar))
2720
2721 ;;; Note that we're pure R5RS below this point!
2722
2723 (define (bar)
2724 ...)
2725
2726 ** New function: object->string OBJ
2727
2728 Return a Scheme string obtained by printing a given object.
2729
2730 ** New function: port? X
2731
2732 Returns a boolean indicating whether X is a port. Equivalent to
2733 `(or (input-port? X) (output-port? X))'.
2734
2735 ** New function: file-port?
2736
2737 Determines whether a given object is a port that is related to a file.
2738
2739 ** New function: port-for-each proc
2740
2741 Apply PROC to each port in the Guile port table in turn. The return
2742 value is unspecified. More specifically, PROC is applied exactly once
2743 to every port that exists in the system at the time PORT-FOR-EACH is
2744 invoked. Changes to the port table while PORT-FOR-EACH is running
2745 have no effect as far as PORT-FOR-EACH is concerned.
2746
2747 ** New function: dup2 oldfd newfd
2748
2749 A simple wrapper for the `dup2' system call. Copies the file
2750 descriptor OLDFD to descriptor number NEWFD, replacing the
2751 previous meaning of NEWFD. Both OLDFD and NEWFD must be integers.
2752 Unlike for dup->fdes or primitive-move->fdes, no attempt is made
2753 to move away ports which are using NEWFD. The return value is
2754 unspecified.
2755
2756 ** New function: close-fdes fd
2757
2758 A simple wrapper for the `close' system call. Close file
2759 descriptor FD, which must be an integer. Unlike close (*note
2760 close: Ports and File Descriptors.), the file descriptor will be
2761 closed even if a port is using it. The return value is
2762 unspecified.
2763
2764 ** New function: crypt password salt
2765
2766 Encrypts `password' using the standard unix password encryption
2767 algorithm.
2768
2769 ** New function: chroot path
2770
2771 Change the root directory of the running process to `path'.
2772
2773 ** New functions: getlogin, cuserid
2774
2775 Return the login name or the user name of the current effective user
2776 id, respectively.
2777
2778 ** New functions: getpriority which who, setpriority which who prio
2779
2780 Get or set the priority of the running process.
2781
2782 ** New function: getpass prompt
2783
2784 Read a password from the terminal, first displaying `prompt' and
2785 disabling echoing.
2786
2787 ** New function: flock file operation
2788
2789 Set/remove an advisory shared or exclusive lock on `file'.
2790
2791 ** New functions: sethostname name, gethostname
2792
2793 Set or get the hostname of the machine the current process is running
2794 on.
2795
2796 ** New function: mkstemp! tmpl
2797
2798 mkstemp creates a new unique file in the file system and returns a
2799 new buffered port open for reading and writing to the file. TMPL
2800 is a string specifying where the file should be created: it must
2801 end with `XXXXXX' and will be changed in place to return the name
2802 of the temporary file.
2803
2804 ** New function: open-input-string string
2805
2806 Return an input string port which delivers the characters from
2807 `string'. This procedure, together with `open-output-string' and
2808 `get-output-string' implements SRFI-6.
2809
2810 ** New function: open-output-string
2811
2812 Return an output string port which collects all data written to it.
2813 The data can then be retrieved by `get-output-string'.
2814
2815 ** New function: get-output-string
2816
2817 Return the contents of an output string port.
2818
2819 ** New function: identity
2820
2821 Return the argument.
2822
2823 ** socket, connect, accept etc., now have support for IPv6. IPv6 addresses
2824 are represented in Scheme as integers with normal host byte ordering.
2825
2826 ** New function: inet-pton family address
2827
2828 Convert a printable string network address into an integer. Note that
2829 unlike the C version of this function, the result is an integer with
2830 normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
2831 e.g.,
2832
2833 (inet-pton AF_INET "127.0.0.1") => 2130706433
2834 (inet-pton AF_INET6 "::1") => 1
2835
2836 ** New function: inet-ntop family address
2837
2838 Convert an integer network address into a printable string. Note that
2839 unlike the C version of this function, the input is an integer with
2840 normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
2841 e.g.,
2842
2843 (inet-ntop AF_INET 2130706433) => "127.0.0.1"
2844 (inet-ntop AF_INET6 (- (expt 2 128) 1)) =>
2845 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
2846
2847 ** Deprecated: id
2848
2849 Use `identity' instead.
2850
2851 ** Deprecated: -1+
2852
2853 Use `1-' instead.
2854
2855 ** Deprecated: return-it
2856
2857 Do without it.
2858
2859 ** Deprecated: string-character-length
2860
2861 Use `string-length' instead.
2862
2863 ** Deprecated: flags
2864
2865 Use `logior' instead.
2866
2867 ** Deprecated: close-all-ports-except.
2868
2869 This was intended for closing ports in a child process after a fork,
2870 but it has the undesirable side effect of flushing buffers.
2871 port-for-each is more flexible.
2872
2873 ** The (ice-9 popen) module now attempts to set up file descriptors in
2874 the child process from the current Scheme ports, instead of using the
2875 current values of file descriptors 0, 1, and 2 in the parent process.
2876
2877 ** Removed function: builtin-weak-bindings
2878
2879 There is no such concept as a weak binding any more.
2880
2881 ** Removed constants: bignum-radix, scm-line-incrementors
2882
2883 ** define-method: New syntax mandatory.
2884
2885 The new method syntax is now mandatory:
2886
2887 (define-method (NAME ARG-SPEC ...) BODY ...)
2888 (define-method (NAME ARG-SPEC ... . REST-ARG) BODY ...)
2889
2890 ARG-SPEC ::= ARG-NAME | (ARG-NAME TYPE)
2891 REST-ARG ::= ARG-NAME
2892
2893 If you have old code using the old syntax, import
2894 (oop goops old-define-method) before (oop goops) as in:
2895
2896 (use-modules (oop goops old-define-method) (oop goops))
2897
2898 ** Deprecated function: builtin-variable
2899 Removed function: builtin-bindings
2900
2901 There is no longer a distinction between builtin or other variables.
2902 Use module system operations for all variables.
2903
2904 ** Lazy-catch handlers are no longer allowed to return.
2905
2906 That is, a call to `throw', `error', etc is now guaranteed to not
2907 return.
2908
2909 ** Bugfixes for (ice-9 getopt-long)
2910
2911 This module is now tested using test-suite/tests/getopt-long.test.
2912 The following bugs have been fixed:
2913
2914 *** Parsing for options that are specified to have `optional' args now checks
2915 if the next element is an option instead of unconditionally taking it as the
2916 option arg.
2917
2918 *** An error is now thrown for `--opt=val' when the option description
2919 does not specify `(value #t)' or `(value optional)'. This condition used to
2920 be accepted w/o error, contrary to the documentation.
2921
2922 *** The error message for unrecognized options is now more informative.
2923 It used to be "not a record", an artifact of the implementation.
2924
2925 *** The error message for `--opt' terminating the arg list (no value), when
2926 `(value #t)' is specified, is now more informative. It used to be "not enough
2927 args".
2928
2929 *** "Clumped" single-char args now preserve trailing string, use it as arg.
2930 The expansion used to be like so:
2931
2932 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "--xyz")
2933
2934 Note that the "5d" is dropped. Now it is like so:
2935
2936 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "5d" "--xyz")
2937
2938 This enables single-char options to have adjoining arguments as long as their
2939 constituent characters are not potential single-char options.
2940
2941 ** (ice-9 session) procedure `arity' now works with (ice-9 optargs) `lambda*'
2942
2943 The `lambda*' and derivative forms in (ice-9 optargs) now set a procedure
2944 property `arglist', which can be retrieved by `arity'. The result is that
2945 `arity' can give more detailed information than before:
2946
2947 Before:
2948
2949 guile> (use-modules (ice-9 optargs))
2950 guile> (define* (foo #:optional a b c) a)
2951 guile> (arity foo)
2952 0 or more arguments in `lambda*:G0'.
2953
2954 After:
2955
2956 guile> (arity foo)
2957 3 optional arguments: `a', `b' and `c'.
2958 guile> (define* (bar a b #:key c d #:allow-other-keys) a)
2959 guile> (arity bar)
2960 2 required arguments: `a' and `b', 2 keyword arguments: `c'
2961 and `d', other keywords allowed.
2962 guile> (define* (baz a b #:optional c #:rest r) a)
2963 guile> (arity baz)
2964 2 required arguments: `a' and `b', 1 optional argument: `c',
2965 the rest in `r'.
2966
2967 * Changes to the C interface
2968
2969 ** Types have been renamed from scm_*_t to scm_t_*.
2970
2971 This has been done for POSIX sake. It reserves identifiers ending
2972 with "_t". What a concept.
2973
2974 The old names are still available with status `deprecated'.
2975
2976 ** scm_t_bits (former scm_bits_t) is now a unsigned type.
2977
2978 ** Deprecated features have been removed.
2979
2980 *** Macros removed
2981
2982 SCM_INPORTP, SCM_OUTPORTP SCM_ICHRP, SCM_ICHR, SCM_MAKICHR
2983 SCM_SETJMPBUF SCM_NSTRINGP SCM_NRWSTRINGP SCM_NVECTORP SCM_DOUBLE_CELLP
2984
2985 *** C Functions removed
2986
2987 scm_sysmissing scm_tag scm_tc16_flo scm_tc_flo
2988 scm_fseek - replaced by scm_seek.
2989 gc-thunk - replaced by after-gc-hook.
2990 gh_int2scmb - replaced by gh_bool2scm.
2991 scm_tc_dblr - replaced by scm_tc16_real.
2992 scm_tc_dblc - replaced by scm_tc16_complex.
2993 scm_list_star - replaced by scm_cons_star.
2994
2995 ** Deprecated: scm_makfromstr
2996
2997 Use scm_mem2string instead.
2998
2999 ** Deprecated: scm_make_shared_substring
3000
3001 Explicit shared substrings will disappear from Guile.
3002
3003 Instead, "normal" strings will be implemented using sharing
3004 internally, combined with a copy-on-write strategy.
3005
3006 ** Deprecated: scm_read_only_string_p
3007
3008 The concept of read-only strings will disappear in next release of
3009 Guile.
3010
3011 ** Deprecated: scm_sloppy_memq, scm_sloppy_memv, scm_sloppy_member
3012
3013 Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
3014
3015 ** New functions: scm_call_0, scm_call_1, scm_call_2, scm_call_3
3016
3017 Call a procedure with the indicated number of arguments. See "Fly
3018 Evaluation" in the manual.
3019
3020 ** New functions: scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3
3021
3022 Call a procedure with the indicated number of arguments and a list of
3023 further arguments. See "Fly Evaluation" in the manual.
3024
3025 ** New functions: scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5
3026
3027 Create a list of the given number of elements. See "List
3028 Constructors" in the manual.
3029
3030 ** Renamed function: scm_listify has been replaced by scm_list_n.
3031
3032 ** Deprecated macros: SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4,
3033 SCM_LIST5, SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9.
3034
3035 Use functions scm_list_N instead.
3036
3037 ** New function: scm_c_read (SCM port, void *buffer, scm_sizet size)
3038
3039 Used by an application to read arbitrary number of bytes from a port.
3040 Same semantics as libc read, except that scm_c_read only returns less
3041 than SIZE bytes if at end-of-file.
3042
3043 Warning: Doesn't update port line and column counts!
3044
3045 ** New function: scm_c_write (SCM port, const void *ptr, scm_sizet size)
3046
3047 Used by an application to write arbitrary number of bytes to an SCM
3048 port. Similar semantics as libc write. However, unlike libc
3049 write, scm_c_write writes the requested number of bytes and has no
3050 return value.
3051
3052 Warning: Doesn't update port line and column counts!
3053
3054 ** New function: scm_init_guile ()
3055
3056 In contrast to scm_boot_guile, scm_init_guile will return normally
3057 after initializing Guile. It is not available on all systems, tho.
3058
3059 ** New functions: scm_str2symbol, scm_mem2symbol
3060
3061 The function scm_str2symbol takes a const char* pointing to a zero-terminated
3062 field of characters and creates a scheme symbol object from that C string.
3063 The function scm_mem2symbol takes a const char* and a number of characters and
3064 creates a symbol from the characters in that memory area.
3065
3066 ** New functions: scm_primitive_make_property
3067 scm_primitive_property_ref
3068 scm_primitive_property_set_x
3069 scm_primitive_property_del_x
3070
3071 These functions implement a new way to deal with object properties.
3072 See libguile/properties.c for their documentation.
3073
3074 ** New function: scm_done_free (long size)
3075
3076 This function is the inverse of scm_done_malloc. Use it to report the
3077 amount of smob memory you free. The previous method, which involved
3078 calling scm_done_malloc with negative argument, was somewhat
3079 unintuitive (and is still available, of course).
3080
3081 ** New function: scm_c_memq (SCM obj, SCM list)
3082
3083 This function provides a fast C level alternative for scm_memq for the case
3084 that the list parameter is known to be a proper list. The function is a
3085 replacement for scm_sloppy_memq, but is stricter in its requirements on its
3086 list input parameter, since for anything else but a proper list the function's
3087 behaviour is undefined - it may even crash or loop endlessly. Further, for
3088 the case that the object is not found in the list, scm_c_memq returns #f which
3089 is similar to scm_memq, but different from scm_sloppy_memq's behaviour.
3090
3091 ** New functions: scm_remember_upto_here_1, scm_remember_upto_here_2,
3092 scm_remember_upto_here
3093
3094 These functions replace the function scm_remember.
3095
3096 ** Deprecated function: scm_remember
3097
3098 Use one of the new functions scm_remember_upto_here_1,
3099 scm_remember_upto_here_2 or scm_remember_upto_here instead.
3100
3101 ** New function: scm_allocate_string
3102
3103 This function replaces the function scm_makstr.
3104
3105 ** Deprecated function: scm_makstr
3106
3107 Use the new function scm_allocate_string instead.
3108
3109 ** New global variable scm_gc_running_p introduced.
3110
3111 Use this variable to find out if garbage collection is being executed. Up to
3112 now applications have used scm_gc_heap_lock to test if garbage collection was
3113 running, which also works because of the fact that up to know only the garbage
3114 collector has set this variable. But, this is an implementation detail that
3115 may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use
3116 of this variable is (and has been) not fully safe anyway.
3117
3118 ** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH
3119
3120 Use these instead of SCM_LENGTH_MAX.
3121
3122 ** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH,
3123 SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH,
3124 SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH.
3125
3126 Use these instead of SCM_LENGTH.
3127
3128 ** New macros: SCM_SET_CONTINUATION_LENGTH, SCM_SET_STRING_LENGTH,
3129 SCM_SET_SYMBOL_LENGTH, SCM_SET_VECTOR_LENGTH, SCM_SET_UVECTOR_LENGTH,
3130 SCM_SET_BITVECTOR_LENGTH
3131
3132 Use these instead of SCM_SETLENGTH
3133
3134 ** New macros: SCM_STRING_CHARS, SCM_SYMBOL_CHARS, SCM_CCLO_BASE,
3135 SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM,
3136 SCM_ARRAY_MEM
3137
3138 Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or
3139 SCM_VELTS.
3140
3141 ** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS,
3142 SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE,
3143 SCM_SET_VECTOR_BASE
3144
3145 Use these instead of SCM_SETCHARS.
3146
3147 ** New macro: SCM_BITVECTOR_P
3148
3149 ** New macro: SCM_STRING_COERCE_0TERMINATION_X
3150
3151 Use instead of SCM_COERCE_SUBSTR.
3152
3153 ** New macros: SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN
3154
3155 For directory objects, use these instead of SCM_OPDIRP and SCM_OPN.
3156
3157 ** Deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL,
3158 SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL,
3159 SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD,
3160 SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SYMBOL_SLOTS, SCM_SLOTS, SCM_SLOPPY_STRINGP,
3161 SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
3162 SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
3163 SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
3164 SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
3165 SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
3166 SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP,
3167 SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC,
3168 SCM_OPDIRP, SCM_VALIDATE_OPDIR, SCM_WTA, RETURN_SCM_WTA, SCM_CONST_LONG,
3169 SCM_WNA, SCM_FUNC_NAME, SCM_VALIDATE_NUMBER_COPY,
3170 SCM_VALIDATE_NUMBER_DEF_COPY, SCM_SLOPPY_CONSP, SCM_SLOPPY_NCONSP,
3171 SCM_SETAND_CDR, SCM_SETOR_CDR, SCM_SETAND_CAR, SCM_SETOR_CAR
3172
3173 Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
3174 Use scm_memory_error instead of SCM_NALLOC.
3175 Use SCM_STRINGP instead of SCM_SLOPPY_STRINGP.
3176 Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_STRINGORSUBSTR.
3177 Use SCM_FREE_CELL_P instead of SCM_FREEP/SCM_NFREEP
3178 Use a type specific accessor macro instead of SCM_CHARS/SCM_UCHARS.
3179 Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH.
3180 Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING.
3181 Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
3182 Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
3183 Use SCM_STRINGP instead of SCM_RWSTRINGP.
3184 Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
3185 Use SCM_STRING_CHARS instead of SCM_ROCHARS.
3186 Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
3187 Use a type specific setter macro instead of SCM_SETLENGTH.
3188 Use a type specific setter macro instead of SCM_SETCHARS.
3189 Use a type specific length macro instead of SCM_LENGTH_MAX.
3190 Use SCM_GCMARKP instead of SCM_GC8MARKP.
3191 Use SCM_SETGCMARK instead of SCM_SETGC8MARK.
3192 Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK.
3193 Use SCM_TYP16 instead of SCM_GCTYP16.
3194 Use SCM_CDR instead of SCM_GCCDR.
3195 Use SCM_DIR_OPEN_P instead of SCM_OPDIRP.
3196 Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of SCM_WTA.
3197 Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of RETURN_SCM_WTA.
3198 Use SCM_VCELL_INIT instead of SCM_CONST_LONG.
3199 Use SCM_WRONG_NUM_ARGS instead of SCM_WNA.
3200 Use SCM_CONSP instead of SCM_SLOPPY_CONSP.
3201 Use !SCM_CONSP instead of SCM_SLOPPY_NCONSP.
3202
3203 ** Removed function: scm_struct_init
3204
3205 ** Removed variable: scm_symhash_dim
3206
3207 ** Renamed function: scm_make_cont has been replaced by
3208 scm_make_continuation, which has a different interface.
3209
3210 ** Deprecated function: scm_call_catching_errors
3211
3212 Use scm_catch or scm_lazy_catch from throw.[ch] instead.
3213
3214 ** Deprecated function: scm_strhash
3215
3216 Use scm_string_hash instead.
3217
3218 ** Deprecated function: scm_vector_set_length_x
3219
3220 Instead, create a fresh vector of the desired size and copy the contents.
3221
3222 ** scm_gensym has changed prototype
3223
3224 scm_gensym now only takes one argument.
3225
3226 ** Deprecated type tags: scm_tc7_ssymbol, scm_tc7_msymbol, scm_tcs_symbols,
3227 scm_tc7_lvector
3228
3229 There is now only a single symbol type scm_tc7_symbol.
3230 The tag scm_tc7_lvector was not used anyway.
3231
3232 ** Deprecated function: scm_make_smob_type_mfpe, scm_set_smob_mfpe.
3233
3234 Use scm_make_smob_type and scm_set_smob_XXX instead.
3235
3236 ** New function scm_set_smob_apply.
3237
3238 This can be used to set an apply function to a smob type.
3239
3240 ** Deprecated function: scm_strprint_obj
3241
3242 Use scm_object_to_string instead.
3243
3244 ** Deprecated function: scm_wta
3245
3246 Use scm_wrong_type_arg, or another appropriate error signalling function
3247 instead.
3248
3249 ** Explicit support for obarrays has been deprecated.
3250
3251 Use `scm_str2symbol' and the generic hashtable functions instead.
3252
3253 ** The concept of `vcells' has been deprecated.
3254
3255 The data type `variable' is now used exclusively. `Vcells' have been
3256 a low-level concept so you are likely not affected by this change.
3257
3258 *** Deprecated functions: scm_sym2vcell, scm_sysintern,
3259 scm_sysintern0, scm_symbol_value0, scm_intern, scm_intern0.
3260
3261 Use scm_c_define or scm_c_lookup instead, as appropriate.
3262
3263 *** New functions: scm_c_module_lookup, scm_c_lookup,
3264 scm_c_module_define, scm_c_define, scm_module_lookup, scm_lookup,
3265 scm_module_define, scm_define.
3266
3267 These functions work with variables instead of with vcells.
3268
3269 ** New functions for creating and defining `subr's and `gsubr's.
3270
3271 The new functions more clearly distinguish between creating a subr (or
3272 gsubr) object and adding it to the current module.
3273
3274 These new functions are available: scm_c_make_subr, scm_c_define_subr,
3275 scm_c_make_subr_with_generic, scm_c_define_subr_with_generic,
3276 scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
3277 scm_c_define_gsubr_with_generic.
3278
3279 ** Deprecated functions: scm_make_subr, scm_make_subr_opt,
3280 scm_make_subr_with_generic, scm_make_gsubr,
3281 scm_make_gsubr_with_generic.
3282
3283 Use the new ones from above instead.
3284
3285 ** C interface to the module system has changed.
3286
3287 While we suggest that you avoid as many explicit module system
3288 operations from C as possible for the time being, the C interface has
3289 been made more similar to the high-level Scheme module system.
3290
3291 *** New functions: scm_c_define_module, scm_c_use_module,
3292 scm_c_export, scm_c_resolve_module.
3293
3294 They mostly work like their Scheme namesakes. scm_c_define_module
3295 takes a function that is called a context where the new module is
3296 current.
3297
3298 *** Deprecated functions: scm_the_root_module, scm_make_module,
3299 scm_ensure_user_module, scm_load_scheme_module.
3300
3301 Use the new functions instead.
3302
3303 ** Renamed function: scm_internal_with_fluids becomes
3304 scm_c_with_fluids.
3305
3306 scm_internal_with_fluids is available as a deprecated function.
3307
3308 ** New function: scm_c_with_fluid.
3309
3310 Just like scm_c_with_fluids, but takes one fluid and one value instead
3311 of lists of same.
3312
3313 ** Deprecated typedefs: long_long, ulong_long.
3314
3315 They are of questionable utility and they pollute the global
3316 namespace.
3317
3318 ** Deprecated typedef: scm_sizet
3319
3320 It is of questionable utility now that Guile requires ANSI C, and is
3321 oddly named.
3322
3323 ** Deprecated typedefs: scm_port_rw_active, scm_port,
3324 scm_ptob_descriptor, scm_debug_info, scm_debug_frame, scm_fport,
3325 scm_option, scm_rstate, scm_rng, scm_array, scm_array_dim.
3326
3327 Made more compliant with the naming policy by adding a _t at the end.
3328
3329 ** Deprecated functions: scm_mkbig, scm_big2num, scm_adjbig,
3330 scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl
3331
3332 With the exception of the mysterious scm_2ulong2big, they are still
3333 available under new names (scm_i_mkbig etc). These functions are not
3334 intended to be used in user code. You should avoid dealing with
3335 bignums directly, and should deal with numbers in general (which can
3336 be bignums).
3337
3338 ** Change in behavior: scm_num2long, scm_num2ulong
3339
3340 The scm_num2[u]long functions don't any longer accept an inexact
3341 argument. This change in behavior is motivated by concordance with
3342 R5RS: It is more common that a primitive doesn't want to accept an
3343 inexact for an exact.
3344
3345 ** New functions: scm_short2num, scm_ushort2num, scm_int2num,
3346 scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
3347 scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff,
3348 scm_num2size.
3349
3350 These are conversion functions between the various ANSI C integral
3351 types and Scheme numbers. NOTE: The scm_num2xxx functions don't
3352 accept an inexact argument.
3353
3354 ** New functions: scm_float2num, scm_double2num,
3355 scm_num2float, scm_num2double.
3356
3357 These are conversion functions between the two ANSI C float types and
3358 Scheme numbers.
3359
3360 ** New number validation macros:
3361 SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF]
3362
3363 See above.
3364
3365 ** New functions: scm_gc_protect_object, scm_gc_unprotect_object
3366
3367 These are just nicer-named old scm_protect_object and
3368 scm_unprotect_object.
3369
3370 ** Deprecated functions: scm_protect_object, scm_unprotect_object
3371
3372 ** New functions: scm_gc_[un]register_root, scm_gc_[un]register_roots
3373
3374 These functions can be used to register pointers to locations that
3375 hold SCM values.
3376
3377 ** Deprecated function: scm_create_hook.
3378
3379 Its sins are: misleading name, non-modularity and lack of general
3380 usefulness.
3381
3382 \f
3383 Changes since Guile 1.3.4:
3384
3385 * Changes to the distribution
3386
3387 ** Trees from nightly snapshots and CVS now require you to run autogen.sh.
3388
3389 We've changed the way we handle generated files in the Guile source
3390 repository. As a result, the procedure for building trees obtained
3391 from the nightly FTP snapshots or via CVS has changed:
3392 - You must have appropriate versions of autoconf, automake, and
3393 libtool installed on your system. See README for info on how to
3394 obtain these programs.
3395 - Before configuring the tree, you must first run the script
3396 `autogen.sh' at the top of the source tree.
3397
3398 The Guile repository used to contain not only source files, written by
3399 humans, but also some generated files, like configure scripts and
3400 Makefile.in files. Even though the contents of these files could be
3401 derived mechanically from other files present, we thought it would
3402 make the tree easier to build if we checked them into CVS.
3403
3404 However, this approach means that minor differences between
3405 developer's installed tools and habits affected the whole team.
3406 So we have removed the generated files from the repository, and
3407 added the autogen.sh script, which will reconstruct them
3408 appropriately.
3409
3410
3411 ** configure now has experimental options to remove support for certain
3412 features:
3413
3414 --disable-arrays omit array and uniform array support
3415 --disable-posix omit posix interfaces
3416 --disable-networking omit networking interfaces
3417 --disable-regex omit regular expression interfaces
3418
3419 These are likely to become separate modules some day.
3420
3421 ** New configure option --enable-debug-freelist
3422
3423 This enables a debugging version of SCM_NEWCELL(), and also registers
3424 an extra primitive, the setter `gc-set-debug-check-freelist!'.
3425
3426 Configure with the --enable-debug-freelist option to enable
3427 the gc-set-debug-check-freelist! primitive, and then use:
3428
3429 (gc-set-debug-check-freelist! #t) # turn on checking of the freelist
3430 (gc-set-debug-check-freelist! #f) # turn off checking
3431
3432 Checking of the freelist forces a traversal of the freelist and
3433 a garbage collection before each allocation of a cell. This can
3434 slow down the interpreter dramatically, so the setter should be used to
3435 turn on this extra processing only when necessary.
3436
3437 ** New configure option --enable-debug-malloc
3438
3439 Include code for debugging of calls to scm_must_malloc/realloc/free.
3440
3441 Checks that
3442
3443 1. objects freed by scm_must_free has been mallocated by scm_must_malloc
3444 2. objects reallocated by scm_must_realloc has been allocated by
3445 scm_must_malloc
3446 3. reallocated objects are reallocated with the same what string
3447
3448 But, most importantly, it records the number of allocated objects of
3449 each kind. This is useful when searching for memory leaks.
3450
3451 A Guile compiled with this option provides the primitive
3452 `malloc-stats' which returns an alist with pairs of kind and the
3453 number of objects of that kind.
3454
3455 ** All includes are now referenced relative to the root directory
3456
3457 Since some users have had problems with mixups between Guile and
3458 system headers, we have decided to always refer to Guile headers via
3459 their parent directories. This essentially creates a "private name
3460 space" for Guile headers. This means that the compiler only is given
3461 -I options for the root build and root source directory.
3462
3463 ** Header files kw.h and genio.h have been removed.
3464
3465 ** The module (ice-9 getopt-gnu-style) has been removed.
3466
3467 ** New module (ice-9 documentation)
3468
3469 Implements the interface to documentation strings associated with
3470 objects.
3471
3472 ** New module (ice-9 time)
3473
3474 Provides a macro `time', which displays execution time of a given form.
3475
3476 ** New module (ice-9 history)
3477
3478 Loading this module enables value history in the repl.
3479
3480 * Changes to the stand-alone interpreter
3481
3482 ** New command line option --debug
3483
3484 Start Guile with debugging evaluator and backtraces enabled.
3485
3486 This is useful when debugging your .guile init file or scripts.
3487
3488 ** New help facility
3489
3490 Usage: (help NAME) gives documentation about objects named NAME (a symbol)
3491 (help REGEXP) ditto for objects with names matching REGEXP (a string)
3492 (help 'NAME) gives documentation for NAME, even if it is not an object
3493 (help ,EXPR) gives documentation for object returned by EXPR
3494 (help (my module)) gives module commentary for `(my module)'
3495 (help) gives this text
3496
3497 `help' searches among bindings exported from loaded modules, while
3498 `apropos' searches among bindings visible from the "current" module.
3499
3500 Examples: (help help)
3501 (help cons)
3502 (help "output-string")
3503
3504 ** `help' and `apropos' now prints full module names
3505
3506 ** Dynamic linking now uses libltdl from the libtool package.
3507
3508 The old system dependent code for doing dynamic linking has been
3509 replaced with calls to the libltdl functions which do all the hairy
3510 details for us.
3511
3512 The major improvement is that you can now directly pass libtool
3513 library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
3514 will be able to do the best shared library job you can get, via
3515 libltdl.
3516
3517 The way dynamic libraries are found has changed and is not really
3518 portable across platforms, probably. It is therefore recommended to
3519 use absolute filenames when possible.
3520
3521 If you pass a filename without an extension to `dynamic-link', it will
3522 try a few appropriate ones. Thus, the most platform ignorant way is
3523 to specify a name like "libfoo", without any directories and
3524 extensions.
3525
3526 ** Guile COOP threads are now compatible with LinuxThreads
3527
3528 Previously, COOP threading wasn't possible in applications linked with
3529 Linux POSIX threads due to their use of the stack pointer to find the
3530 thread context. This has now been fixed with a workaround which uses
3531 the pthreads to allocate the stack.
3532
3533 ** New primitives: `pkgdata-dir', `site-dir', `library-dir'
3534
3535 ** Positions of erring expression in scripts
3536
3537 With version 1.3.4, the location of the erring expression in Guile
3538 scipts is no longer automatically reported. (This should have been
3539 documented before the 1.3.4 release.)
3540
3541 You can get this information by enabling recording of positions of
3542 source expressions and running the debugging evaluator. Put this at
3543 the top of your script (or in your "site" file):
3544
3545 (read-enable 'positions)
3546 (debug-enable 'debug)
3547
3548 ** Backtraces in scripts
3549
3550 It is now possible to get backtraces in scripts.
3551
3552 Put
3553
3554 (debug-enable 'debug 'backtrace)
3555
3556 at the top of the script.
3557
3558 (The first options enables the debugging evaluator.
3559 The second enables backtraces.)
3560
3561 ** Part of module system symbol lookup now implemented in C
3562
3563 The eval closure of most modules is now implemented in C. Since this
3564 was one of the bottlenecks for loading speed, Guile now loads code
3565 substantially faster than before.
3566
3567 ** Attempting to get the value of an unbound variable now produces
3568 an exception with a key of 'unbound-variable instead of 'misc-error.
3569
3570 ** The initial default output port is now unbuffered if it's using a
3571 tty device. Previously in this situation it was line-buffered.
3572
3573 ** New hook: after-gc-hook
3574
3575 after-gc-hook takes over the role of gc-thunk. This hook is run at
3576 the first SCM_TICK after a GC. (Thus, the code is run at the same
3577 point during evaluation as signal handlers.)
3578
3579 Note that this hook should be used only for diagnostic and debugging
3580 purposes. It is not certain that it will continue to be well-defined
3581 when this hook is run in the future.
3582
3583 C programmers: Note the new C level hooks scm_before_gc_c_hook,
3584 scm_before_sweep_c_hook, scm_after_gc_c_hook.
3585
3586 ** Improvements to garbage collector
3587
3588 Guile 1.4 has a new policy for triggering heap allocation and
3589 determining the sizes of heap segments. It fixes a number of problems
3590 in the old GC.
3591
3592 1. The new policy can handle two separate pools of cells
3593 (2-word/4-word) better. (The old policy would run wild, allocating
3594 more and more memory for certain programs.)
3595
3596 2. The old code would sometimes allocate far too much heap so that the
3597 Guile process became gigantic. The new code avoids this.
3598
3599 3. The old code would sometimes allocate too little so that few cells
3600 were freed at GC so that, in turn, too much time was spent in GC.
3601
3602 4. The old code would often trigger heap allocation several times in a
3603 row. (The new scheme predicts how large the segments needs to be
3604 in order not to need further allocation.)
3605
3606 All in all, the new GC policy will make larger applications more
3607 efficient.
3608
3609 The new GC scheme also is prepared for POSIX threading. Threads can
3610 allocate private pools of cells ("clusters") with just a single
3611 function call. Allocation of single cells from such a cluster can
3612 then proceed without any need of inter-thread synchronization.
3613
3614 ** New environment variables controlling GC parameters
3615
3616 GUILE_MAX_SEGMENT_SIZE Maximal segment size
3617 (default = 2097000)
3618
3619 Allocation of 2-word cell heaps:
3620
3621 GUILE_INIT_SEGMENT_SIZE_1 Size of initial heap segment in bytes
3622 (default = 360000)
3623
3624 GUILE_MIN_YIELD_1 Minimum number of freed cells at each
3625 GC in percent of total heap size
3626 (default = 40)
3627
3628 Allocation of 4-word cell heaps
3629 (used for real numbers and misc other objects):
3630
3631 GUILE_INIT_SEGMENT_SIZE_2, GUILE_MIN_YIELD_2
3632
3633 (See entry "Way for application to customize GC parameters" under
3634 section "Changes to the scm_ interface" below.)
3635
3636 ** Guile now implements reals using 4-word cells
3637
3638 This speeds up computation with reals. (They were earlier allocated
3639 with `malloc'.) There is still some room for optimizations, however.
3640
3641 ** Some further steps toward POSIX thread support have been taken
3642
3643 *** Guile's critical sections (SCM_DEFER/ALLOW_INTS)
3644 don't have much effect any longer, and many of them will be removed in
3645 next release.
3646
3647 *** Signals
3648 are only handled at the top of the evaluator loop, immediately after
3649 I/O, and in scm_equalp.
3650
3651 *** The GC can allocate thread private pools of pairs.
3652
3653 * Changes to Scheme functions and syntax
3654
3655 ** close-input-port and close-output-port are now R5RS
3656
3657 These procedures have been turned into primitives and have R5RS behaviour.
3658
3659 ** New procedure: simple-format PORT MESSAGE ARG1 ...
3660
3661 (ice-9 boot) makes `format' an alias for `simple-format' until possibly
3662 extended by the more sophisticated version in (ice-9 format)
3663
3664 (simple-format port message . args)
3665 Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
3666 MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
3667 the escapes are replaced with corresponding members of ARGS:
3668 ~A formats using `display' and ~S formats using `write'.
3669 If DESTINATION is #t, then use the `current-output-port',
3670 if DESTINATION is #f, then return a string containing the formatted text.
3671 Does not add a trailing newline."
3672
3673 ** string-ref: the second argument is no longer optional.
3674
3675 ** string, list->string: no longer accept strings in their arguments,
3676 only characters, for compatibility with R5RS.
3677
3678 ** New procedure: port-closed? PORT
3679 Returns #t if PORT is closed or #f if it is open.
3680
3681 ** Deprecated: list*
3682
3683 The list* functionality is now provided by cons* (SRFI-1 compliant)
3684
3685 ** New procedure: cons* ARG1 ARG2 ... ARGn
3686
3687 Like `list', but the last arg provides the tail of the constructed list,
3688 returning (cons ARG1 (cons ARG2 (cons ... ARGn))).
3689
3690 Requires at least one argument. If given one argument, that argument
3691 is returned as result.
3692
3693 This function is called `list*' in some other Schemes and in Common LISP.
3694
3695 ** Removed deprecated: serial-map, serial-array-copy!, serial-array-map!
3696
3697 ** New procedure: object-documentation OBJECT
3698
3699 Returns the documentation string associated with OBJECT. The
3700 procedure uses a caching mechanism so that subsequent lookups are
3701 faster.
3702
3703 Exported by (ice-9 documentation).
3704
3705 ** module-name now returns full names of modules
3706
3707 Previously, only the last part of the name was returned (`session' for
3708 `(ice-9 session)'). Ex: `(ice-9 session)'.
3709
3710 * Changes to the gh_ interface
3711
3712 ** Deprecated: gh_int2scmb
3713
3714 Use gh_bool2scm instead.
3715
3716 * Changes to the scm_ interface
3717
3718 ** Guile primitives now carry docstrings!
3719
3720 Thanks to Greg Badros!
3721
3722 ** Guile primitives are defined in a new way: SCM_DEFINE/SCM_DEFINE1/SCM_PROC
3723
3724 Now Guile primitives are defined using the SCM_DEFINE/SCM_DEFINE1/SCM_PROC
3725 macros and must contain a docstring that is extracted into foo.doc using a new
3726 guile-doc-snarf script (that uses guile-doc-snarf.awk).
3727
3728 However, a major overhaul of these macros is scheduled for the next release of
3729 guile.
3730
3731 ** Guile primitives use a new technique for validation of arguments
3732
3733 SCM_VALIDATE_* macros are defined to ease the redundancy and improve
3734 the readability of argument checking.
3735
3736 ** All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
3737
3738 ** New macros: SCM_PACK, SCM_UNPACK
3739
3740 Compose/decompose an SCM value.
3741
3742 The SCM type is now treated as an abstract data type and may be defined as a
3743 long, a void* or as a struct, depending on the architecture and compile time
3744 options. This makes it easier to find several types of bugs, for example when
3745 SCM values are treated as integers without conversion. Values of the SCM type
3746 should be treated as "atomic" values. These macros are used when
3747 composing/decomposing an SCM value, either because you want to access
3748 individual bits, or because you want to treat it as an integer value.
3749
3750 E.g., in order to set bit 7 in an SCM value x, use the expression
3751
3752 SCM_PACK (SCM_UNPACK (x) | 0x80)
3753
3754 ** The name property of hooks is deprecated.
3755 Thus, the use of SCM_HOOK_NAME and scm_make_hook_with_name is deprecated.
3756
3757 You can emulate this feature by using object properties.
3758
3759 ** Deprecated macros: SCM_INPORTP, SCM_OUTPORTP, SCM_CRDY, SCM_ICHRP,
3760 SCM_ICHR, SCM_MAKICHR, SCM_SETJMPBUF, SCM_NSTRINGP, SCM_NRWSTRINGP,
3761 SCM_NVECTORP
3762
3763 These macros will be removed in a future release of Guile.
3764
3765 ** The following types, functions and macros from numbers.h are deprecated:
3766 scm_dblproc, SCM_UNEGFIXABLE, SCM_FLOBUFLEN, SCM_INEXP, SCM_CPLXP, SCM_REAL,
3767 SCM_IMAG, SCM_REALPART, scm_makdbl, SCM_SINGP, SCM_NUM2DBL, SCM_NO_BIGDIG
3768
3769 ** Port internals: the rw_random variable in the scm_port structure
3770 must be set to non-zero in any random access port. In recent Guile
3771 releases it was only set for bidirectional random-access ports.
3772
3773 ** Port internals: the seek ptob procedure is now responsible for
3774 resetting the buffers if required. The change was made so that in the
3775 special case of reading the current position (i.e., seek p 0 SEEK_CUR)
3776 the fport and strport ptobs can avoid resetting the buffers,
3777 in particular to avoid discarding unread chars. An existing port
3778 type can be fixed by adding something like the following to the
3779 beginning of the ptob seek procedure:
3780
3781 if (pt->rw_active == SCM_PORT_READ)
3782 scm_end_input (object);
3783 else if (pt->rw_active == SCM_PORT_WRITE)
3784 ptob->flush (object);
3785
3786 although to actually avoid resetting the buffers and discard unread
3787 chars requires further hacking that depends on the characteristics
3788 of the ptob.
3789
3790 ** Deprecated functions: scm_fseek, scm_tag
3791
3792 These functions are no longer used and will be removed in a future version.
3793
3794 ** The scm_sysmissing procedure is no longer used in libguile.
3795 Unless it turns out to be unexpectedly useful to somebody, it will be
3796 removed in a future version.
3797
3798 ** The format of error message strings has changed
3799
3800 The two C procedures: scm_display_error and scm_error, as well as the
3801 primitive `scm-error', now use scm_simple_format to do their work.
3802 This means that the message strings of all code must be updated to use
3803 ~A where %s was used before, and ~S where %S was used before.
3804
3805 During the period when there still are a lot of old Guiles out there,
3806 you might want to support both old and new versions of Guile.
3807
3808 There are basically two methods to achieve this. Both methods use
3809 autoconf. Put
3810
3811 AC_CHECK_FUNCS(scm_simple_format)
3812
3813 in your configure.in.
3814
3815 Method 1: Use the string concatenation features of ANSI C's
3816 preprocessor.
3817
3818 In C:
3819
3820 #ifdef HAVE_SCM_SIMPLE_FORMAT
3821 #define FMT_S "~S"
3822 #else
3823 #define FMT_S "%S"
3824 #endif
3825
3826 Then represent each of your error messages using a preprocessor macro:
3827
3828 #define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!"
3829
3830 In Scheme:
3831
3832 (define fmt-s (if (defined? 'simple-format) "~S" "%S"))
3833 (define make-message string-append)
3834
3835 (define e-spider-error (make-message "There's a spider in your " fmt-s "!!!"))
3836
3837 Method 2: Use the oldfmt function found in doc/oldfmt.c.
3838
3839 In C:
3840
3841 scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"),
3842 ...);
3843
3844 In Scheme:
3845
3846 (scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!")
3847 ...)
3848
3849
3850 ** Deprecated: coop_mutex_init, coop_condition_variable_init
3851
3852 Don't use the functions coop_mutex_init and
3853 coop_condition_variable_init. They will change.
3854
3855 Use scm_mutex_init and scm_cond_init instead.
3856
3857 ** New function: int scm_cond_timedwait (scm_cond_t *COND, scm_mutex_t *MUTEX, const struct timespec *ABSTIME)
3858 `scm_cond_timedwait' atomically unlocks MUTEX and waits on
3859 COND, as `scm_cond_wait' does, but it also bounds the duration
3860 of the wait. If COND has not been signaled before time ABSTIME,
3861 the mutex MUTEX is re-acquired and `scm_cond_timedwait'
3862 returns the error code `ETIMEDOUT'.
3863
3864 The ABSTIME parameter specifies an absolute time, with the same
3865 origin as `time' and `gettimeofday': an ABSTIME of 0 corresponds
3866 to 00:00:00 GMT, January 1, 1970.
3867
3868 ** New function: scm_cond_broadcast (scm_cond_t *COND)
3869 `scm_cond_broadcast' restarts all the threads that are waiting
3870 on the condition variable COND. Nothing happens if no threads are
3871 waiting on COND.
3872
3873 ** New function: scm_key_create (scm_key_t *KEY, void (*destr_function) (void *))
3874 `scm_key_create' allocates a new TSD key. The key is stored in
3875 the location pointed to by KEY. There is no limit on the number
3876 of keys allocated at a given time. The value initially associated
3877 with the returned key is `NULL' in all currently executing threads.
3878
3879 The DESTR_FUNCTION argument, if not `NULL', specifies a destructor
3880 function associated with the key. When a thread terminates,
3881 DESTR_FUNCTION is called on the value associated with the key in
3882 that thread. The DESTR_FUNCTION is not called if a key is deleted
3883 with `scm_key_delete' or a value is changed with
3884 `scm_setspecific'. The order in which destructor functions are
3885 called at thread termination time is unspecified.
3886
3887 Destructors are not yet implemented.
3888
3889 ** New function: scm_setspecific (scm_key_t KEY, const void *POINTER)
3890 `scm_setspecific' changes the value associated with KEY in the
3891 calling thread, storing the given POINTER instead.
3892
3893 ** New function: scm_getspecific (scm_key_t KEY)
3894 `scm_getspecific' returns the value currently associated with
3895 KEY in the calling thread.
3896
3897 ** New function: scm_key_delete (scm_key_t KEY)
3898 `scm_key_delete' deallocates a TSD key. It does not check
3899 whether non-`NULL' values are associated with that key in the
3900 currently executing threads, nor call the destructor function
3901 associated with the key.
3902
3903 ** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE)
3904
3905 Initialize a C level hook HOOK with associated HOOK_DATA and type
3906 TYPE. (See scm_c_hook_run ().)
3907
3908 ** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP)
3909
3910 Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP
3911 is true, add it last, otherwise first. The same FUNC can be added
3912 multiple times if FUNC_DATA differ and vice versa.
3913
3914 ** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA)
3915
3916 Remove hook function FUNC with associated FUNC_DATA from HOOK. A
3917 function is only removed if both FUNC and FUNC_DATA matches.
3918
3919 ** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA)
3920
3921 Run hook HOOK passing DATA to the hook functions.
3922
3923 If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value
3924 returned is undefined.
3925
3926 If TYPE is SCM_C_HOOK_OR, hook functions are run until a function
3927 returns a non-NULL value. This value is returned as the result of
3928 scm_c_hook_run. If all functions return NULL, NULL is returned.
3929
3930 If TYPE is SCM_C_HOOK_AND, hook functions are run until a function
3931 returns a NULL value, and NULL is returned. If all functions returns
3932 a non-NULL value, the last value is returned.
3933
3934 ** New C level GC hooks
3935
3936 Five new C level hooks has been added to the garbage collector.
3937
3938 scm_before_gc_c_hook
3939 scm_after_gc_c_hook
3940
3941 are run before locking and after unlocking the heap. The system is
3942 thus in a mode where evaluation can take place. (Except that
3943 scm_before_gc_c_hook must not allocate new cells.)
3944
3945 scm_before_mark_c_hook
3946 scm_before_sweep_c_hook
3947 scm_after_sweep_c_hook
3948
3949 are run when the heap is locked. These are intended for extension of
3950 the GC in a modular fashion. Examples are the weaks and guardians
3951 modules.
3952
3953 ** Way for application to customize GC parameters
3954
3955 The application can set up other default values for the GC heap
3956 allocation parameters
3957
3958 GUILE_INIT_HEAP_SIZE_1, GUILE_MIN_YIELD_1,
3959 GUILE_INIT_HEAP_SIZE_2, GUILE_MIN_YIELD_2,
3960 GUILE_MAX_SEGMENT_SIZE,
3961
3962 by setting
3963
3964 scm_default_init_heap_size_1, scm_default_min_yield_1,
3965 scm_default_init_heap_size_2, scm_default_min_yield_2,
3966 scm_default_max_segment_size
3967
3968 respectively before callong scm_boot_guile.
3969
3970 (See entry "New environment variables ..." in section
3971 "Changes to the stand-alone interpreter" above.)
3972
3973 ** scm_protect_object/scm_unprotect_object now nest
3974
3975 This means that you can call scm_protect_object multiple times on an
3976 object and count on the object being protected until
3977 scm_unprotect_object has been call the same number of times.
3978
3979 The functions also have better time complexity.
3980
3981 Still, it is usually possible to structure the application in a way
3982 that you don't need to use these functions. For example, if you use a
3983 protected standard Guile list to keep track of live objects rather
3984 than some custom data type, objects will die a natural death when they
3985 are no longer needed.
3986
3987 ** Deprecated type tags: scm_tc16_flo, scm_tc_flo, scm_tc_dblr, scm_tc_dblc
3988
3989 Guile does not provide the float representation for inexact real numbers any
3990 more. Now, only doubles are used to represent inexact real numbers. Further,
3991 the tag names scm_tc_dblr and scm_tc_dblc have been changed to scm_tc16_real
3992 and scm_tc16_complex, respectively.
3993
3994 ** Removed deprecated type scm_smobfuns
3995
3996 ** Removed deprecated function scm_newsmob
3997
3998 ** Warning: scm_make_smob_type_mfpe might become deprecated in a future release
3999
4000 There is an ongoing discussion among the developers whether to
4001 deprecate `scm_make_smob_type_mfpe' or not. Please use the current
4002 standard interface (scm_make_smob_type, scm_set_smob_XXX) in new code
4003 until this issue has been settled.
4004
4005 ** Removed deprecated type tag scm_tc16_kw
4006
4007 ** Added type tag scm_tc16_keyword
4008
4009 (This was introduced already in release 1.3.4 but was not documented
4010 until now.)
4011
4012 ** gdb_print now prints "*** Guile not initialized ***" until Guile initialized
4013
4014 * Changes to system call interfaces:
4015
4016 ** The "select" procedure now tests port buffers for the ability to
4017 provide input or accept output. Previously only the underlying file
4018 descriptors were checked.
4019
4020 ** New variable PIPE_BUF: the maximum number of bytes that can be
4021 atomically written to a pipe.
4022
4023 ** If a facility is not available on the system when Guile is
4024 compiled, the corresponding primitive procedure will not be defined.
4025 Previously it would have been defined but would throw a system-error
4026 exception if called. Exception handlers which catch this case may
4027 need minor modification: an error will be thrown with key
4028 'unbound-variable instead of 'system-error. Alternatively it's
4029 now possible to use `defined?' to check whether the facility is
4030 available.
4031
4032 ** Procedures which depend on the timezone should now give the correct
4033 result on systems which cache the TZ environment variable, even if TZ
4034 is changed without calling tzset.
4035
4036 * Changes to the networking interfaces:
4037
4038 ** New functions: htons, ntohs, htonl, ntohl: for converting short and
4039 long integers between network and host format. For now, it's not
4040 particularly convenient to do this kind of thing, but consider:
4041
4042 (define write-network-long
4043 (lambda (value port)
4044 (let ((v (make-uniform-vector 1 1 0)))
4045 (uniform-vector-set! v 0 (htonl value))
4046 (uniform-vector-write v port))))
4047
4048 (define read-network-long
4049 (lambda (port)
4050 (let ((v (make-uniform-vector 1 1 0)))
4051 (uniform-vector-read! v port)
4052 (ntohl (uniform-vector-ref v 0)))))
4053
4054 ** If inet-aton fails, it now throws an error with key 'misc-error
4055 instead of 'system-error, since errno is not relevant.
4056
4057 ** Certain gethostbyname/gethostbyaddr failures now throw errors with
4058 specific keys instead of 'system-error. The latter is inappropriate
4059 since errno will not have been set. The keys are:
4060 'host-not-found, 'try-again, 'no-recovery and 'no-data.
4061
4062 ** sethostent, setnetent, setprotoent, setservent: now take an
4063 optional argument STAYOPEN, which specifies whether the database
4064 remains open after a database entry is accessed randomly (e.g., using
4065 gethostbyname for the hosts database.) The default is #f. Previously
4066 #t was always used.
4067
4068 \f
4069 Changes since Guile 1.3.2:
4070
4071 * Changes to the stand-alone interpreter
4072
4073 ** Debugger
4074
4075 An initial version of the Guile debugger written by Chris Hanson has
4076 been added. The debugger is still under development but is included
4077 in the distribution anyway since it is already quite useful.
4078
4079 Type
4080
4081 (debug)
4082
4083 after an error to enter the debugger. Type `help' inside the debugger
4084 for a description of available commands.
4085
4086 If you prefer to have stack frames numbered and printed in
4087 anti-chronological order and prefer up in the stack to be down on the
4088 screen as is the case in gdb, you can put
4089
4090 (debug-enable 'backwards)
4091
4092 in your .guile startup file. (However, this means that Guile can't
4093 use indentation to indicate stack level.)
4094
4095 The debugger is autoloaded into Guile at the first use.
4096
4097 ** Further enhancements to backtraces
4098
4099 There is a new debug option `width' which controls the maximum width
4100 on the screen of printed stack frames. Fancy printing parameters
4101 ("level" and "length" as in Common LISP) are adaptively adjusted for
4102 each stack frame to give maximum information while still fitting
4103 within the bounds. If the stack frame can't be made to fit by
4104 adjusting parameters, it is simply cut off at the end. This is marked
4105 with a `$'.
4106
4107 ** Some modules are now only loaded when the repl is started
4108
4109 The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
4110 regex) are now loaded into (guile-user) only if the repl has been
4111 started. The effect is that the startup time for scripts has been
4112 reduced to 30% of what it was previously.
4113
4114 Correctly written scripts load the modules they require at the top of
4115 the file and should not be affected by this change.
4116
4117 ** Hooks are now represented as smobs
4118
4119 * Changes to Scheme functions and syntax
4120
4121 ** Readline support has changed again.
4122
4123 The old (readline-activator) module is gone. Use (ice-9 readline)
4124 instead, which now contains all readline functionality. So the code
4125 to activate readline is now
4126
4127 (use-modules (ice-9 readline))
4128 (activate-readline)
4129
4130 This should work at any time, including from the guile prompt.
4131
4132 To avoid confusion about the terms of Guile's license, please only
4133 enable readline for your personal use; please don't make it the
4134 default for others. Here is why we make this rather odd-sounding
4135 request:
4136
4137 Guile is normally licensed under a weakened form of the GNU General
4138 Public License, which allows you to link code with Guile without
4139 placing that code under the GPL. This exception is important to some
4140 people.
4141
4142 However, since readline is distributed under the GNU General Public
4143 License, when you link Guile with readline, either statically or
4144 dynamically, you effectively change Guile's license to the strict GPL.
4145 Whenever you link any strictly GPL'd code into Guile, uses of Guile
4146 which are normally permitted become forbidden. This is a rather
4147 non-obvious consequence of the licensing terms.
4148
4149 So, to make sure things remain clear, please let people choose for
4150 themselves whether to link GPL'd libraries like readline with Guile.
4151
4152 ** regexp-substitute/global has changed slightly, but incompatibly.
4153
4154 If you include a function in the item list, the string of the match
4155 object it receives is the same string passed to
4156 regexp-substitute/global, not some suffix of that string.
4157 Correspondingly, the match's positions are relative to the entire
4158 string, not the suffix.
4159
4160 If the regexp can match the empty string, the way matches are chosen
4161 from the string has changed. regexp-substitute/global recognizes the
4162 same set of matches that list-matches does; see below.
4163
4164 ** New function: list-matches REGEXP STRING [FLAGS]
4165
4166 Return a list of match objects, one for every non-overlapping, maximal
4167 match of REGEXP in STRING. The matches appear in left-to-right order.
4168 list-matches only reports matches of the empty string if there are no
4169 other matches which begin on, end at, or include the empty match's
4170 position.
4171
4172 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
4173
4174 ** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
4175
4176 For each match of REGEXP in STRING, apply PROC to the match object,
4177 and the last value PROC returned, or INIT for the first call. Return
4178 the last value returned by PROC. We apply PROC to the matches as they
4179 appear from left to right.
4180
4181 This function recognizes matches according to the same criteria as
4182 list-matches.
4183
4184 Thus, you could define list-matches like this:
4185
4186 (define (list-matches regexp string . flags)
4187 (reverse! (apply fold-matches regexp string '() cons flags)))
4188
4189 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
4190
4191 ** Hooks
4192
4193 *** New function: hook? OBJ
4194
4195 Return #t if OBJ is a hook, otherwise #f.
4196
4197 *** New function: make-hook-with-name NAME [ARITY]
4198
4199 Return a hook with name NAME and arity ARITY. The default value for
4200 ARITY is 0. The only effect of NAME is that it will appear when the
4201 hook object is printed to ease debugging.
4202
4203 *** New function: hook-empty? HOOK
4204
4205 Return #t if HOOK doesn't contain any procedures, otherwise #f.
4206
4207 *** New function: hook->list HOOK
4208
4209 Return a list of the procedures that are called when run-hook is
4210 applied to HOOK.
4211
4212 ** `map' signals an error if its argument lists are not all the same length.
4213
4214 This is the behavior required by R5RS, so this change is really a bug
4215 fix. But it seems to affect a lot of people's code, so we're
4216 mentioning it here anyway.
4217
4218 ** Print-state handling has been made more transparent
4219
4220 Under certain circumstances, ports are represented as a port with an
4221 associated print state. Earlier, this pair was represented as a pair
4222 (see "Some magic has been added to the printer" below). It is now
4223 indistinguishable (almost; see `get-print-state') from a port on the
4224 user level.
4225
4226 *** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
4227
4228 Return a new port with the associated print state PRINT-STATE.
4229
4230 *** New function: get-print-state OUTPUT-PORT
4231
4232 Return the print state associated with this port if it exists,
4233 otherwise return #f.
4234
4235 *** New function: directory-stream? OBJECT
4236
4237 Returns true iff OBJECT is a directory stream --- the sort of object
4238 returned by `opendir'.
4239
4240 ** New function: using-readline?
4241
4242 Return #t if readline is in use in the current repl.
4243
4244 ** structs will be removed in 1.4
4245
4246 Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
4247 and use GOOPS objects as the fundamental record type.
4248
4249 * Changes to the scm_ interface
4250
4251 ** structs will be removed in 1.4
4252
4253 The entire current struct interface (struct.c, struct.h) will be
4254 replaced in Guile 1.4. We will merge GOOPS into libguile and use
4255 GOOPS objects as the fundamental record type.
4256
4257 ** The internal representation of subr's has changed
4258
4259 Instead of giving a hint to the subr name, the CAR field of the subr
4260 now contains an index to a subr entry in scm_subr_table.
4261
4262 *** New variable: scm_subr_table
4263
4264 An array of subr entries. A subr entry contains the name, properties
4265 and documentation associated with the subr. The properties and
4266 documentation slots are not yet used.
4267
4268 ** A new scheme for "forwarding" calls to a builtin to a generic function
4269
4270 It is now possible to extend the functionality of some Guile
4271 primitives by letting them defer a call to a GOOPS generic function on
4272 argument mismatch. This means that there is no loss of efficiency in
4273 normal evaluation.
4274
4275 Example:
4276
4277 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
4278 (define-method + ((x <string>) (y <string>))
4279 (string-append x y))
4280
4281 + will still be as efficient as usual in numerical calculations, but
4282 can also be used for concatenating strings.
4283
4284 Who will be the first one to extend Guile's numerical tower to
4285 rationals? :) [OK, there a few other things to fix before this can
4286 be made in a clean way.]
4287
4288 *** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
4289
4290 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
4291
4292 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
4293
4294 These do the same job as SCM_PROC and SCM_PROC1, but they also define
4295 a variable GENERIC which can be used by the dispatch macros below.
4296
4297 [This is experimental code which may change soon.]
4298
4299 *** New macros for forwarding control to a generic on arg type error
4300
4301 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
4302
4303 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
4304
4305 These correspond to the scm_wta function call, and have the same
4306 behaviour until the user has called the GOOPS primitive
4307 `enable-primitive-generic!'. After that, these macros will apply the
4308 generic function GENERIC to the argument(s) instead of calling
4309 scm_wta.
4310
4311 [This is experimental code which may change soon.]
4312
4313 *** New macros for argument testing with generic dispatch
4314
4315 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
4316
4317 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
4318
4319 These correspond to the SCM_ASSERT macro, but will defer control to
4320 GENERIC on error after `enable-primitive-generic!' has been called.
4321
4322 [This is experimental code which may change soon.]
4323
4324 ** New function: SCM scm_eval_body (SCM body, SCM env)
4325
4326 Evaluates the body of a special form.
4327
4328 ** The internal representation of struct's has changed
4329
4330 Previously, four slots were allocated for the procedure(s) of entities
4331 and operators. The motivation for this representation had to do with
4332 the structure of the evaluator, the wish to support tail-recursive
4333 generic functions, and efficiency. Since the generic function
4334 dispatch mechanism has changed, there is no longer a need for such an
4335 expensive representation, and the representation has been simplified.
4336
4337 This should not make any difference for most users.
4338
4339 ** GOOPS support has been cleaned up.
4340
4341 Some code has been moved from eval.c to objects.c and code in both of
4342 these compilation units has been cleaned up and better structured.
4343
4344 *** New functions for applying generic functions
4345
4346 New function: SCM scm_apply_generic (GENERIC, ARGS)
4347 New function: SCM scm_call_generic_0 (GENERIC)
4348 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
4349 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
4350 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
4351
4352 ** Deprecated function: scm_make_named_hook
4353
4354 It is now replaced by:
4355
4356 ** New function: SCM scm_create_hook (const char *name, int arity)
4357
4358 Creates a hook in the same way as make-hook above but also
4359 binds a variable named NAME to it.
4360
4361 This is the typical way of creating a hook from C code.
4362
4363 Currently, the variable is created in the "current" module.
4364 This might change when we get the new module system.
4365
4366 [The behaviour is identical to scm_make_named_hook.]
4367
4368
4369 \f
4370 Changes since Guile 1.3:
4371
4372 * Changes to mailing lists
4373
4374 ** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
4375
4376 See the README file to find current addresses for all the Guile
4377 mailing lists.
4378
4379 * Changes to the distribution
4380
4381 ** Readline support is no longer included with Guile by default.
4382
4383 Based on the different license terms of Guile and Readline, we
4384 concluded that Guile should not *by default* cause the linking of
4385 Readline into an application program. Readline support is now offered
4386 as a separate module, which is linked into an application only when
4387 you explicitly specify it.
4388
4389 Although Guile is GNU software, its distribution terms add a special
4390 exception to the usual GNU General Public License (GPL). Guile's
4391 license includes a clause that allows you to link Guile with non-free
4392 programs. We add this exception so as not to put Guile at a
4393 disadvantage vis-a-vis other extensibility packages that support other
4394 languages.
4395
4396 In contrast, the GNU Readline library is distributed under the GNU
4397 General Public License pure and simple. This means that you may not
4398 link Readline, even dynamically, into an application unless it is
4399 distributed under a free software license that is compatible the GPL.
4400
4401 Because of this difference in distribution terms, an application that
4402 can use Guile may not be able to use Readline. Now users will be
4403 explicitly offered two independent decisions about the use of these
4404 two packages.
4405
4406 You can activate the readline support by issuing
4407
4408 (use-modules (readline-activator))
4409 (activate-readline)
4410
4411 from your ".guile" file, for example.
4412
4413 * Changes to the stand-alone interpreter
4414
4415 ** All builtins now print as primitives.
4416 Previously builtin procedures not belonging to the fundamental subr
4417 types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
4418 Now, they print as #<primitive-procedure NAME>.
4419
4420 ** Backtraces slightly more intelligible.
4421 gsubr-apply and macro transformer application frames no longer appear
4422 in backtraces.
4423
4424 * Changes to Scheme functions and syntax
4425
4426 ** Guile now correctly handles internal defines by rewriting them into
4427 their equivalent letrec. Previously, internal defines would
4428 incrementally add to the innermost environment, without checking
4429 whether the restrictions specified in RnRS were met. This lead to the
4430 correct behaviour when these restriction actually were met, but didn't
4431 catch all illegal uses. Such an illegal use could lead to crashes of
4432 the Guile interpreter or or other unwanted results. An example of
4433 incorrect internal defines that made Guile behave erratically:
4434
4435 (let ()
4436 (define a 1)
4437 (define (b) a)
4438 (define c (1+ (b)))
4439 (define d 3)
4440
4441 (b))
4442
4443 => 2
4444
4445 The problem with this example is that the definition of `c' uses the
4446 value of `b' directly. This confuses the meoization machine of Guile
4447 so that the second call of `b' (this time in a larger environment that
4448 also contains bindings for `c' and `d') refers to the binding of `c'
4449 instead of `a'. You could also make Guile crash with a variation on
4450 this theme:
4451
4452 (define (foo flag)
4453 (define a 1)
4454 (define (b flag) (if flag a 1))
4455 (define c (1+ (b flag)))
4456 (define d 3)
4457
4458 (b #t))
4459
4460 (foo #f)
4461 (foo #t)
4462
4463 From now on, Guile will issue an `Unbound variable: b' error message
4464 for both examples.
4465
4466 ** Hooks
4467
4468 A hook contains a list of functions which should be called on
4469 particular occasions in an existing program. Hooks are used for
4470 customization.
4471
4472 A window manager might have a hook before-window-map-hook. The window
4473 manager uses the function run-hooks to call all functions stored in
4474 before-window-map-hook each time a window is mapped. The user can
4475 store functions in the hook using add-hook!.
4476
4477 In Guile, hooks are first class objects.
4478
4479 *** New function: make-hook [N_ARGS]
4480
4481 Return a hook for hook functions which can take N_ARGS arguments.
4482 The default value for N_ARGS is 0.
4483
4484 (See also scm_make_named_hook below.)
4485
4486 *** New function: add-hook! HOOK PROC [APPEND_P]
4487
4488 Put PROC at the beginning of the list of functions stored in HOOK.
4489 If APPEND_P is supplied, and non-false, put PROC at the end instead.
4490
4491 PROC must be able to take the number of arguments specified when the
4492 hook was created.
4493
4494 If PROC already exists in HOOK, then remove it first.
4495
4496 *** New function: remove-hook! HOOK PROC
4497
4498 Remove PROC from the list of functions in HOOK.
4499
4500 *** New function: reset-hook! HOOK
4501
4502 Clear the list of hook functions stored in HOOK.
4503
4504 *** New function: run-hook HOOK ARG1 ...
4505
4506 Run all hook functions stored in HOOK with arguments ARG1 ... .
4507 The number of arguments supplied must correspond to the number given
4508 when the hook was created.
4509
4510 ** The function `dynamic-link' now takes optional keyword arguments.
4511 The only keyword argument that is currently defined is `:global
4512 BOOL'. With it, you can control whether the shared library will be
4513 linked in global mode or not. In global mode, the symbols from the
4514 linked library can be used to resolve references from other
4515 dynamically linked libraries. In non-global mode, the linked
4516 library is essentially invisible and can only be accessed via
4517 `dynamic-func', etc. The default is now to link in global mode.
4518 Previously, the default has been non-global mode.
4519
4520 The `#:global' keyword is only effective on platforms that support
4521 the dlopen family of functions.
4522
4523 ** New function `provided?'
4524
4525 - Function: provided? FEATURE
4526 Return true iff FEATURE is supported by this installation of
4527 Guile. FEATURE must be a symbol naming a feature; the global
4528 variable `*features*' is a list of available features.
4529
4530 ** Changes to the module (ice-9 expect):
4531
4532 *** The expect-strings macro now matches `$' in a regular expression
4533 only at a line-break or end-of-file by default. Previously it would
4534 match the end of the string accumulated so far. The old behaviour
4535 can be obtained by setting the variable `expect-strings-exec-flags'
4536 to 0.
4537
4538 *** The expect-strings macro now uses a variable `expect-strings-exec-flags'
4539 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
4540 in a regular expression will still match before a line-break or
4541 end-of-file. The default is `regexp/noteol'.
4542
4543 *** The expect-strings macro now uses a variable
4544 `expect-strings-compile-flags' for the flags to be supplied to
4545 `make-regexp'. The default is `regexp/newline', which was previously
4546 hard-coded.
4547
4548 *** The expect macro now supplies two arguments to a match procedure:
4549 the current accumulated string and a flag to indicate whether
4550 end-of-file has been reached. Previously only the string was supplied.
4551 If end-of-file is reached, the match procedure will be called an
4552 additional time with the same accumulated string as the previous call
4553 but with the flag set.
4554
4555 ** New module (ice-9 format), implementing the Common Lisp `format' function.
4556
4557 This code, and the documentation for it that appears here, was
4558 borrowed from SLIB, with minor adaptations for Guile.
4559
4560 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
4561 An almost complete implementation of Common LISP format description
4562 according to the CL reference book `Common LISP' from Guy L.
4563 Steele, Digital Press. Backward compatible to most of the
4564 available Scheme format implementations.
4565
4566 Returns `#t', `#f' or a string; has side effect of printing
4567 according to FORMAT-STRING. If DESTINATION is `#t', the output is
4568 to the current output port and `#t' is returned. If DESTINATION
4569 is `#f', a formatted string is returned as the result of the call.
4570 NEW: If DESTINATION is a string, DESTINATION is regarded as the
4571 format string; FORMAT-STRING is then the first argument and the
4572 output is returned as a string. If DESTINATION is a number, the
4573 output is to the current error port if available by the
4574 implementation. Otherwise DESTINATION must be an output port and
4575 `#t' is returned.
4576
4577 FORMAT-STRING must be a string. In case of a formatting error
4578 format returns `#f' and prints a message on the current output or
4579 error port. Characters are output as if the string were output by
4580 the `display' function with the exception of those prefixed by a
4581 tilde (~). For a detailed description of the FORMAT-STRING syntax
4582 please consult a Common LISP format reference manual. For a test
4583 suite to verify this format implementation load `formatst.scm'.
4584 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
4585
4586 Note: `format' is not reentrant, i.e. only one `format'-call may
4587 be executed at a time.
4588
4589
4590 *** Format Specification (Format version 3.0)
4591
4592 Please consult a Common LISP format reference manual for a detailed
4593 description of the format string syntax. For a demonstration of the
4594 implemented directives see `formatst.scm'.
4595
4596 This implementation supports directive parameters and modifiers (`:'
4597 and `@' characters). Multiple parameters must be separated by a comma
4598 (`,'). Parameters can be numerical parameters (positive or negative),
4599 character parameters (prefixed by a quote character (`''), variable
4600 parameters (`v'), number of rest arguments parameter (`#'), empty and
4601 default parameters. Directive characters are case independent. The
4602 general form of a directive is:
4603
4604 DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
4605
4606 DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
4607
4608 *** Implemented CL Format Control Directives
4609
4610 Documentation syntax: Uppercase characters represent the
4611 corresponding control directive characters. Lowercase characters
4612 represent control directive parameter descriptions.
4613
4614 `~A'
4615 Any (print as `display' does).
4616 `~@A'
4617 left pad.
4618
4619 `~MINCOL,COLINC,MINPAD,PADCHARA'
4620 full padding.
4621
4622 `~S'
4623 S-expression (print as `write' does).
4624 `~@S'
4625 left pad.
4626
4627 `~MINCOL,COLINC,MINPAD,PADCHARS'
4628 full padding.
4629
4630 `~D'
4631 Decimal.
4632 `~@D'
4633 print number sign always.
4634
4635 `~:D'
4636 print comma separated.
4637
4638 `~MINCOL,PADCHAR,COMMACHARD'
4639 padding.
4640
4641 `~X'
4642 Hexadecimal.
4643 `~@X'
4644 print number sign always.
4645
4646 `~:X'
4647 print comma separated.
4648
4649 `~MINCOL,PADCHAR,COMMACHARX'
4650 padding.
4651
4652 `~O'
4653 Octal.
4654 `~@O'
4655 print number sign always.
4656
4657 `~:O'
4658 print comma separated.
4659
4660 `~MINCOL,PADCHAR,COMMACHARO'
4661 padding.
4662
4663 `~B'
4664 Binary.
4665 `~@B'
4666 print number sign always.
4667
4668 `~:B'
4669 print comma separated.
4670
4671 `~MINCOL,PADCHAR,COMMACHARB'
4672 padding.
4673
4674 `~NR'
4675 Radix N.
4676 `~N,MINCOL,PADCHAR,COMMACHARR'
4677 padding.
4678
4679 `~@R'
4680 print a number as a Roman numeral.
4681
4682 `~:@R'
4683 print a number as an "old fashioned" Roman numeral.
4684
4685 `~:R'
4686 print a number as an ordinal English number.
4687
4688 `~:@R'
4689 print a number as a cardinal English number.
4690
4691 `~P'
4692 Plural.
4693 `~@P'
4694 prints `y' and `ies'.
4695
4696 `~:P'
4697 as `~P but jumps 1 argument backward.'
4698
4699 `~:@P'
4700 as `~@P but jumps 1 argument backward.'
4701
4702 `~C'
4703 Character.
4704 `~@C'
4705 prints a character as the reader can understand it (i.e. `#\'
4706 prefixing).
4707
4708 `~:C'
4709 prints a character as emacs does (eg. `^C' for ASCII 03).
4710
4711 `~F'
4712 Fixed-format floating-point (prints a flonum like MMM.NNN).
4713 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
4714 `~@F'
4715 If the number is positive a plus sign is printed.
4716
4717 `~E'
4718 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
4719 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
4720 `~@E'
4721 If the number is positive a plus sign is printed.
4722
4723 `~G'
4724 General floating-point (prints a flonum either fixed or
4725 exponential).
4726 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
4727 `~@G'
4728 If the number is positive a plus sign is printed.
4729
4730 `~$'
4731 Dollars floating-point (prints a flonum in fixed with signs
4732 separated).
4733 `~DIGITS,SCALE,WIDTH,PADCHAR$'
4734 `~@$'
4735 If the number is positive a plus sign is printed.
4736
4737 `~:@$'
4738 A sign is always printed and appears before the padding.
4739
4740 `~:$'
4741 The sign appears before the padding.
4742
4743 `~%'
4744 Newline.
4745 `~N%'
4746 print N newlines.
4747
4748 `~&'
4749 print newline if not at the beginning of the output line.
4750 `~N&'
4751 prints `~&' and then N-1 newlines.
4752
4753 `~|'
4754 Page Separator.
4755 `~N|'
4756 print N page separators.
4757
4758 `~~'
4759 Tilde.
4760 `~N~'
4761 print N tildes.
4762
4763 `~'<newline>
4764 Continuation Line.
4765 `~:'<newline>
4766 newline is ignored, white space left.
4767
4768 `~@'<newline>
4769 newline is left, white space ignored.
4770
4771 `~T'
4772 Tabulation.
4773 `~@T'
4774 relative tabulation.
4775
4776 `~COLNUM,COLINCT'
4777 full tabulation.
4778
4779 `~?'
4780 Indirection (expects indirect arguments as a list).
4781 `~@?'
4782 extracts indirect arguments from format arguments.
4783
4784 `~(STR~)'
4785 Case conversion (converts by `string-downcase').
4786 `~:(STR~)'
4787 converts by `string-capitalize'.
4788
4789 `~@(STR~)'
4790 converts by `string-capitalize-first'.
4791
4792 `~:@(STR~)'
4793 converts by `string-upcase'.
4794
4795 `~*'
4796 Argument Jumping (jumps 1 argument forward).
4797 `~N*'
4798 jumps N arguments forward.
4799
4800 `~:*'
4801 jumps 1 argument backward.
4802
4803 `~N:*'
4804 jumps N arguments backward.
4805
4806 `~@*'
4807 jumps to the 0th argument.
4808
4809 `~N@*'
4810 jumps to the Nth argument (beginning from 0)
4811
4812 `~[STR0~;STR1~;...~;STRN~]'
4813 Conditional Expression (numerical clause conditional).
4814 `~N['
4815 take argument from N.
4816
4817 `~@['
4818 true test conditional.
4819
4820 `~:['
4821 if-else-then conditional.
4822
4823 `~;'
4824 clause separator.
4825
4826 `~:;'
4827 default clause follows.
4828
4829 `~{STR~}'
4830 Iteration (args come from the next argument (a list)).
4831 `~N{'
4832 at most N iterations.
4833
4834 `~:{'
4835 args from next arg (a list of lists).
4836
4837 `~@{'
4838 args from the rest of arguments.
4839
4840 `~:@{'
4841 args from the rest args (lists).
4842
4843 `~^'
4844 Up and out.
4845 `~N^'
4846 aborts if N = 0
4847
4848 `~N,M^'
4849 aborts if N = M
4850
4851 `~N,M,K^'
4852 aborts if N <= M <= K
4853
4854 *** Not Implemented CL Format Control Directives
4855
4856 `~:A'
4857 print `#f' as an empty list (see below).
4858
4859 `~:S'
4860 print `#f' as an empty list (see below).
4861
4862 `~<~>'
4863 Justification.
4864
4865 `~:^'
4866 (sorry I don't understand its semantics completely)
4867
4868 *** Extended, Replaced and Additional Control Directives
4869
4870 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
4871 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
4872 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
4873 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
4874 `~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
4875 COMMAWIDTH is the number of characters between two comma
4876 characters.
4877
4878 `~I'
4879 print a R4RS complex number as `~F~@Fi' with passed parameters for
4880 `~F'.
4881
4882 `~Y'
4883 Pretty print formatting of an argument for scheme code lists.
4884
4885 `~K'
4886 Same as `~?.'
4887
4888 `~!'
4889 Flushes the output if format DESTINATION is a port.
4890
4891 `~_'
4892 Print a `#\space' character
4893 `~N_'
4894 print N `#\space' characters.
4895
4896 `~/'
4897 Print a `#\tab' character
4898 `~N/'
4899 print N `#\tab' characters.
4900
4901 `~NC'
4902 Takes N as an integer representation for a character. No arguments
4903 are consumed. N is converted to a character by `integer->char'. N
4904 must be a positive decimal number.
4905
4906 `~:S'
4907 Print out readproof. Prints out internal objects represented as
4908 `#<...>' as strings `"#<...>"' so that the format output can always
4909 be processed by `read'.
4910
4911 `~:A'
4912 Print out readproof. Prints out internal objects represented as
4913 `#<...>' as strings `"#<...>"' so that the format output can always
4914 be processed by `read'.
4915
4916 `~Q'
4917 Prints information and a copyright notice on the format
4918 implementation.
4919 `~:Q'
4920 prints format version.
4921
4922 `~F, ~E, ~G, ~$'
4923 may also print number strings, i.e. passing a number as a string
4924 and format it accordingly.
4925
4926 *** Configuration Variables
4927
4928 The format module exports some configuration variables to suit the
4929 systems and users needs. There should be no modification necessary for
4930 the configuration that comes with Guile. Format detects automatically
4931 if the running scheme system implements floating point numbers and
4932 complex numbers.
4933
4934 format:symbol-case-conv
4935 Symbols are converted by `symbol->string' so the case type of the
4936 printed symbols is implementation dependent.
4937 `format:symbol-case-conv' is a one arg closure which is either
4938 `#f' (no conversion), `string-upcase', `string-downcase' or
4939 `string-capitalize'. (default `#f')
4940
4941 format:iobj-case-conv
4942 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
4943 implementation internal objects. (default `#f')
4944
4945 format:expch
4946 The character prefixing the exponent value in `~E' printing.
4947 (default `#\E')
4948
4949 *** Compatibility With Other Format Implementations
4950
4951 SLIB format 2.x:
4952 See `format.doc'.
4953
4954 SLIB format 1.4:
4955 Downward compatible except for padding support and `~A', `~S',
4956 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
4957 `printf' padding support which is completely replaced by the CL
4958 `format' padding style.
4959
4960 MIT C-Scheme 7.1:
4961 Downward compatible except for `~', which is not documented
4962 (ignores all characters inside the format string up to a newline
4963 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
4964 numerical and variable parameters and `:/@' modifiers in the CL
4965 sense).
4966
4967 Elk 1.5/2.0:
4968 Downward compatible except for `~A' and `~S' which print in
4969 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
4970 directive parameters or modifiers)).
4971
4972 Scheme->C 01nov91:
4973 Downward compatible except for an optional destination parameter:
4974 S2C accepts a format call without a destination which returns a
4975 formatted string. This is equivalent to a #f destination in S2C.
4976 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
4977 parameters or modifiers)).
4978
4979
4980 ** Changes to string-handling functions.
4981
4982 These functions were added to support the (ice-9 format) module, above.
4983
4984 *** New function: string-upcase STRING
4985 *** New function: string-downcase STRING
4986
4987 These are non-destructive versions of the existing string-upcase! and
4988 string-downcase! functions.
4989
4990 *** New function: string-capitalize! STRING
4991 *** New function: string-capitalize STRING
4992
4993 These functions convert the first letter of each word in the string to
4994 upper case. Thus:
4995
4996 (string-capitalize "howdy there")
4997 => "Howdy There"
4998
4999 As with the other functions, string-capitalize! modifies the string in
5000 place, while string-capitalize returns a modified copy of its argument.
5001
5002 *** New function: string-ci->symbol STRING
5003
5004 Return a symbol whose name is STRING, but having the same case as if
5005 the symbol had be read by `read'.
5006
5007 Guile can be configured to be sensitive or insensitive to case
5008 differences in Scheme identifiers. If Guile is case-insensitive, all
5009 symbols are converted to lower case on input. The `string-ci->symbol'
5010 function returns a symbol whose name in STRING, transformed as Guile
5011 would if STRING were input.
5012
5013 *** New function: substring-move! STRING1 START END STRING2 START
5014
5015 Copy the substring of STRING1 from START (inclusive) to END
5016 (exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
5017 string, and the source and destination areas may overlap; in all
5018 cases, the function behaves as if all the characters were copied
5019 simultanously.
5020
5021 *** Extended functions: substring-move-left! substring-move-right!
5022
5023 These functions now correctly copy arbitrarily overlapping substrings;
5024 they are both synonyms for substring-move!.
5025
5026
5027 ** New module (ice-9 getopt-long), with the function `getopt-long'.
5028
5029 getopt-long is a function for parsing command-line arguments in a
5030 manner consistent with other GNU programs.
5031
5032 (getopt-long ARGS GRAMMAR)
5033 Parse the arguments ARGS according to the argument list grammar GRAMMAR.
5034
5035 ARGS should be a list of strings. Its first element should be the
5036 name of the program; subsequent elements should be the arguments
5037 that were passed to the program on the command line. The
5038 `program-arguments' procedure returns a list of this form.
5039
5040 GRAMMAR is a list of the form:
5041 ((OPTION (PROPERTY VALUE) ...) ...)
5042
5043 Each OPTION should be a symbol. `getopt-long' will accept a
5044 command-line option named `--OPTION'.
5045 Each option can have the following (PROPERTY VALUE) pairs:
5046
5047 (single-char CHAR) --- Accept `-CHAR' as a single-character
5048 equivalent to `--OPTION'. This is how to specify traditional
5049 Unix-style flags.
5050 (required? BOOL) --- If BOOL is true, the option is required.
5051 getopt-long will raise an error if it is not found in ARGS.
5052 (value BOOL) --- If BOOL is #t, the option accepts a value; if
5053 it is #f, it does not; and if it is the symbol
5054 `optional', the option may appear in ARGS with or
5055 without a value.
5056 (predicate FUNC) --- If the option accepts a value (i.e. you
5057 specified `(value #t)' for this option), then getopt
5058 will apply FUNC to the value, and throw an exception
5059 if it returns #f. FUNC should be a procedure which
5060 accepts a string and returns a boolean value; you may
5061 need to use quasiquotes to get it into GRAMMAR.
5062
5063 The (PROPERTY VALUE) pairs may occur in any order, but each
5064 property may occur only once. By default, options do not have
5065 single-character equivalents, are not required, and do not take
5066 values.
5067
5068 In ARGS, single-character options may be combined, in the usual
5069 Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
5070 accepts values, then it must be the last option in the
5071 combination; the value is the next argument. So, for example, using
5072 the following grammar:
5073 ((apples (single-char #\a))
5074 (blimps (single-char #\b) (value #t))
5075 (catalexis (single-char #\c) (value #t)))
5076 the following argument lists would be acceptable:
5077 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
5078 for "blimps" and "catalexis")
5079 ("-ab" "bang" "-c" "couth") (same)
5080 ("-ac" "couth" "-b" "bang") (same)
5081 ("-abc" "couth" "bang") (an error, since `-b' is not the
5082 last option in its combination)
5083
5084 If an option's value is optional, then `getopt-long' decides
5085 whether it has a value by looking at what follows it in ARGS. If
5086 the next element is a string, and it does not appear to be an
5087 option itself, then that string is the option's value.
5088
5089 The value of a long option can appear as the next element in ARGS,
5090 or it can follow the option name, separated by an `=' character.
5091 Thus, using the same grammar as above, the following argument lists
5092 are equivalent:
5093 ("--apples" "Braeburn" "--blimps" "Goodyear")
5094 ("--apples=Braeburn" "--blimps" "Goodyear")
5095 ("--blimps" "Goodyear" "--apples=Braeburn")
5096
5097 If the option "--" appears in ARGS, argument parsing stops there;
5098 subsequent arguments are returned as ordinary arguments, even if
5099 they resemble options. So, in the argument list:
5100 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
5101 `getopt-long' will recognize the `apples' option as having the
5102 value "Granny Smith", but it will not recognize the `blimp'
5103 option; it will return the strings "--blimp" and "Goodyear" as
5104 ordinary argument strings.
5105
5106 The `getopt-long' function returns the parsed argument list as an
5107 assocation list, mapping option names --- the symbols from GRAMMAR
5108 --- onto their values, or #t if the option does not accept a value.
5109 Unused options do not appear in the alist.
5110
5111 All arguments that are not the value of any option are returned
5112 as a list, associated with the empty list.
5113
5114 `getopt-long' throws an exception if:
5115 - it finds an unrecognized option in ARGS
5116 - a required option is omitted
5117 - an option that requires an argument doesn't get one
5118 - an option that doesn't accept an argument does get one (this can
5119 only happen using the long option `--opt=value' syntax)
5120 - an option predicate fails
5121
5122 So, for example:
5123
5124 (define grammar
5125 `((lockfile-dir (required? #t)
5126 (value #t)
5127 (single-char #\k)
5128 (predicate ,file-is-directory?))
5129 (verbose (required? #f)
5130 (single-char #\v)
5131 (value #f))
5132 (x-includes (single-char #\x))
5133 (rnet-server (single-char #\y)
5134 (predicate ,string?))))
5135
5136 (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
5137 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
5138 grammar)
5139 => ((() "foo1" "-fred" "foo2" "foo3")
5140 (rnet-server . "lamprod")
5141 (x-includes . "/usr/include")
5142 (lockfile-dir . "/tmp")
5143 (verbose . #t))
5144
5145 ** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
5146
5147 It will be removed in a few releases.
5148
5149 ** New syntax: lambda*
5150 ** New syntax: define*
5151 ** New syntax: define*-public
5152 ** New syntax: defmacro*
5153 ** New syntax: defmacro*-public
5154 Guile now supports optional arguments.
5155
5156 `lambda*', `define*', `define*-public', `defmacro*' and
5157 `defmacro*-public' are identical to the non-* versions except that
5158 they use an extended type of parameter list that has the following BNF
5159 syntax (parentheses are literal, square brackets indicate grouping,
5160 and `*', `+' and `?' have the usual meaning):
5161
5162 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
5163 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
5164 [[#&rest identifier]|[. identifier]]? ) | [identifier]
5165
5166 ext-var-decl ::= identifier | ( identifier expression )
5167
5168 The semantics are best illustrated with the following documentation
5169 and examples for `lambda*':
5170
5171 lambda* args . body
5172 lambda extended for optional and keyword arguments
5173
5174 lambda* creates a procedure that takes optional arguments. These
5175 are specified by putting them inside brackets at the end of the
5176 paramater list, but before any dotted rest argument. For example,
5177 (lambda* (a b #&optional c d . e) '())
5178 creates a procedure with fixed arguments a and b, optional arguments c
5179 and d, and rest argument e. If the optional arguments are omitted
5180 in a call, the variables for them are unbound in the procedure. This
5181 can be checked with the bound? macro.
5182
5183 lambda* can also take keyword arguments. For example, a procedure
5184 defined like this:
5185 (lambda* (#&key xyzzy larch) '())
5186 can be called with any of the argument lists (#:xyzzy 11)
5187 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
5188 are given as keywords are bound to values.
5189
5190 Optional and keyword arguments can also be given default values
5191 which they take on when they are not present in a call, by giving a
5192 two-item list in place of an optional argument, for example in:
5193 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
5194 foo is a fixed argument, bar is an optional argument with default
5195 value 42, and baz is a keyword argument with default value 73.
5196 Default value expressions are not evaluated unless they are needed
5197 and until the procedure is called.
5198
5199 lambda* now supports two more special parameter list keywords.
5200
5201 lambda*-defined procedures now throw an error by default if a
5202 keyword other than one of those specified is found in the actual
5203 passed arguments. However, specifying #&allow-other-keys
5204 immediately after the kyword argument declarations restores the
5205 previous behavior of ignoring unknown keywords. lambda* also now
5206 guarantees that if the same keyword is passed more than once, the
5207 last one passed is the one that takes effect. For example,
5208 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
5209 #:heads 37 #:tails 42 #:heads 99)
5210 would result in (99 47) being displayed.
5211
5212 #&rest is also now provided as a synonym for the dotted syntax rest
5213 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
5214 all respects to lambda*. This is provided for more similarity to DSSSL,
5215 MIT-Scheme and Kawa among others, as well as for refugees from other
5216 Lisp dialects.
5217
5218 Further documentation may be found in the optargs.scm file itself.
5219
5220 The optional argument module also exports the macros `let-optional',
5221 `let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
5222 are not documented here because they may be removed in the future, but
5223 full documentation is still available in optargs.scm.
5224
5225 ** New syntax: and-let*
5226 Guile now supports the `and-let*' form, described in the draft SRFI-2.
5227
5228 Syntax: (land* (<clause> ...) <body> ...)
5229 Each <clause> should have one of the following forms:
5230 (<variable> <expression>)
5231 (<expression>)
5232 <bound-variable>
5233 Each <variable> or <bound-variable> should be an identifier. Each
5234 <expression> should be a valid expression. The <body> should be a
5235 possibly empty sequence of expressions, like the <body> of a
5236 lambda form.
5237
5238 Semantics: A LAND* expression is evaluated by evaluating the
5239 <expression> or <bound-variable> of each of the <clause>s from
5240 left to right. The value of the first <expression> or
5241 <bound-variable> that evaluates to a false value is returned; the
5242 remaining <expression>s and <bound-variable>s are not evaluated.
5243 The <body> forms are evaluated iff all the <expression>s and
5244 <bound-variable>s evaluate to true values.
5245
5246 The <expression>s and the <body> are evaluated in an environment
5247 binding each <variable> of the preceding (<variable> <expression>)
5248 clauses to the value of the <expression>. Later bindings
5249 shadow earlier bindings.
5250
5251 Guile's and-let* macro was contributed by Michael Livshin.
5252
5253 ** New sorting functions
5254
5255 *** New function: sorted? SEQUENCE LESS?
5256 Returns `#t' when the sequence argument is in non-decreasing order
5257 according to LESS? (that is, there is no adjacent pair `... x y
5258 ...' for which `(less? y x)').
5259
5260 Returns `#f' when the sequence contains at least one out-of-order
5261 pair. It is an error if the sequence is neither a list nor a
5262 vector.
5263
5264 *** New function: merge LIST1 LIST2 LESS?
5265 LIST1 and LIST2 are sorted lists.
5266 Returns the sorted list of all elements in LIST1 and LIST2.
5267
5268 Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
5269 in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
5270 and that a < b1 in LIST1. Then a < b1 < b2 in the result.
5271 (Here "<" should read "comes before".)
5272
5273 *** New procedure: merge! LIST1 LIST2 LESS?
5274 Merges two lists, re-using the pairs of LIST1 and LIST2 to build
5275 the result. If the code is compiled, and LESS? constructs no new
5276 pairs, no pairs at all will be allocated. The first pair of the
5277 result will be either the first pair of LIST1 or the first pair of
5278 LIST2.
5279
5280 *** New function: sort SEQUENCE LESS?
5281 Accepts either a list or a vector, and returns a new sequence
5282 which is sorted. The new sequence is the same type as the input.
5283 Always `(sorted? (sort sequence less?) less?)'. The original
5284 sequence is not altered in any way. The new sequence shares its
5285 elements with the old one; no elements are copied.
5286
5287 *** New procedure: sort! SEQUENCE LESS
5288 Returns its sorted result in the original boxes. No new storage is
5289 allocated at all. Proper usage: (set! slist (sort! slist <))
5290
5291 *** New function: stable-sort SEQUENCE LESS?
5292 Similar to `sort' but stable. That is, if "equal" elements are
5293 ordered a < b in the original sequence, they will have the same order
5294 in the result.
5295
5296 *** New function: stable-sort! SEQUENCE LESS?
5297 Similar to `sort!' but stable.
5298 Uses temporary storage when sorting vectors.
5299
5300 *** New functions: sort-list, sort-list!
5301 Added for compatibility with scsh.
5302
5303 ** New built-in random number support
5304
5305 *** New function: random N [STATE]
5306 Accepts a positive integer or real N and returns a number of the
5307 same type between zero (inclusive) and N (exclusive). The values
5308 returned have a uniform distribution.
5309
5310 The optional argument STATE must be of the type produced by
5311 `copy-random-state' or `seed->random-state'. It defaults to the value
5312 of the variable `*random-state*'. This object is used to maintain the
5313 state of the pseudo-random-number generator and is altered as a side
5314 effect of the `random' operation.
5315
5316 *** New variable: *random-state*
5317 Holds a data structure that encodes the internal state of the
5318 random-number generator that `random' uses by default. The nature
5319 of this data structure is implementation-dependent. It may be
5320 printed out and successfully read back in, but may or may not
5321 function correctly as a random-number state object in another
5322 implementation.
5323
5324 *** New function: copy-random-state [STATE]
5325 Returns a new object of type suitable for use as the value of the
5326 variable `*random-state*' and as a second argument to `random'.
5327 If argument STATE is given, a copy of it is returned. Otherwise a
5328 copy of `*random-state*' is returned.
5329
5330 *** New function: seed->random-state SEED
5331 Returns a new object of type suitable for use as the value of the
5332 variable `*random-state*' and as a second argument to `random'.
5333 SEED is a string or a number. A new state is generated and
5334 initialized using SEED.
5335
5336 *** New function: random:uniform [STATE]
5337 Returns an uniformly distributed inexact real random number in the
5338 range between 0 and 1.
5339
5340 *** New procedure: random:solid-sphere! VECT [STATE]
5341 Fills VECT with inexact real random numbers the sum of whose
5342 squares is less than 1.0. Thinking of VECT as coordinates in
5343 space of dimension N = `(vector-length VECT)', the coordinates are
5344 uniformly distributed within the unit N-shere. The sum of the
5345 squares of the numbers is returned. VECT can be either a vector
5346 or a uniform vector of doubles.
5347
5348 *** New procedure: random:hollow-sphere! VECT [STATE]
5349 Fills VECT with inexact real random numbers the sum of whose squares
5350 is equal to 1.0. Thinking of VECT as coordinates in space of
5351 dimension n = `(vector-length VECT)', the coordinates are uniformly
5352 distributed over the surface of the unit n-shere. VECT can be either
5353 a vector or a uniform vector of doubles.
5354
5355 *** New function: random:normal [STATE]
5356 Returns an inexact real in a normal distribution with mean 0 and
5357 standard deviation 1. For a normal distribution with mean M and
5358 standard deviation D use `(+ M (* D (random:normal)))'.
5359
5360 *** New procedure: random:normal-vector! VECT [STATE]
5361 Fills VECT with inexact real random numbers which are independent and
5362 standard normally distributed (i.e., with mean 0 and variance 1).
5363 VECT can be either a vector or a uniform vector of doubles.
5364
5365 *** New function: random:exp STATE
5366 Returns an inexact real in an exponential distribution with mean 1.
5367 For an exponential distribution with mean U use (* U (random:exp)).
5368
5369 ** The range of logand, logior, logxor, logtest, and logbit? have changed.
5370
5371 These functions now operate on numbers in the range of a C unsigned
5372 long.
5373
5374 These functions used to operate on numbers in the range of a C signed
5375 long; however, this seems inappropriate, because Guile integers don't
5376 overflow.
5377
5378 ** New function: make-guardian
5379 This is an implementation of guardians as described in
5380 R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
5381 Generation-Based Garbage Collector" ACM SIGPLAN Conference on
5382 Programming Language Design and Implementation, June 1993
5383 ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
5384
5385 ** New functions: delq1!, delv1!, delete1!
5386 These procedures behave similar to delq! and friends but delete only
5387 one object if at all.
5388
5389 ** New function: unread-string STRING PORT
5390 Unread STRING to PORT, that is, push it back onto the port so that
5391 next read operation will work on the pushed back characters.
5392
5393 ** unread-char can now be called multiple times
5394 If unread-char is called multiple times, the unread characters will be
5395 read again in last-in first-out order.
5396
5397 ** the procedures uniform-array-read! and uniform-array-write! now
5398 work on any kind of port, not just ports which are open on a file.
5399
5400 ** Now 'l' in a port mode requests line buffering.
5401
5402 ** The procedure truncate-file now works on string ports as well
5403 as file ports. If the size argument is omitted, the current
5404 file position is used.
5405
5406 ** new procedure: seek PORT/FDES OFFSET WHENCE
5407 The arguments are the same as for the old fseek procedure, but it
5408 works on string ports as well as random-access file ports.
5409
5410 ** the fseek procedure now works on string ports, since it has been
5411 redefined using seek.
5412
5413 ** the setvbuf procedure now uses a default size if mode is _IOFBF and
5414 size is not supplied.
5415
5416 ** the newline procedure no longer flushes the port if it's not
5417 line-buffered: previously it did if it was the current output port.
5418
5419 ** open-pipe and close-pipe are no longer primitive procedures, but
5420 an emulation can be obtained using `(use-modules (ice-9 popen))'.
5421
5422 ** the freopen procedure has been removed.
5423
5424 ** new procedure: drain-input PORT
5425 Drains PORT's read buffers (including any pushed-back characters)
5426 and returns the contents as a single string.
5427
5428 ** New function: map-in-order PROC LIST1 LIST2 ...
5429 Version of `map' which guarantees that the procedure is applied to the
5430 lists in serial order.
5431
5432 ** Renamed `serial-array-copy!' and `serial-array-map!' to
5433 `array-copy-in-order!' and `array-map-in-order!'. The old names are
5434 now obsolete and will go away in release 1.5.
5435
5436 ** New syntax: collect BODY1 ...
5437 Version of `begin' which returns a list of the results of the body
5438 forms instead of the result of the last body form. In contrast to
5439 `begin', `collect' allows an empty body.
5440
5441 ** New functions: read-history FILENAME, write-history FILENAME
5442 Read/write command line history from/to file. Returns #t on success
5443 and #f if an error occured.
5444
5445 ** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
5446
5447 These procedures return a list of definitions available in the specified
5448 argument, a relative module reference. In the case of no argument,
5449 `(current-module)' is now consulted for definitions to return, instead
5450 of simply returning #f, the former behavior.
5451
5452 ** The #/ syntax for lists is no longer supported.
5453
5454 Earlier versions of Scheme accepted this syntax, but printed a
5455 warning.
5456
5457 ** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
5458
5459 Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
5460 modules.
5461
5462 * Changes to the gh_ interface
5463
5464 ** gh_scm2doubles
5465
5466 Now takes a second argument which is the result array. If this
5467 pointer is NULL, a new array is malloced (the old behaviour).
5468
5469 ** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
5470 gh_scm2shorts, gh_scm2longs, gh_scm2floats
5471
5472 New functions.
5473
5474 * Changes to the scm_ interface
5475
5476 ** Function: scm_make_named_hook (char* name, int n_args)
5477
5478 Creates a hook in the same way as make-hook above but also
5479 binds a variable named NAME to it.
5480
5481 This is the typical way of creating a hook from C code.
5482
5483 Currently, the variable is created in the "current" module. This
5484 might change when we get the new module system.
5485
5486 ** The smob interface
5487
5488 The interface for creating smobs has changed. For documentation, see
5489 data-rep.info (made from guile-core/doc/data-rep.texi).
5490
5491 *** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
5492
5493 >>> This function will be removed in 1.3.4. <<<
5494
5495 It is replaced by:
5496
5497 *** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
5498 This function adds a new smob type, named NAME, with instance size
5499 SIZE to the system. The return value is a tag that is used in
5500 creating instances of the type. If SIZE is 0, then no memory will
5501 be allocated when instances of the smob are created, and nothing
5502 will be freed by the default free function.
5503
5504 *** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
5505 This function sets the smob marking procedure for the smob type
5506 specified by the tag TC. TC is the tag returned by
5507 `scm_make_smob_type'.
5508
5509 *** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
5510 This function sets the smob freeing procedure for the smob type
5511 specified by the tag TC. TC is the tag returned by
5512 `scm_make_smob_type'.
5513
5514 *** Function: void scm_set_smob_print (tc, print)
5515
5516 - Function: void scm_set_smob_print (long tc,
5517 scm_sizet (*print) (SCM,
5518 SCM,
5519 scm_print_state *))
5520
5521 This function sets the smob printing procedure for the smob type
5522 specified by the tag TC. TC is the tag returned by
5523 `scm_make_smob_type'.
5524
5525 *** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
5526 This function sets the smob equality-testing predicate for the
5527 smob type specified by the tag TC. TC is the tag returned by
5528 `scm_make_smob_type'.
5529
5530 *** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
5531 Make VALUE contain a smob instance of the type with type code TC and
5532 smob data DATA. VALUE must be previously declared as C type `SCM'.
5533
5534 *** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
5535 This macro expands to a block of code that creates a smob instance
5536 of the type with type code TC and smob data DATA, and returns that
5537 `SCM' value. It should be the last piece of code in a block.
5538
5539 ** The interfaces for using I/O ports and implementing port types
5540 (ptobs) have changed significantly. The new interface is based on
5541 shared access to buffers and a new set of ptob procedures.
5542
5543 *** scm_newptob has been removed
5544
5545 It is replaced by:
5546
5547 *** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
5548
5549 - Function: SCM scm_make_port_type (char *type_name,
5550 int (*fill_buffer) (SCM port),
5551 void (*write_flush) (SCM port));
5552
5553 Similarly to the new smob interface, there is a set of function
5554 setters by which the user can customize the behaviour of his port
5555 type. See ports.h (scm_set_port_XXX).
5556
5557 ** scm_strport_to_string: New function: creates a new string from
5558 a string port's buffer.
5559
5560 ** Plug in interface for random number generators
5561 The variable `scm_the_rng' in random.c contains a value and three
5562 function pointers which together define the current random number
5563 generator being used by the Scheme level interface and the random
5564 number library functions.
5565
5566 The user is free to replace the default generator with the generator
5567 of his own choice.
5568
5569 *** Variable: size_t scm_the_rng.rstate_size
5570 The size of the random state type used by the current RNG
5571 measured in chars.
5572
5573 *** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
5574 Given the random STATE, return 32 random bits.
5575
5576 *** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
5577 Seed random state STATE using string S of length N.
5578
5579 *** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
5580 Given random state STATE, return a malloced copy.
5581
5582 ** Default RNG
5583 The default RNG is the MWC (Multiply With Carry) random number
5584 generator described by George Marsaglia at the Department of
5585 Statistics and Supercomputer Computations Research Institute, The
5586 Florida State University (http://stat.fsu.edu/~geo).
5587
5588 It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
5589 passes all tests in the DIEHARD test suite
5590 (http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
5591 costs one multiply and one add on platforms which either supports long
5592 longs (gcc does this on most systems) or have 64 bit longs. The cost
5593 is four multiply on other systems but this can be optimized by writing
5594 scm_i_uniform32 in assembler.
5595
5596 These functions are provided through the scm_the_rng interface for use
5597 by libguile and the application.
5598
5599 *** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
5600 Given the random STATE, return 32 random bits.
5601 Don't use this function directly. Instead go through the plugin
5602 interface (see "Plug in interface" above).
5603
5604 *** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
5605 Initialize STATE using SEED of length N.
5606
5607 *** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
5608 Return a malloc:ed copy of STATE. This function can easily be re-used
5609 in the interfaces to other RNGs.
5610
5611 ** Random number library functions
5612 These functions use the current RNG through the scm_the_rng interface.
5613 It might be a good idea to use these functions from your C code so
5614 that only one random generator is used by all code in your program.
5615
5616 The default random state is stored in:
5617
5618 *** Variable: SCM scm_var_random_state
5619 Contains the vcell of the Scheme variable "*random-state*" which is
5620 used as default state by all random number functions in the Scheme
5621 level interface.
5622
5623 Example:
5624
5625 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
5626
5627 *** Function: scm_rstate *scm_c_default_rstate (void)
5628 This is a convenience function which returns the value of
5629 scm_var_random_state. An error message is generated if this value
5630 isn't a random state.
5631
5632 *** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
5633 Make a new random state from the string SEED of length LENGTH.
5634
5635 It is generally not a good idea to use multiple random states in a
5636 program. While subsequent random numbers generated from one random
5637 state are guaranteed to be reasonably independent, there is no such
5638 guarantee for numbers generated from different random states.
5639
5640 *** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
5641 Return 32 random bits.
5642
5643 *** Function: double scm_c_uniform01 (scm_rstate *STATE)
5644 Return a sample from the uniform(0,1) distribution.
5645
5646 *** Function: double scm_c_normal01 (scm_rstate *STATE)
5647 Return a sample from the normal(0,1) distribution.
5648
5649 *** Function: double scm_c_exp1 (scm_rstate *STATE)
5650 Return a sample from the exp(1) distribution.
5651
5652 *** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
5653 Return a sample from the discrete uniform(0,M) distribution.
5654
5655 *** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
5656 Return a sample from the discrete uniform(0,M) distribution.
5657 M must be a bignum object. The returned value may be an INUM.
5658
5659
5660 \f
5661 Changes in Guile 1.3 (released Monday, October 19, 1998):
5662
5663 * Changes to the distribution
5664
5665 ** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
5666 To avoid conflicts, programs should name environment variables after
5667 themselves, except when there's a common practice establishing some
5668 other convention.
5669
5670 For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
5671 giving the former precedence, and printing a warning message if the
5672 latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
5673
5674 ** The header files related to multi-byte characters have been removed.
5675 They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
5676 which referred to these explicitly will probably need to be rewritten,
5677 since the support for the variant string types has been removed; see
5678 below.
5679
5680 ** The header files append.h and sequences.h have been removed. These
5681 files implemented non-R4RS operations which would encourage
5682 non-portable programming style and less easy-to-read code.
5683
5684 * Changes to the stand-alone interpreter
5685
5686 ** New procedures have been added to implement a "batch mode":
5687
5688 *** Function: batch-mode?
5689
5690 Returns a boolean indicating whether the interpreter is in batch
5691 mode.
5692
5693 *** Function: set-batch-mode?! ARG
5694
5695 If ARG is true, switches the interpreter to batch mode. The `#f'
5696 case has not been implemented.
5697
5698 ** Guile now provides full command-line editing, when run interactively.
5699 To use this feature, you must have the readline library installed.
5700 The Guile build process will notice it, and automatically include
5701 support for it.
5702
5703 The readline library is available via anonymous FTP from any GNU
5704 mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
5705
5706 ** the-last-stack is now a fluid.
5707
5708 * Changes to the procedure for linking libguile with your programs
5709
5710 ** You can now use the `guile-config' utility to build programs that use Guile.
5711
5712 Guile now includes a command-line utility called `guile-config', which
5713 can provide information about how to compile and link programs that
5714 use Guile.
5715
5716 *** `guile-config compile' prints any C compiler flags needed to use Guile.
5717 You should include this command's output on the command line you use
5718 to compile C or C++ code that #includes the Guile header files. It's
5719 usually just a `-I' flag to help the compiler find the Guile headers.
5720
5721
5722 *** `guile-config link' prints any linker flags necessary to link with Guile.
5723
5724 This command writes to its standard output a list of flags which you
5725 must pass to the linker to link your code against the Guile library.
5726 The flags include '-lguile' itself, any other libraries the Guile
5727 library depends upon, and any `-L' flags needed to help the linker
5728 find those libraries.
5729
5730 For example, here is a Makefile rule that builds a program named 'foo'
5731 from the object files ${FOO_OBJECTS}, and links them against Guile:
5732
5733 foo: ${FOO_OBJECTS}
5734 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
5735
5736 Previous Guile releases recommended that you use autoconf to detect
5737 which of a predefined set of libraries were present on your system.
5738 It is more robust to use `guile-config', since it records exactly which
5739 libraries the installed Guile library requires.
5740
5741 This was originally called `build-guile', but was renamed to
5742 `guile-config' before Guile 1.3 was released, to be consistent with
5743 the analogous script for the GTK+ GUI toolkit, which is called
5744 `gtk-config'.
5745
5746
5747 ** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
5748
5749 If you are using the GNU autoconf package to configure your program,
5750 you can use the GUILE_FLAGS autoconf macro to call `guile-config'
5751 (described above) and gather the necessary values for use in your
5752 Makefiles.
5753
5754 The GUILE_FLAGS macro expands to configure script code which runs the
5755 `guile-config' script, to find out where Guile's header files and
5756 libraries are installed. It sets two variables, marked for
5757 substitution, as by AC_SUBST.
5758
5759 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
5760 code that uses Guile header files. This is almost always just a
5761 -I flag.
5762
5763 GUILE_LDFLAGS --- flags to pass to the linker to link a
5764 program against Guile. This includes `-lguile' for the Guile
5765 library itself, any libraries that Guile itself requires (like
5766 -lqthreads), and so on. It may also include a -L flag to tell the
5767 compiler where to find the libraries.
5768
5769 GUILE_FLAGS is defined in the file guile.m4, in the top-level
5770 directory of the Guile distribution. You can copy it into your
5771 package's aclocal.m4 file, and then use it in your configure.in file.
5772
5773 If you are using the `aclocal' program, distributed with GNU automake,
5774 to maintain your aclocal.m4 file, the Guile installation process
5775 installs guile.m4 where aclocal will find it. All you need to do is
5776 use GUILE_FLAGS in your configure.in file, and then run `aclocal';
5777 this will copy the definition of GUILE_FLAGS into your aclocal.m4
5778 file.
5779
5780
5781 * Changes to Scheme functions and syntax
5782
5783 ** Multi-byte strings have been removed, as have multi-byte and wide
5784 ports. We felt that these were the wrong approach to
5785 internationalization support.
5786
5787 ** New function: readline [PROMPT]
5788 Read a line from the terminal, and allow the user to edit it,
5789 prompting with PROMPT. READLINE provides a large set of Emacs-like
5790 editing commands, lets the user recall previously typed lines, and
5791 works on almost every kind of terminal, including dumb terminals.
5792
5793 READLINE assumes that the cursor is at the beginning of the line when
5794 it is invoked. Thus, you can't print a prompt yourself, and then call
5795 READLINE; you need to package up your prompt as a string, pass it to
5796 the function, and let READLINE print the prompt itself. This is
5797 because READLINE needs to know the prompt's screen width.
5798
5799 For Guile to provide this function, you must have the readline
5800 library, version 2.1 or later, installed on your system. Readline is
5801 available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
5802 any GNU mirror site.
5803
5804 See also ADD-HISTORY function.
5805
5806 ** New function: add-history STRING
5807 Add STRING as the most recent line in the history used by the READLINE
5808 command. READLINE does not add lines to the history itself; you must
5809 call ADD-HISTORY to make previous input available to the user.
5810
5811 ** The behavior of the read-line function has changed.
5812
5813 This function now uses standard C library functions to read the line,
5814 for speed. This means that it doesn not respect the value of
5815 scm-line-incrementors; it assumes that lines are delimited with
5816 #\newline.
5817
5818 (Note that this is read-line, the function that reads a line of text
5819 from a port, not readline, the function that reads a line from a
5820 terminal, providing full editing capabilities.)
5821
5822 ** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
5823
5824 This module provides some simple argument parsing. It exports one
5825 function:
5826
5827 Function: getopt-gnu-style ARG-LS
5828 Parse a list of program arguments into an alist of option
5829 descriptions.
5830
5831 Each item in the list of program arguments is examined to see if
5832 it meets the syntax of a GNU long-named option. An argument like
5833 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
5834 returned alist, where MUMBLE is a keyword object with the same
5835 name as the argument. An argument like `--MUMBLE=FROB' produces
5836 an element of the form (MUMBLE . FROB), where FROB is a string.
5837
5838 As a special case, the returned alist also contains a pair whose
5839 car is the symbol `rest'. The cdr of this pair is a list
5840 containing all the items in the argument list that are not options
5841 of the form mentioned above.
5842
5843 The argument `--' is treated specially: all items in the argument
5844 list appearing after such an argument are not examined, and are
5845 returned in the special `rest' list.
5846
5847 This function does not parse normal single-character switches.
5848 You will need to parse them out of the `rest' list yourself.
5849
5850 ** The read syntax for byte vectors and short vectors has changed.
5851
5852 Instead of #bytes(...), write #y(...).
5853
5854 Instead of #short(...), write #h(...).
5855
5856 This may seem nutty, but, like the other uniform vectors, byte vectors
5857 and short vectors want to have the same print and read syntax (and,
5858 more basic, want to have read syntax!). Changing the read syntax to
5859 use multiple characters after the hash sign breaks with the
5860 conventions used in R5RS and the conventions used for the other
5861 uniform vectors. It also introduces complexity in the current reader,
5862 both on the C and Scheme levels. (The Right solution is probably to
5863 change the syntax and prototypes for uniform vectors entirely.)
5864
5865
5866 ** The new module (ice-9 session) provides useful interactive functions.
5867
5868 *** New procedure: (apropos REGEXP OPTION ...)
5869
5870 Display a list of top-level variables whose names match REGEXP, and
5871 the modules they are imported from. Each OPTION should be one of the
5872 following symbols:
5873
5874 value --- Show the value of each matching variable.
5875 shadow --- Show bindings shadowed by subsequently imported modules.
5876 full --- Same as both `shadow' and `value'.
5877
5878 For example:
5879
5880 guile> (apropos "trace" 'full)
5881 debug: trace #<procedure trace args>
5882 debug: untrace #<procedure untrace args>
5883 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
5884 the-scm-module: before-backtrace-hook ()
5885 the-scm-module: backtrace #<primitive-procedure backtrace>
5886 the-scm-module: after-backtrace-hook ()
5887 the-scm-module: has-shown-backtrace-hint? #f
5888 guile>
5889
5890 ** There are new functions and syntax for working with macros.
5891
5892 Guile implements macros as a special object type. Any variable whose
5893 top-level binding is a macro object acts as a macro. The macro object
5894 specifies how the expression should be transformed before evaluation.
5895
5896 *** Macro objects now print in a reasonable way, resembling procedures.
5897
5898 *** New function: (macro? OBJ)
5899 True iff OBJ is a macro object.
5900
5901 *** New function: (primitive-macro? OBJ)
5902 Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
5903 macro transformers, implemented in eval.c rather than Scheme code.
5904
5905 Why do we have this function?
5906 - For symmetry with procedure? and primitive-procedure?,
5907 - to allow custom print procedures to tell whether a macro is
5908 primitive, and display it differently, and
5909 - to allow compilers and user-written evaluators to distinguish
5910 builtin special forms from user-defined ones, which could be
5911 compiled.
5912
5913 *** New function: (macro-type OBJ)
5914 Return a value indicating what kind of macro OBJ is. Possible return
5915 values are:
5916
5917 The symbol `syntax' --- a macro created by procedure->syntax.
5918 The symbol `macro' --- a macro created by procedure->macro.
5919 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
5920 The boolean #f --- if OBJ is not a macro object.
5921
5922 *** New function: (macro-name MACRO)
5923 Return the name of the macro object MACRO's procedure, as returned by
5924 procedure-name.
5925
5926 *** New function: (macro-transformer MACRO)
5927 Return the transformer procedure for MACRO.
5928
5929 *** New syntax: (use-syntax MODULE ... TRANSFORMER)
5930
5931 Specify a new macro expander to use in the current module. Each
5932 MODULE is a module name, with the same meaning as in the `use-modules'
5933 form; each named module's exported bindings are added to the current
5934 top-level environment. TRANSFORMER is an expression evaluated in the
5935 resulting environment which must yield a procedure to use as the
5936 module's eval transformer: every expression evaluated in this module
5937 is passed to this function, and the result passed to the Guile
5938 interpreter.
5939
5940 *** macro-eval! is removed. Use local-eval instead.
5941
5942 ** Some magic has been added to the printer to better handle user
5943 written printing routines (like record printers, closure printers).
5944
5945 The problem is that these user written routines must have access to
5946 the current `print-state' to be able to handle fancy things like
5947 detection of circular references. These print-states have to be
5948 passed to the builtin printing routines (display, write, etc) to
5949 properly continue the print chain.
5950
5951 We didn't want to change all existing print code so that it
5952 explicitly passes thru a print state in addition to a port. Instead,
5953 we extented the possible values that the builtin printing routines
5954 accept as a `port'. In addition to a normal port, they now also take
5955 a pair of a normal port and a print-state. Printing will go to the
5956 port and the print-state will be used to control the detection of
5957 circular references, etc. If the builtin function does not care for a
5958 print-state, it is simply ignored.
5959
5960 User written callbacks are now called with such a pair as their
5961 `port', but because every function now accepts this pair as a PORT
5962 argument, you don't have to worry about that. In fact, it is probably
5963 safest to not check for these pairs.
5964
5965 However, it is sometimes necessary to continue a print chain on a
5966 different port, for example to get a intermediate string
5967 representation of the printed value, mangle that string somehow, and
5968 then to finally print the mangled string. Use the new function
5969
5970 inherit-print-state OLD-PORT NEW-PORT
5971
5972 for this. It constructs a new `port' that prints to NEW-PORT but
5973 inherits the print-state of OLD-PORT.
5974
5975 ** struct-vtable-offset renamed to vtable-offset-user
5976
5977 ** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
5978
5979 ** There is now a third optional argument to make-vtable-vtable
5980 (and fourth to make-struct) when constructing new types (vtables).
5981 This argument initializes field vtable-index-printer of the vtable.
5982
5983 ** The detection of circular references has been extended to structs.
5984 That is, a structure that -- in the process of being printed -- prints
5985 itself does not lead to infinite recursion.
5986
5987 ** There is now some basic support for fluids. Please read
5988 "libguile/fluid.h" to find out more. It is accessible from Scheme with
5989 the following functions and macros:
5990
5991 Function: make-fluid
5992
5993 Create a new fluid object. Fluids are not special variables or
5994 some other extension to the semantics of Scheme, but rather
5995 ordinary Scheme objects. You can store them into variables (that
5996 are still lexically scoped, of course) or into any other place you
5997 like. Every fluid has a initial value of `#f'.
5998
5999 Function: fluid? OBJ
6000
6001 Test whether OBJ is a fluid.
6002
6003 Function: fluid-ref FLUID
6004 Function: fluid-set! FLUID VAL
6005
6006 Access/modify the fluid FLUID. Modifications are only visible
6007 within the current dynamic root (that includes threads).
6008
6009 Function: with-fluids* FLUIDS VALUES THUNK
6010
6011 FLUIDS is a list of fluids and VALUES a corresponding list of
6012 values for these fluids. Before THUNK gets called the values are
6013 installed in the fluids and the old values of the fluids are
6014 saved in the VALUES list. When the flow of control leaves THUNK
6015 or reenters it, the values get swapped again. You might think of
6016 this as a `safe-fluid-excursion'. Note that the VALUES list is
6017 modified by `with-fluids*'.
6018
6019 Macro: with-fluids ((FLUID VALUE) ...) FORM ...
6020
6021 The same as `with-fluids*' but with a different syntax. It looks
6022 just like `let', but both FLUID and VALUE are evaluated. Remember,
6023 fluids are not special variables but ordinary objects. FLUID
6024 should evaluate to a fluid.
6025
6026 ** Changes to system call interfaces:
6027
6028 *** close-port, close-input-port and close-output-port now return a
6029 boolean instead of an `unspecified' object. #t means that the port
6030 was successfully closed, while #f means it was already closed. It is
6031 also now possible for these procedures to raise an exception if an
6032 error occurs (some errors from write can be delayed until close.)
6033
6034 *** the first argument to chmod, fcntl, ftell and fseek can now be a
6035 file descriptor.
6036
6037 *** the third argument to fcntl is now optional.
6038
6039 *** the first argument to chown can now be a file descriptor or a port.
6040
6041 *** the argument to stat can now be a port.
6042
6043 *** The following new procedures have been added (most use scsh
6044 interfaces):
6045
6046 *** procedure: close PORT/FD
6047 Similar to close-port (*note close-port: Closing Ports.), but also
6048 works on file descriptors. A side effect of closing a file
6049 descriptor is that any ports using that file descriptor are moved
6050 to a different file descriptor and have their revealed counts set
6051 to zero.
6052
6053 *** procedure: port->fdes PORT
6054 Returns the integer file descriptor underlying PORT. As a side
6055 effect the revealed count of PORT is incremented.
6056
6057 *** procedure: fdes->ports FDES
6058 Returns a list of existing ports which have FDES as an underlying
6059 file descriptor, without changing their revealed counts.
6060
6061 *** procedure: fdes->inport FDES
6062 Returns an existing input port which has FDES as its underlying
6063 file descriptor, if one exists, and increments its revealed count.
6064 Otherwise, returns a new input port with a revealed count of 1.
6065
6066 *** procedure: fdes->outport FDES
6067 Returns an existing output port which has FDES as its underlying
6068 file descriptor, if one exists, and increments its revealed count.
6069 Otherwise, returns a new output port with a revealed count of 1.
6070
6071 The next group of procedures perform a `dup2' system call, if NEWFD
6072 (an integer) is supplied, otherwise a `dup'. The file descriptor to be
6073 duplicated can be supplied as an integer or contained in a port. The
6074 type of value returned varies depending on which procedure is used.
6075
6076 All procedures also have the side effect when performing `dup2' that
6077 any ports using NEWFD are moved to a different file descriptor and have
6078 their revealed counts set to zero.
6079
6080 *** procedure: dup->fdes PORT/FD [NEWFD]
6081 Returns an integer file descriptor.
6082
6083 *** procedure: dup->inport PORT/FD [NEWFD]
6084 Returns a new input port using the new file descriptor.
6085
6086 *** procedure: dup->outport PORT/FD [NEWFD]
6087 Returns a new output port using the new file descriptor.
6088
6089 *** procedure: dup PORT/FD [NEWFD]
6090 Returns a new port if PORT/FD is a port, with the same mode as the
6091 supplied port, otherwise returns an integer file descriptor.
6092
6093 *** procedure: dup->port PORT/FD MODE [NEWFD]
6094 Returns a new port using the new file descriptor. MODE supplies a
6095 mode string for the port (*note open-file: File Ports.).
6096
6097 *** procedure: setenv NAME VALUE
6098 Modifies the environment of the current process, which is also the
6099 default environment inherited by child processes.
6100
6101 If VALUE is `#f', then NAME is removed from the environment.
6102 Otherwise, the string NAME=VALUE is added to the environment,
6103 replacing any existing string with name matching NAME.
6104
6105 The return value is unspecified.
6106
6107 *** procedure: truncate-file OBJ SIZE
6108 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
6109 can be a string containing a file name or an integer file
6110 descriptor or port open for output on the file. The underlying
6111 system calls are `truncate' and `ftruncate'.
6112
6113 The return value is unspecified.
6114
6115 *** procedure: setvbuf PORT MODE [SIZE]
6116 Set the buffering mode for PORT. MODE can be:
6117 `_IONBF'
6118 non-buffered
6119
6120 `_IOLBF'
6121 line buffered
6122
6123 `_IOFBF'
6124 block buffered, using a newly allocated buffer of SIZE bytes.
6125 However if SIZE is zero or unspecified, the port will be made
6126 non-buffered.
6127
6128 This procedure should not be used after I/O has been performed with
6129 the port.
6130
6131 Ports are usually block buffered by default, with a default buffer
6132 size. Procedures e.g., *Note open-file: File Ports, which accept a
6133 mode string allow `0' to be added to request an unbuffered port.
6134
6135 *** procedure: fsync PORT/FD
6136 Copies any unwritten data for the specified output file descriptor
6137 to disk. If PORT/FD is a port, its buffer is flushed before the
6138 underlying file descriptor is fsync'd. The return value is
6139 unspecified.
6140
6141 *** procedure: open-fdes PATH FLAGS [MODES]
6142 Similar to `open' but returns a file descriptor instead of a port.
6143
6144 *** procedure: execle PATH ENV [ARG] ...
6145 Similar to `execl', but the environment of the new process is
6146 specified by ENV, which must be a list of strings as returned by
6147 the `environ' procedure.
6148
6149 This procedure is currently implemented using the `execve' system
6150 call, but we call it `execle' because of its Scheme calling
6151 interface.
6152
6153 *** procedure: strerror ERRNO
6154 Returns the Unix error message corresponding to ERRNO, an integer.
6155
6156 *** procedure: primitive-exit [STATUS]
6157 Terminate the current process without unwinding the Scheme stack.
6158 This is would typically be useful after a fork. The exit status
6159 is STATUS if supplied, otherwise zero.
6160
6161 *** procedure: times
6162 Returns an object with information about real and processor time.
6163 The following procedures accept such an object as an argument and
6164 return a selected component:
6165
6166 `tms:clock'
6167 The current real time, expressed as time units relative to an
6168 arbitrary base.
6169
6170 `tms:utime'
6171 The CPU time units used by the calling process.
6172
6173 `tms:stime'
6174 The CPU time units used by the system on behalf of the
6175 calling process.
6176
6177 `tms:cutime'
6178 The CPU time units used by terminated child processes of the
6179 calling process, whose status has been collected (e.g., using
6180 `waitpid').
6181
6182 `tms:cstime'
6183 Similarly, the CPU times units used by the system on behalf of
6184 terminated child processes.
6185
6186 ** Removed: list-length
6187 ** Removed: list-append, list-append!
6188 ** Removed: list-reverse, list-reverse!
6189
6190 ** array-map renamed to array-map!
6191
6192 ** serial-array-map renamed to serial-array-map!
6193
6194 ** catch doesn't take #f as first argument any longer
6195
6196 Previously, it was possible to pass #f instead of a key to `catch'.
6197 That would cause `catch' to pass a jump buffer object to the procedure
6198 passed as second argument. The procedure could then use this jump
6199 buffer objekt as an argument to throw.
6200
6201 This mechanism has been removed since its utility doesn't motivate the
6202 extra complexity it introduces.
6203
6204 ** The `#/' notation for lists now provokes a warning message from Guile.
6205 This syntax will be removed from Guile in the near future.
6206
6207 To disable the warning message, set the GUILE_HUSH environment
6208 variable to any non-empty value.
6209
6210 ** The newline character now prints as `#\newline', following the
6211 normal Scheme notation, not `#\nl'.
6212
6213 * Changes to the gh_ interface
6214
6215 ** The gh_enter function now takes care of loading the Guile startup files.
6216 gh_enter works by calling scm_boot_guile; see the remarks below.
6217
6218 ** Function: void gh_write (SCM x)
6219
6220 Write the printed representation of the scheme object x to the current
6221 output port. Corresponds to the scheme level `write'.
6222
6223 ** gh_list_length renamed to gh_length.
6224
6225 ** vector handling routines
6226
6227 Several major changes. In particular, gh_vector() now resembles
6228 (vector ...) (with a caveat -- see manual), and gh_make_vector() now
6229 exists and behaves like (make-vector ...). gh_vset() and gh_vref()
6230 have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
6231 vector-related gh_ functions have been implemented.
6232
6233 ** pair and list routines
6234
6235 Implemented several of the R4RS pair and list functions that were
6236 missing.
6237
6238 ** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
6239
6240 New function. Converts double arrays back and forth between Scheme
6241 and C.
6242
6243 * Changes to the scm_ interface
6244
6245 ** The function scm_boot_guile now takes care of loading the startup files.
6246
6247 Guile's primary initialization function, scm_boot_guile, now takes
6248 care of loading `boot-9.scm', in the `ice-9' module, to initialize
6249 Guile, define the module system, and put together some standard
6250 bindings. It also loads `init.scm', which is intended to hold
6251 site-specific initialization code.
6252
6253 Since Guile cannot operate properly until boot-9.scm is loaded, there
6254 is no reason to separate loading boot-9.scm from Guile's other
6255 initialization processes.
6256
6257 This job used to be done by scm_compile_shell_switches, which didn't
6258 make much sense; in particular, it meant that people using Guile for
6259 non-shell-like applications had to jump through hoops to get Guile
6260 initialized properly.
6261
6262 ** The function scm_compile_shell_switches no longer loads the startup files.
6263 Now, Guile always loads the startup files, whenever it is initialized;
6264 see the notes above for scm_boot_guile and scm_load_startup_files.
6265
6266 ** Function: scm_load_startup_files
6267 This new function takes care of loading Guile's initialization file
6268 (`boot-9.scm'), and the site initialization file, `init.scm'. Since
6269 this is always called by the Guile initialization process, it's
6270 probably not too useful to call this yourself, but it's there anyway.
6271
6272 ** The semantics of smob marking have changed slightly.
6273
6274 The smob marking function (the `mark' member of the scm_smobfuns
6275 structure) is no longer responsible for setting the mark bit on the
6276 smob. The generic smob handling code in the garbage collector will
6277 set this bit. The mark function need only ensure that any other
6278 objects the smob refers to get marked.
6279
6280 Note that this change means that the smob's GC8MARK bit is typically
6281 already set upon entry to the mark function. Thus, marking functions
6282 which look like this:
6283
6284 {
6285 if (SCM_GC8MARKP (ptr))
6286 return SCM_BOOL_F;
6287 SCM_SETGC8MARK (ptr);
6288 ... mark objects to which the smob refers ...
6289 }
6290
6291 are now incorrect, since they will return early, and fail to mark any
6292 other objects the smob refers to. Some code in the Guile library used
6293 to work this way.
6294
6295 ** The semantics of the I/O port functions in scm_ptobfuns have changed.
6296
6297 If you have implemented your own I/O port type, by writing the
6298 functions required by the scm_ptobfuns and then calling scm_newptob,
6299 you will need to change your functions slightly.
6300
6301 The functions in a scm_ptobfuns structure now expect the port itself
6302 as their argument; they used to expect the `stream' member of the
6303 port's scm_port_table structure. This allows functions in an
6304 scm_ptobfuns structure to easily access the port's cell (and any flags
6305 it its CAR), and the port's scm_port_table structure.
6306
6307 Guile now passes the I/O port itself as the `port' argument in the
6308 following scm_ptobfuns functions:
6309
6310 int (*free) (SCM port);
6311 int (*fputc) (int, SCM port);
6312 int (*fputs) (char *, SCM port);
6313 scm_sizet (*fwrite) SCM_P ((char *ptr,
6314 scm_sizet size,
6315 scm_sizet nitems,
6316 SCM port));
6317 int (*fflush) (SCM port);
6318 int (*fgetc) (SCM port);
6319 int (*fclose) (SCM port);
6320
6321 The interfaces to the `mark', `print', `equalp', and `fgets' methods
6322 are unchanged.
6323
6324 If you have existing code which defines its own port types, it is easy
6325 to convert your code to the new interface; simply apply SCM_STREAM to
6326 the port argument to yield the value you code used to expect.
6327
6328 Note that since both the port and the stream have the same type in the
6329 C code --- they are both SCM values --- the C compiler will not remind
6330 you if you forget to update your scm_ptobfuns functions.
6331
6332
6333 ** Function: int scm_internal_select (int fds,
6334 SELECT_TYPE *rfds,
6335 SELECT_TYPE *wfds,
6336 SELECT_TYPE *efds,
6337 struct timeval *timeout);
6338
6339 This is a replacement for the `select' function provided by the OS.
6340 It enables I/O blocking and sleeping to happen for one cooperative
6341 thread without blocking other threads. It also avoids busy-loops in
6342 these situations. It is intended that all I/O blocking and sleeping
6343 will finally go through this function. Currently, this function is
6344 only available on systems providing `gettimeofday' and `select'.
6345
6346 ** Function: SCM scm_internal_stack_catch (SCM tag,
6347 scm_catch_body_t body,
6348 void *body_data,
6349 scm_catch_handler_t handler,
6350 void *handler_data)
6351
6352 A new sibling to the other two C level `catch' functions
6353 scm_internal_catch and scm_internal_lazy_catch. Use it if you want
6354 the stack to be saved automatically into the variable `the-last-stack'
6355 (scm_the_last_stack_var) on error. This is necessary if you want to
6356 use advanced error reporting, such as calling scm_display_error and
6357 scm_display_backtrace. (They both take a stack object as argument.)
6358
6359 ** Function: SCM scm_spawn_thread (scm_catch_body_t body,
6360 void *body_data,
6361 scm_catch_handler_t handler,
6362 void *handler_data)
6363
6364 Spawns a new thread. It does a job similar to
6365 scm_call_with_new_thread but takes arguments more suitable when
6366 spawning threads from application C code.
6367
6368 ** The hook scm_error_callback has been removed. It was originally
6369 intended as a way for the user to install his own error handler. But
6370 that method works badly since it intervenes between throw and catch,
6371 thereby changing the semantics of expressions like (catch #t ...).
6372 The correct way to do it is to use one of the C level catch functions
6373 in throw.c: scm_internal_catch/lazy_catch/stack_catch.
6374
6375 ** Removed functions:
6376
6377 scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
6378 scm_list_reverse, scm_list_reverse_x
6379
6380 ** New macros: SCM_LISTn where n is one of the integers 0-9.
6381
6382 These can be used for pretty list creation from C. The idea is taken
6383 from Erick Gallesio's STk.
6384
6385 ** scm_array_map renamed to scm_array_map_x
6386
6387 ** mbstrings are now removed
6388
6389 This means that the type codes scm_tc7_mb_string and
6390 scm_tc7_mb_substring has been removed.
6391
6392 ** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
6393
6394 Since we no longer support multi-byte strings, these I/O functions
6395 have been simplified, and renamed. Here are their old names, and
6396 their new names and arguments:
6397
6398 scm_gen_putc -> void scm_putc (int c, SCM port);
6399 scm_gen_puts -> void scm_puts (char *s, SCM port);
6400 scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
6401 scm_gen_getc -> void scm_getc (SCM port);
6402
6403
6404 ** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
6405
6406 ** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
6407
6408 SCM_TYP7S now masks away the bit which distinguishes substrings from
6409 strings.
6410
6411 ** scm_catch_body_t: Backward incompatible change!
6412
6413 Body functions to scm_internal_catch and friends do not any longer
6414 take a second argument. This is because it is no longer possible to
6415 pass a #f arg to catch.
6416
6417 ** Calls to scm_protect_object and scm_unprotect now nest properly.
6418
6419 The function scm_protect_object protects its argument from being freed
6420 by the garbage collector. scm_unprotect_object removes that
6421 protection.
6422
6423 These functions now nest properly. That is, for every object O, there
6424 is a counter which scm_protect_object(O) increments and
6425 scm_unprotect_object(O) decrements, if the counter is greater than
6426 zero. Every object's counter is zero when it is first created. If an
6427 object's counter is greater than zero, the garbage collector will not
6428 reclaim its storage.
6429
6430 This allows you to use scm_protect_object in your code without
6431 worrying that some other function you call will call
6432 scm_unprotect_object, and allow it to be freed. Assuming that the
6433 functions you call are well-behaved, and unprotect only those objects
6434 they protect, you can follow the same rule and have confidence that
6435 objects will be freed only at appropriate times.
6436
6437 \f
6438 Changes in Guile 1.2 (released Tuesday, June 24 1997):
6439
6440 * Changes to the distribution
6441
6442 ** Nightly snapshots are now available from ftp.red-bean.com.
6443 The old server, ftp.cyclic.com, has been relinquished to its rightful
6444 owner.
6445
6446 Nightly snapshots of the Guile development sources are now available via
6447 anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
6448
6449 Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
6450 For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
6451
6452 ** To run Guile without installing it, the procedure has changed a bit.
6453
6454 If you used a separate build directory to compile Guile, you'll need
6455 to include the build directory in SCHEME_LOAD_PATH, as well as the
6456 source directory. See the `INSTALL' file for examples.
6457
6458 * Changes to the procedure for linking libguile with your programs
6459
6460 ** The standard Guile load path for Scheme code now includes
6461 $(datadir)/guile (usually /usr/local/share/guile). This means that
6462 you can install your own Scheme files there, and Guile will find them.
6463 (Previous versions of Guile only checked a directory whose name
6464 contained the Guile version number, so you had to re-install or move
6465 your Scheme sources each time you installed a fresh version of Guile.)
6466
6467 The load path also includes $(datadir)/guile/site; we recommend
6468 putting individual Scheme files there. If you want to install a
6469 package with multiple source files, create a directory for them under
6470 $(datadir)/guile.
6471
6472 ** Guile 1.2 will now use the Rx regular expression library, if it is
6473 installed on your system. When you are linking libguile into your own
6474 programs, this means you will have to link against -lguile, -lqt (if
6475 you configured Guile with thread support), and -lrx.
6476
6477 If you are using autoconf to generate configuration scripts for your
6478 application, the following lines should suffice to add the appropriate
6479 libraries to your link command:
6480
6481 ### Find Rx, quickthreads and libguile.
6482 AC_CHECK_LIB(rx, main)
6483 AC_CHECK_LIB(qt, main)
6484 AC_CHECK_LIB(guile, scm_shell)
6485
6486 The Guile 1.2 distribution does not contain sources for the Rx
6487 library, as Guile 1.0 did. If you want to use Rx, you'll need to
6488 retrieve it from a GNU FTP site and install it separately.
6489
6490 * Changes to Scheme functions and syntax
6491
6492 ** The dynamic linking features of Guile are now enabled by default.
6493 You can disable them by giving the `--disable-dynamic-linking' option
6494 to configure.
6495
6496 (dynamic-link FILENAME)
6497
6498 Find the object file denoted by FILENAME (a string) and link it
6499 into the running Guile application. When everything works out,
6500 return a Scheme object suitable for representing the linked object
6501 file. Otherwise an error is thrown. How object files are
6502 searched is system dependent.
6503
6504 (dynamic-object? VAL)
6505
6506 Determine whether VAL represents a dynamically linked object file.
6507
6508 (dynamic-unlink DYNOBJ)
6509
6510 Unlink the indicated object file from the application. DYNOBJ
6511 should be one of the values returned by `dynamic-link'.
6512
6513 (dynamic-func FUNCTION DYNOBJ)
6514
6515 Search the C function indicated by FUNCTION (a string or symbol)
6516 in DYNOBJ and return some Scheme object that can later be used
6517 with `dynamic-call' to actually call this function. Right now,
6518 these Scheme objects are formed by casting the address of the
6519 function to `long' and converting this number to its Scheme
6520 representation.
6521
6522 (dynamic-call FUNCTION DYNOBJ)
6523
6524 Call the C function indicated by FUNCTION and DYNOBJ. The
6525 function is passed no arguments and its return value is ignored.
6526 When FUNCTION is something returned by `dynamic-func', call that
6527 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
6528 etc.), look it up in DYNOBJ; this is equivalent to
6529
6530 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
6531
6532 Interrupts are deferred while the C function is executing (with
6533 SCM_DEFER_INTS/SCM_ALLOW_INTS).
6534
6535 (dynamic-args-call FUNCTION DYNOBJ ARGS)
6536
6537 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
6538 some arguments and return its return value. The C function is
6539 expected to take two arguments and return an `int', just like
6540 `main':
6541
6542 int c_func (int argc, char **argv);
6543
6544 ARGS must be a list of strings and is converted into an array of
6545 `char *'. The array is passed in ARGV and its size in ARGC. The
6546 return value is converted to a Scheme number and returned from the
6547 call to `dynamic-args-call'.
6548
6549 When dynamic linking is disabled or not supported on your system,
6550 the above functions throw errors, but they are still available.
6551
6552 Here is a small example that works on GNU/Linux:
6553
6554 (define libc-obj (dynamic-link "libc.so"))
6555 (dynamic-args-call 'rand libc-obj '())
6556
6557 See the file `libguile/DYNAMIC-LINKING' for additional comments.
6558
6559 ** The #/ syntax for module names is depreciated, and will be removed
6560 in a future version of Guile. Instead of
6561
6562 #/foo/bar/baz
6563
6564 instead write
6565
6566 (foo bar baz)
6567
6568 The latter syntax is more consistent with existing Lisp practice.
6569
6570 ** Guile now does fancier printing of structures. Structures are the
6571 underlying implementation for records, which in turn are used to
6572 implement modules, so all of these object now print differently and in
6573 a more informative way.
6574
6575 The Scheme printer will examine the builtin variable *struct-printer*
6576 whenever it needs to print a structure object. When this variable is
6577 not `#f' it is deemed to be a procedure and will be applied to the
6578 structure object and the output port. When *struct-printer* is `#f'
6579 or the procedure return `#f' the structure object will be printed in
6580 the boring #<struct 80458270> form.
6581
6582 This hook is used by some routines in ice-9/boot-9.scm to implement
6583 type specific printing routines. Please read the comments there about
6584 "printing structs".
6585
6586 One of the more specific uses of structs are records. The printing
6587 procedure that could be passed to MAKE-RECORD-TYPE is now actually
6588 called. It should behave like a *struct-printer* procedure (described
6589 above).
6590
6591 ** Guile now supports a new R4RS-compliant syntax for keywords. A
6592 token of the form #:NAME, where NAME has the same syntax as a Scheme
6593 symbol, is the external representation of the keyword named NAME.
6594 Keyword objects print using this syntax as well, so values containing
6595 keyword objects can be read back into Guile. When used in an
6596 expression, keywords are self-quoting objects.
6597
6598 Guile suports this read syntax, and uses this print syntax, regardless
6599 of the current setting of the `keyword' read option. The `keyword'
6600 read option only controls whether Guile recognizes the `:NAME' syntax,
6601 which is incompatible with R4RS. (R4RS says such token represent
6602 symbols.)
6603
6604 ** Guile has regular expression support again. Guile 1.0 included
6605 functions for matching regular expressions, based on the Rx library.
6606 In Guile 1.1, the Guile/Rx interface was removed to simplify the
6607 distribution, and thus Guile had no regular expression support. Guile
6608 1.2 again supports the most commonly used functions, and supports all
6609 of SCSH's regular expression functions.
6610
6611 If your system does not include a POSIX regular expression library,
6612 and you have not linked Guile with a third-party regexp library such as
6613 Rx, these functions will not be available. You can tell whether your
6614 Guile installation includes regular expression support by checking
6615 whether the `*features*' list includes the `regex' symbol.
6616
6617 *** regexp functions
6618
6619 By default, Guile supports POSIX extended regular expressions. That
6620 means that the characters `(', `)', `+' and `?' are special, and must
6621 be escaped if you wish to match the literal characters.
6622
6623 This regular expression interface was modeled after that implemented
6624 by SCSH, the Scheme Shell. It is intended to be upwardly compatible
6625 with SCSH regular expressions.
6626
6627 **** Function: string-match PATTERN STR [START]
6628 Compile the string PATTERN into a regular expression and compare
6629 it with STR. The optional numeric argument START specifies the
6630 position of STR at which to begin matching.
6631
6632 `string-match' returns a "match structure" which describes what,
6633 if anything, was matched by the regular expression. *Note Match
6634 Structures::. If STR does not match PATTERN at all,
6635 `string-match' returns `#f'.
6636
6637 Each time `string-match' is called, it must compile its PATTERN
6638 argument into a regular expression structure. This operation is
6639 expensive, which makes `string-match' inefficient if the same regular
6640 expression is used several times (for example, in a loop). For better
6641 performance, you can compile a regular expression in advance and then
6642 match strings against the compiled regexp.
6643
6644 **** Function: make-regexp STR [FLAGS]
6645 Compile the regular expression described by STR, and return the
6646 compiled regexp structure. If STR does not describe a legal
6647 regular expression, `make-regexp' throws a
6648 `regular-expression-syntax' error.
6649
6650 FLAGS may be the bitwise-or of one or more of the following:
6651
6652 **** Constant: regexp/extended
6653 Use POSIX Extended Regular Expression syntax when interpreting
6654 STR. If not set, POSIX Basic Regular Expression syntax is used.
6655 If the FLAGS argument is omitted, we assume regexp/extended.
6656
6657 **** Constant: regexp/icase
6658 Do not differentiate case. Subsequent searches using the
6659 returned regular expression will be case insensitive.
6660
6661 **** Constant: regexp/newline
6662 Match-any-character operators don't match a newline.
6663
6664 A non-matching list ([^...]) not containing a newline matches a
6665 newline.
6666
6667 Match-beginning-of-line operator (^) matches the empty string
6668 immediately after a newline, regardless of whether the FLAGS
6669 passed to regexp-exec contain regexp/notbol.
6670
6671 Match-end-of-line operator ($) matches the empty string
6672 immediately before a newline, regardless of whether the FLAGS
6673 passed to regexp-exec contain regexp/noteol.
6674
6675 **** Function: regexp-exec REGEXP STR [START [FLAGS]]
6676 Match the compiled regular expression REGEXP against `str'. If
6677 the optional integer START argument is provided, begin matching
6678 from that position in the string. Return a match structure
6679 describing the results of the match, or `#f' if no match could be
6680 found.
6681
6682 FLAGS may be the bitwise-or of one or more of the following:
6683
6684 **** Constant: regexp/notbol
6685 The match-beginning-of-line operator always fails to match (but
6686 see the compilation flag regexp/newline above) This flag may be
6687 used when different portions of a string are passed to
6688 regexp-exec and the beginning of the string should not be
6689 interpreted as the beginning of the line.
6690
6691 **** Constant: regexp/noteol
6692 The match-end-of-line operator always fails to match (but see the
6693 compilation flag regexp/newline above)
6694
6695 **** Function: regexp? OBJ
6696 Return `#t' if OBJ is a compiled regular expression, or `#f'
6697 otherwise.
6698
6699 Regular expressions are commonly used to find patterns in one string
6700 and replace them with the contents of another string.
6701
6702 **** Function: regexp-substitute PORT MATCH [ITEM...]
6703 Write to the output port PORT selected contents of the match
6704 structure MATCH. Each ITEM specifies what should be written, and
6705 may be one of the following arguments:
6706
6707 * A string. String arguments are written out verbatim.
6708
6709 * An integer. The submatch with that number is written.
6710
6711 * The symbol `pre'. The portion of the matched string preceding
6712 the regexp match is written.
6713
6714 * The symbol `post'. The portion of the matched string
6715 following the regexp match is written.
6716
6717 PORT may be `#f', in which case nothing is written; instead,
6718 `regexp-substitute' constructs a string from the specified ITEMs
6719 and returns that.
6720
6721 **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
6722 Similar to `regexp-substitute', but can be used to perform global
6723 substitutions on STR. Instead of taking a match structure as an
6724 argument, `regexp-substitute/global' takes two string arguments: a
6725 REGEXP string describing a regular expression, and a TARGET string
6726 which should be matched against this regular expression.
6727
6728 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
6729 exceptions:
6730
6731 * A function may be supplied. When this function is called, it
6732 will be passed one argument: a match structure for a given
6733 regular expression match. It should return a string to be
6734 written out to PORT.
6735
6736 * The `post' symbol causes `regexp-substitute/global' to recurse
6737 on the unmatched portion of STR. This *must* be supplied in
6738 order to perform global search-and-replace on STR; if it is
6739 not present among the ITEMs, then `regexp-substitute/global'
6740 will return after processing a single match.
6741
6742 *** Match Structures
6743
6744 A "match structure" is the object returned by `string-match' and
6745 `regexp-exec'. It describes which portion of a string, if any, matched
6746 the given regular expression. Match structures include: a reference to
6747 the string that was checked for matches; the starting and ending
6748 positions of the regexp match; and, if the regexp included any
6749 parenthesized subexpressions, the starting and ending positions of each
6750 submatch.
6751
6752 In each of the regexp match functions described below, the `match'
6753 argument must be a match structure returned by a previous call to
6754 `string-match' or `regexp-exec'. Most of these functions return some
6755 information about the original target string that was matched against a
6756 regular expression; we will call that string TARGET for easy reference.
6757
6758 **** Function: regexp-match? OBJ
6759 Return `#t' if OBJ is a match structure returned by a previous
6760 call to `regexp-exec', or `#f' otherwise.
6761
6762 **** Function: match:substring MATCH [N]
6763 Return the portion of TARGET matched by subexpression number N.
6764 Submatch 0 (the default) represents the entire regexp match. If
6765 the regular expression as a whole matched, but the subexpression
6766 number N did not match, return `#f'.
6767
6768 **** Function: match:start MATCH [N]
6769 Return the starting position of submatch number N.
6770
6771 **** Function: match:end MATCH [N]
6772 Return the ending position of submatch number N.
6773
6774 **** Function: match:prefix MATCH
6775 Return the unmatched portion of TARGET preceding the regexp match.
6776
6777 **** Function: match:suffix MATCH
6778 Return the unmatched portion of TARGET following the regexp match.
6779
6780 **** Function: match:count MATCH
6781 Return the number of parenthesized subexpressions from MATCH.
6782 Note that the entire regular expression match itself counts as a
6783 subexpression, and failed submatches are included in the count.
6784
6785 **** Function: match:string MATCH
6786 Return the original TARGET string.
6787
6788 *** Backslash Escapes
6789
6790 Sometimes you will want a regexp to match characters like `*' or `$'
6791 exactly. For example, to check whether a particular string represents
6792 a menu entry from an Info node, it would be useful to match it against
6793 a regexp like `^* [^:]*::'. However, this won't work; because the
6794 asterisk is a metacharacter, it won't match the `*' at the beginning of
6795 the string. In this case, we want to make the first asterisk un-magic.
6796
6797 You can do this by preceding the metacharacter with a backslash
6798 character `\'. (This is also called "quoting" the metacharacter, and
6799 is known as a "backslash escape".) When Guile sees a backslash in a
6800 regular expression, it considers the following glyph to be an ordinary
6801 character, no matter what special meaning it would ordinarily have.
6802 Therefore, we can make the above example work by changing the regexp to
6803 `^\* [^:]*::'. The `\*' sequence tells the regular expression engine
6804 to match only a single asterisk in the target string.
6805
6806 Since the backslash is itself a metacharacter, you may force a
6807 regexp to match a backslash in the target string by preceding the
6808 backslash with itself. For example, to find variable references in a
6809 TeX program, you might want to find occurrences of the string `\let\'
6810 followed by any number of alphabetic characters. The regular expression
6811 `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
6812 each match a single backslash in the target string.
6813
6814 **** Function: regexp-quote STR
6815 Quote each special character found in STR with a backslash, and
6816 return the resulting string.
6817
6818 *Very important:* Using backslash escapes in Guile source code (as
6819 in Emacs Lisp or C) can be tricky, because the backslash character has
6820 special meaning for the Guile reader. For example, if Guile encounters
6821 the character sequence `\n' in the middle of a string while processing
6822 Scheme code, it replaces those characters with a newline character.
6823 Similarly, the character sequence `\t' is replaced by a horizontal tab.
6824 Several of these "escape sequences" are processed by the Guile reader
6825 before your code is executed. Unrecognized escape sequences are
6826 ignored: if the characters `\*' appear in a string, they will be
6827 translated to the single character `*'.
6828
6829 This translation is obviously undesirable for regular expressions,
6830 since we want to be able to include backslashes in a string in order to
6831 escape regexp metacharacters. Therefore, to make sure that a backslash
6832 is preserved in a string in your Guile program, you must use *two*
6833 consecutive backslashes:
6834
6835 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
6836
6837 The string in this example is preprocessed by the Guile reader before
6838 any code is executed. The resulting argument to `make-regexp' is the
6839 string `^\* [^:]*', which is what we really want.
6840
6841 This also means that in order to write a regular expression that
6842 matches a single backslash character, the regular expression string in
6843 the source code must include *four* backslashes. Each consecutive pair
6844 of backslashes gets translated by the Guile reader to a single
6845 backslash, and the resulting double-backslash is interpreted by the
6846 regexp engine as matching a single backslash character. Hence:
6847
6848 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
6849
6850 The reason for the unwieldiness of this syntax is historical. Both
6851 regular expression pattern matchers and Unix string processing systems
6852 have traditionally used backslashes with the special meanings described
6853 above. The POSIX regular expression specification and ANSI C standard
6854 both require these semantics. Attempting to abandon either convention
6855 would cause other kinds of compatibility problems, possibly more severe
6856 ones. Therefore, without extending the Scheme reader to support
6857 strings with different quoting conventions (an ungainly and confusing
6858 extension when implemented in other languages), we must adhere to this
6859 cumbersome escape syntax.
6860
6861 * Changes to the gh_ interface
6862
6863 * Changes to the scm_ interface
6864
6865 * Changes to system call interfaces:
6866
6867 ** The value returned by `raise' is now unspecified. It throws an exception
6868 if an error occurs.
6869
6870 *** A new procedure `sigaction' can be used to install signal handlers
6871
6872 (sigaction signum [action] [flags])
6873
6874 signum is the signal number, which can be specified using the value
6875 of SIGINT etc.
6876
6877 If action is omitted, sigaction returns a pair: the CAR is the current
6878 signal hander, which will be either an integer with the value SIG_DFL
6879 (default action) or SIG_IGN (ignore), or the Scheme procedure which
6880 handles the signal, or #f if a non-Scheme procedure handles the
6881 signal. The CDR contains the current sigaction flags for the handler.
6882
6883 If action is provided, it is installed as the new handler for signum.
6884 action can be a Scheme procedure taking one argument, or the value of
6885 SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
6886 whatever signal handler was installed before sigaction was first used.
6887 Flags can optionally be specified for the new handler (SA_RESTART is
6888 always used if the system provides it, so need not be specified.) The
6889 return value is a pair with information about the old handler as
6890 described above.
6891
6892 This interface does not provide access to the "signal blocking"
6893 facility. Maybe this is not needed, since the thread support may
6894 provide solutions to the problem of consistent access to data
6895 structures.
6896
6897 *** A new procedure `flush-all-ports' is equivalent to running
6898 `force-output' on every port open for output.
6899
6900 ** Guile now provides information on how it was built, via the new
6901 global variable, %guile-build-info. This variable records the values
6902 of the standard GNU makefile directory variables as an assocation
6903 list, mapping variable names (symbols) onto directory paths (strings).
6904 For example, to find out where the Guile link libraries were
6905 installed, you can say:
6906
6907 guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
6908
6909
6910 * Changes to the scm_ interface
6911
6912 ** The new function scm_handle_by_message_noexit is just like the
6913 existing scm_handle_by_message function, except that it doesn't call
6914 exit to terminate the process. Instead, it prints a message and just
6915 returns #f. This might be a more appropriate catch-all handler for
6916 new dynamic roots and threads.
6917
6918 \f
6919 Changes in Guile 1.1 (released Friday, May 16 1997):
6920
6921 * Changes to the distribution.
6922
6923 The Guile 1.0 distribution has been split up into several smaller
6924 pieces:
6925 guile-core --- the Guile interpreter itself.
6926 guile-tcltk --- the interface between the Guile interpreter and
6927 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
6928 is a toolkit for building graphical user interfaces.
6929 guile-rgx-ctax --- the interface between Guile and the Rx regular
6930 expression matcher, and the translator for the Ctax
6931 programming language. These are packaged together because the
6932 Ctax translator uses Rx to parse Ctax source code.
6933
6934 This NEWS file describes the changes made to guile-core since the 1.0
6935 release.
6936
6937 We no longer distribute the documentation, since it was either out of
6938 date, or incomplete. As soon as we have current documentation, we
6939 will distribute it.
6940
6941
6942
6943 * Changes to the stand-alone interpreter
6944
6945 ** guile now accepts command-line arguments compatible with SCSH, Olin
6946 Shivers' Scheme Shell.
6947
6948 In general, arguments are evaluated from left to right, but there are
6949 exceptions. The following switches stop argument processing, and
6950 stash all remaining command-line arguments as the value returned by
6951 the (command-line) function.
6952 -s SCRIPT load Scheme source code from FILE, and exit
6953 -c EXPR evalute Scheme expression EXPR, and exit
6954 -- stop scanning arguments; run interactively
6955
6956 The switches below are processed as they are encountered.
6957 -l FILE load Scheme source code from FILE
6958 -e FUNCTION after reading script, apply FUNCTION to
6959 command line arguments
6960 -ds do -s script at this point
6961 --emacs enable Emacs protocol (experimental)
6962 -h, --help display this help and exit
6963 -v, --version display version information and exit
6964 \ read arguments from following script lines
6965
6966 So, for example, here is a Guile script named `ekko' (thanks, Olin)
6967 which re-implements the traditional "echo" command:
6968
6969 #!/usr/local/bin/guile -s
6970 !#
6971 (define (main args)
6972 (map (lambda (arg) (display arg) (display " "))
6973 (cdr args))
6974 (newline))
6975
6976 (main (command-line))
6977
6978 Suppose we invoke this script as follows:
6979
6980 ekko a speckled gecko
6981
6982 Through the magic of Unix script processing (triggered by the `#!'
6983 token at the top of the file), /usr/local/bin/guile receives the
6984 following list of command-line arguments:
6985
6986 ("-s" "./ekko" "a" "speckled" "gecko")
6987
6988 Unix inserts the name of the script after the argument specified on
6989 the first line of the file (in this case, "-s"), and then follows that
6990 with the arguments given to the script. Guile loads the script, which
6991 defines the `main' function, and then applies it to the list of
6992 remaining command-line arguments, ("a" "speckled" "gecko").
6993
6994 In Unix, the first line of a script file must take the following form:
6995
6996 #!INTERPRETER ARGUMENT
6997
6998 where INTERPRETER is the absolute filename of the interpreter
6999 executable, and ARGUMENT is a single command-line argument to pass to
7000 the interpreter.
7001
7002 You may only pass one argument to the interpreter, and its length is
7003 limited. These restrictions can be annoying to work around, so Guile
7004 provides a general mechanism (borrowed from, and compatible with,
7005 SCSH) for circumventing them.
7006
7007 If the ARGUMENT in a Guile script is a single backslash character,
7008 `\', Guile will open the script file, parse arguments from its second
7009 and subsequent lines, and replace the `\' with them. So, for example,
7010 here is another implementation of the `ekko' script:
7011
7012 #!/usr/local/bin/guile \
7013 -e main -s
7014 !#
7015 (define (main args)
7016 (for-each (lambda (arg) (display arg) (display " "))
7017 (cdr args))
7018 (newline))
7019
7020 If the user invokes this script as follows:
7021
7022 ekko a speckled gecko
7023
7024 Unix expands this into
7025
7026 /usr/local/bin/guile \ ekko a speckled gecko
7027
7028 When Guile sees the `\' argument, it replaces it with the arguments
7029 read from the second line of the script, producing:
7030
7031 /usr/local/bin/guile -e main -s ekko a speckled gecko
7032
7033 This tells Guile to load the `ekko' script, and apply the function
7034 `main' to the argument list ("a" "speckled" "gecko").
7035
7036 Here is how Guile parses the command-line arguments:
7037 - Each space character terminates an argument. This means that two
7038 spaces in a row introduce an empty-string argument.
7039 - The tab character is not permitted (unless you quote it with the
7040 backslash character, as described below), to avoid confusion.
7041 - The newline character terminates the sequence of arguments, and will
7042 also terminate a final non-empty argument. (However, a newline
7043 following a space will not introduce a final empty-string argument;
7044 it only terminates the argument list.)
7045 - The backslash character is the escape character. It escapes
7046 backslash, space, tab, and newline. The ANSI C escape sequences
7047 like \n and \t are also supported. These produce argument
7048 constituents; the two-character combination \n doesn't act like a
7049 terminating newline. The escape sequence \NNN for exactly three
7050 octal digits reads as the character whose ASCII code is NNN. As
7051 above, characters produced this way are argument constituents.
7052 Backslash followed by other characters is not allowed.
7053
7054 * Changes to the procedure for linking libguile with your programs
7055
7056 ** Guile now builds and installs a shared guile library, if your
7057 system support shared libraries. (It still builds a static library on
7058 all systems.) Guile automatically detects whether your system
7059 supports shared libraries. To prevent Guile from buildisg shared
7060 libraries, pass the `--disable-shared' flag to the configure script.
7061
7062 Guile takes longer to compile when it builds shared libraries, because
7063 it must compile every file twice --- once to produce position-
7064 independent object code, and once to produce normal object code.
7065
7066 ** The libthreads library has been merged into libguile.
7067
7068 To link a program against Guile, you now need only link against
7069 -lguile and -lqt; -lthreads is no longer needed. If you are using
7070 autoconf to generate configuration scripts for your application, the
7071 following lines should suffice to add the appropriate libraries to
7072 your link command:
7073
7074 ### Find quickthreads and libguile.
7075 AC_CHECK_LIB(qt, main)
7076 AC_CHECK_LIB(guile, scm_shell)
7077
7078 * Changes to Scheme functions
7079
7080 ** Guile Scheme's special syntax for keyword objects is now optional,
7081 and disabled by default.
7082
7083 The syntax variation from R4RS made it difficult to port some
7084 interesting packages to Guile. The routines which accepted keyword
7085 arguments (mostly in the module system) have been modified to also
7086 accept symbols whose names begin with `:'.
7087
7088 To change the keyword syntax, you must first import the (ice-9 debug)
7089 module:
7090 (use-modules (ice-9 debug))
7091
7092 Then you can enable the keyword syntax as follows:
7093 (read-set! keywords 'prefix)
7094
7095 To disable keyword syntax, do this:
7096 (read-set! keywords #f)
7097
7098 ** Many more primitive functions accept shared substrings as
7099 arguments. In the past, these functions required normal, mutable
7100 strings as arguments, although they never made use of this
7101 restriction.
7102
7103 ** The uniform array functions now operate on byte vectors. These
7104 functions are `array-fill!', `serial-array-copy!', `array-copy!',
7105 `serial-array-map', `array-map', `array-for-each', and
7106 `array-index-map!'.
7107
7108 ** The new functions `trace' and `untrace' implement simple debugging
7109 support for Scheme functions.
7110
7111 The `trace' function accepts any number of procedures as arguments,
7112 and tells the Guile interpreter to display each procedure's name and
7113 arguments each time the procedure is invoked. When invoked with no
7114 arguments, `trace' returns the list of procedures currently being
7115 traced.
7116
7117 The `untrace' function accepts any number of procedures as arguments,
7118 and tells the Guile interpreter not to trace them any more. When
7119 invoked with no arguments, `untrace' untraces all curretly traced
7120 procedures.
7121
7122 The tracing in Guile has an advantage over most other systems: we
7123 don't create new procedure objects, but mark the procedure objects
7124 themselves. This means that anonymous and internal procedures can be
7125 traced.
7126
7127 ** The function `assert-repl-prompt' has been renamed to
7128 `set-repl-prompt!'. It takes one argument, PROMPT.
7129 - If PROMPT is #f, the Guile read-eval-print loop will not prompt.
7130 - If PROMPT is a string, we use it as a prompt.
7131 - If PROMPT is a procedure accepting no arguments, we call it, and
7132 display the result as a prompt.
7133 - Otherwise, we display "> ".
7134
7135 ** The new function `eval-string' reads Scheme expressions from a
7136 string and evaluates them, returning the value of the last expression
7137 in the string. If the string contains no expressions, it returns an
7138 unspecified value.
7139
7140 ** The new function `thunk?' returns true iff its argument is a
7141 procedure of zero arguments.
7142
7143 ** `defined?' is now a builtin function, instead of syntax. This
7144 means that its argument should be quoted. It returns #t iff its
7145 argument is bound in the current module.
7146
7147 ** The new syntax `use-modules' allows you to add new modules to your
7148 environment without re-typing a complete `define-module' form. It
7149 accepts any number of module names as arguments, and imports their
7150 public bindings into the current module.
7151
7152 ** The new function (module-defined? NAME MODULE) returns true iff
7153 NAME, a symbol, is defined in MODULE, a module object.
7154
7155 ** The new function `builtin-bindings' creates and returns a hash
7156 table containing copies of all the root module's bindings.
7157
7158 ** The new function `builtin-weak-bindings' does the same as
7159 `builtin-bindings', but creates a doubly-weak hash table.
7160
7161 ** The `equal?' function now considers variable objects to be
7162 equivalent if they have the same name and the same value.
7163
7164 ** The new function `command-line' returns the command-line arguments
7165 given to Guile, as a list of strings.
7166
7167 When using guile as a script interpreter, `command-line' returns the
7168 script's arguments; those processed by the interpreter (like `-s' or
7169 `-c') are omitted. (In other words, you get the normal, expected
7170 behavior.) Any application that uses scm_shell to process its
7171 command-line arguments gets this behavior as well.
7172
7173 ** The new function `load-user-init' looks for a file called `.guile'
7174 in the user's home directory, and loads it if it exists. This is
7175 mostly for use by the code generated by scm_compile_shell_switches,
7176 but we thought it might also be useful in other circumstances.
7177
7178 ** The new function `log10' returns the base-10 logarithm of its
7179 argument.
7180
7181 ** Changes to I/O functions
7182
7183 *** The functions `read', `primitive-load', `read-and-eval!', and
7184 `primitive-load-path' no longer take optional arguments controlling
7185 case insensitivity and a `#' parser.
7186
7187 Case sensitivity is now controlled by a read option called
7188 `case-insensitive'. The user can add new `#' syntaxes with the
7189 `read-hash-extend' function (see below).
7190
7191 *** The new function `read-hash-extend' allows the user to change the
7192 syntax of Guile Scheme in a somewhat controlled way.
7193
7194 (read-hash-extend CHAR PROC)
7195 When parsing S-expressions, if we read a `#' character followed by
7196 the character CHAR, use PROC to parse an object from the stream.
7197 If PROC is #f, remove any parsing procedure registered for CHAR.
7198
7199 The reader applies PROC to two arguments: CHAR and an input port.
7200
7201 *** The new functions read-delimited and read-delimited! provide a
7202 general mechanism for doing delimited input on streams.
7203
7204 (read-delimited DELIMS [PORT HANDLE-DELIM])
7205 Read until we encounter one of the characters in DELIMS (a string),
7206 or end-of-file. PORT is the input port to read from; it defaults to
7207 the current input port. The HANDLE-DELIM parameter determines how
7208 the terminating character is handled; it should be one of the
7209 following symbols:
7210
7211 'trim omit delimiter from result
7212 'peek leave delimiter character in input stream
7213 'concat append delimiter character to returned value
7214 'split return a pair: (RESULT . TERMINATOR)
7215
7216 HANDLE-DELIM defaults to 'peek.
7217
7218 (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
7219 A side-effecting variant of `read-delimited'.
7220
7221 The data is written into the string BUF at the indices in the
7222 half-open interval [START, END); the default interval is the whole
7223 string: START = 0 and END = (string-length BUF). The values of
7224 START and END must specify a well-defined interval in BUF, i.e.
7225 0 <= START <= END <= (string-length BUF).
7226
7227 It returns NBYTES, the number of bytes read. If the buffer filled
7228 up without a delimiter character being found, it returns #f. If the
7229 port is at EOF when the read starts, it returns the EOF object.
7230
7231 If an integer is returned (i.e., the read is successfully terminated
7232 by reading a delimiter character), then the HANDLE-DELIM parameter
7233 determines how to handle the terminating character. It is described
7234 above, and defaults to 'peek.
7235
7236 (The descriptions of these functions were borrowed from the SCSH
7237 manual, by Olin Shivers and Brian Carlstrom.)
7238
7239 *** The `%read-delimited!' function is the primitive used to implement
7240 `read-delimited' and `read-delimited!'.
7241
7242 (%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
7243
7244 This returns a pair of values: (TERMINATOR . NUM-READ).
7245 - TERMINATOR describes why the read was terminated. If it is a
7246 character or the eof object, then that is the value that terminated
7247 the read. If it is #f, the function filled the buffer without finding
7248 a delimiting character.
7249 - NUM-READ is the number of characters read into BUF.
7250
7251 If the read is successfully terminated by reading a delimiter
7252 character, then the gobble? parameter determines what to do with the
7253 terminating character. If true, the character is removed from the
7254 input stream; if false, the character is left in the input stream
7255 where a subsequent read operation will retrieve it. In either case,
7256 the character is also the first value returned by the procedure call.
7257
7258 (The descriptions of this function was borrowed from the SCSH manual,
7259 by Olin Shivers and Brian Carlstrom.)
7260
7261 *** The `read-line' and `read-line!' functions have changed; they now
7262 trim the terminator by default; previously they appended it to the
7263 returned string. For the old behavior, use (read-line PORT 'concat).
7264
7265 *** The functions `uniform-array-read!' and `uniform-array-write!' now
7266 take new optional START and END arguments, specifying the region of
7267 the array to read and write.
7268
7269 *** The `ungetc-char-ready?' function has been removed. We feel it's
7270 inappropriate for an interface to expose implementation details this
7271 way.
7272
7273 ** Changes to the Unix library and system call interface
7274
7275 *** The new fcntl function provides access to the Unix `fcntl' system
7276 call.
7277
7278 (fcntl PORT COMMAND VALUE)
7279 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
7280 Values for COMMAND are:
7281
7282 F_DUPFD duplicate a file descriptor
7283 F_GETFD read the descriptor's close-on-exec flag
7284 F_SETFD set the descriptor's close-on-exec flag to VALUE
7285 F_GETFL read the descriptor's flags, as set on open
7286 F_SETFL set the descriptor's flags, as set on open to VALUE
7287 F_GETOWN return the process ID of a socket's owner, for SIGIO
7288 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
7289 FD_CLOEXEC not sure what this is
7290
7291 For details, see the documentation for the fcntl system call.
7292
7293 *** The arguments to `select' have changed, for compatibility with
7294 SCSH. The TIMEOUT parameter may now be non-integral, yielding the
7295 expected behavior. The MILLISECONDS parameter has been changed to
7296 MICROSECONDS, to more closely resemble the underlying system call.
7297 The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
7298 corresponding return set will be the same.
7299
7300 *** The arguments to the `mknod' system call have changed. They are
7301 now:
7302
7303 (mknod PATH TYPE PERMS DEV)
7304 Create a new file (`node') in the file system. PATH is the name of
7305 the file to create. TYPE is the kind of file to create; it should
7306 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
7307 permission bits to give the newly created file. If TYPE is
7308 'block-special or 'char-special, DEV specifies which device the
7309 special file refers to; its interpretation depends on the kind of
7310 special file being created.
7311
7312 *** The `fork' function has been renamed to `primitive-fork', to avoid
7313 clashing with various SCSH forks.
7314
7315 *** The `recv' and `recvfrom' functions have been renamed to `recv!'
7316 and `recvfrom!'. They no longer accept a size for a second argument;
7317 you must pass a string to hold the received value. They no longer
7318 return the buffer. Instead, `recv' returns the length of the message
7319 received, and `recvfrom' returns a pair containing the packet's length
7320 and originating address.
7321
7322 *** The file descriptor datatype has been removed, as have the
7323 `read-fd', `write-fd', `close', `lseek', and `dup' functions.
7324 We plan to replace these functions with a SCSH-compatible interface.
7325
7326 *** The `create' function has been removed; it's just a special case
7327 of `open'.
7328
7329 *** There are new functions to break down process termination status
7330 values. In the descriptions below, STATUS is a value returned by
7331 `waitpid'.
7332
7333 (status:exit-val STATUS)
7334 If the child process exited normally, this function returns the exit
7335 code for the child process (i.e., the value passed to exit, or
7336 returned from main). If the child process did not exit normally,
7337 this function returns #f.
7338
7339 (status:stop-sig STATUS)
7340 If the child process was suspended by a signal, this function
7341 returns the signal that suspended the child. Otherwise, it returns
7342 #f.
7343
7344 (status:term-sig STATUS)
7345 If the child process terminated abnormally, this function returns
7346 the signal that terminated the child. Otherwise, this function
7347 returns false.
7348
7349 POSIX promises that exactly one of these functions will return true on
7350 a valid STATUS value.
7351
7352 These functions are compatible with SCSH.
7353
7354 *** There are new accessors and setters for the broken-out time vectors
7355 returned by `localtime', `gmtime', and that ilk. They are:
7356
7357 Component Accessor Setter
7358 ========================= ============ ============
7359 seconds tm:sec set-tm:sec
7360 minutes tm:min set-tm:min
7361 hours tm:hour set-tm:hour
7362 day of the month tm:mday set-tm:mday
7363 month tm:mon set-tm:mon
7364 year tm:year set-tm:year
7365 day of the week tm:wday set-tm:wday
7366 day in the year tm:yday set-tm:yday
7367 daylight saving time tm:isdst set-tm:isdst
7368 GMT offset, seconds tm:gmtoff set-tm:gmtoff
7369 name of time zone tm:zone set-tm:zone
7370
7371 *** There are new accessors for the vectors returned by `uname',
7372 describing the host system:
7373
7374 Component Accessor
7375 ============================================== ================
7376 name of the operating system implementation utsname:sysname
7377 network name of this machine utsname:nodename
7378 release level of the operating system utsname:release
7379 version level of the operating system utsname:version
7380 machine hardware platform utsname:machine
7381
7382 *** There are new accessors for the vectors returned by `getpw',
7383 `getpwnam', `getpwuid', and `getpwent', describing entries from the
7384 system's user database:
7385
7386 Component Accessor
7387 ====================== =================
7388 user name passwd:name
7389 user password passwd:passwd
7390 user id passwd:uid
7391 group id passwd:gid
7392 real name passwd:gecos
7393 home directory passwd:dir
7394 shell program passwd:shell
7395
7396 *** There are new accessors for the vectors returned by `getgr',
7397 `getgrnam', `getgrgid', and `getgrent', describing entries from the
7398 system's group database:
7399
7400 Component Accessor
7401 ======================= ============
7402 group name group:name
7403 group password group:passwd
7404 group id group:gid
7405 group members group:mem
7406
7407 *** There are new accessors for the vectors returned by `gethost',
7408 `gethostbyaddr', `gethostbyname', and `gethostent', describing
7409 internet hosts:
7410
7411 Component Accessor
7412 ========================= ===============
7413 official name of host hostent:name
7414 alias list hostent:aliases
7415 host address type hostent:addrtype
7416 length of address hostent:length
7417 list of addresses hostent:addr-list
7418
7419 *** There are new accessors for the vectors returned by `getnet',
7420 `getnetbyaddr', `getnetbyname', and `getnetent', describing internet
7421 networks:
7422
7423 Component Accessor
7424 ========================= ===============
7425 official name of net netent:name
7426 alias list netent:aliases
7427 net number type netent:addrtype
7428 net number netent:net
7429
7430 *** There are new accessors for the vectors returned by `getproto',
7431 `getprotobyname', `getprotobynumber', and `getprotoent', describing
7432 internet protocols:
7433
7434 Component Accessor
7435 ========================= ===============
7436 official protocol name protoent:name
7437 alias list protoent:aliases
7438 protocol number protoent:proto
7439
7440 *** There are new accessors for the vectors returned by `getserv',
7441 `getservbyname', `getservbyport', and `getservent', describing
7442 internet protocols:
7443
7444 Component Accessor
7445 ========================= ===============
7446 official service name servent:name
7447 alias list servent:aliases
7448 port number servent:port
7449 protocol to use servent:proto
7450
7451 *** There are new accessors for the sockaddr structures returned by
7452 `accept', `getsockname', `getpeername', `recvfrom!':
7453
7454 Component Accessor
7455 ======================================== ===============
7456 address format (`family') sockaddr:fam
7457 path, for file domain addresses sockaddr:path
7458 address, for internet domain addresses sockaddr:addr
7459 TCP or UDP port, for internet sockaddr:port
7460
7461 *** The `getpwent', `getgrent', `gethostent', `getnetent',
7462 `getprotoent', and `getservent' functions now return #f at the end of
7463 the user database. (They used to throw an exception.)
7464
7465 Note that calling MUMBLEent function is equivalent to calling the
7466 corresponding MUMBLE function with no arguments.
7467
7468 *** The `setpwent', `setgrent', `sethostent', `setnetent',
7469 `setprotoent', and `setservent' routines now take no arguments.
7470
7471 *** The `gethost', `getproto', `getnet', and `getserv' functions now
7472 provide more useful information when they throw an exception.
7473
7474 *** The `lnaof' function has been renamed to `inet-lnaof'.
7475
7476 *** Guile now claims to have the `current-time' feature.
7477
7478 *** The `mktime' function now takes an optional second argument ZONE,
7479 giving the time zone to use for the conversion. ZONE should be a
7480 string, in the same format as expected for the "TZ" environment variable.
7481
7482 *** The `strptime' function now returns a pair (TIME . COUNT), where
7483 TIME is the parsed time as a vector, and COUNT is the number of
7484 characters from the string left unparsed. This function used to
7485 return the remaining characters as a string.
7486
7487 *** The `gettimeofday' function has replaced the old `time+ticks' function.
7488 The return value is now (SECONDS . MICROSECONDS); the fractional
7489 component is no longer expressed in "ticks".
7490
7491 *** The `ticks/sec' constant has been removed, in light of the above change.
7492
7493 * Changes to the gh_ interface
7494
7495 ** gh_eval_str() now returns an SCM object which is the result of the
7496 evaluation
7497
7498 ** gh_scm2str() now copies the Scheme data to a caller-provided C
7499 array
7500
7501 ** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
7502 and returns the array
7503
7504 ** gh_scm2str0() is gone: there is no need to distinguish
7505 null-terminated from non-null-terminated, since gh_scm2newstr() allows
7506 the user to interpret the data both ways.
7507
7508 * Changes to the scm_ interface
7509
7510 ** The new function scm_symbol_value0 provides an easy way to get a
7511 symbol's value from C code:
7512
7513 SCM scm_symbol_value0 (char *NAME)
7514 Return the value of the symbol named by the null-terminated string
7515 NAME in the current module. If the symbol named NAME is unbound in
7516 the current module, return SCM_UNDEFINED.
7517
7518 ** The new function scm_sysintern0 creates new top-level variables,
7519 without assigning them a value.
7520
7521 SCM scm_sysintern0 (char *NAME)
7522 Create a new Scheme top-level variable named NAME. NAME is a
7523 null-terminated string. Return the variable's value cell.
7524
7525 ** The function scm_internal_catch is the guts of catch. It handles
7526 all the mechanics of setting up a catch target, invoking the catch
7527 body, and perhaps invoking the handler if the body does a throw.
7528
7529 The function is designed to be usable from C code, but is general
7530 enough to implement all the semantics Guile Scheme expects from throw.
7531
7532 TAG is the catch tag. Typically, this is a symbol, but this function
7533 doesn't actually care about that.
7534
7535 BODY is a pointer to a C function which runs the body of the catch;
7536 this is the code you can throw from. We call it like this:
7537 BODY (BODY_DATA, JMPBUF)
7538 where:
7539 BODY_DATA is just the BODY_DATA argument we received; we pass it
7540 through to BODY as its first argument. The caller can make
7541 BODY_DATA point to anything useful that BODY might need.
7542 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
7543 which we have just created and initialized.
7544
7545 HANDLER is a pointer to a C function to deal with a throw to TAG,
7546 should one occur. We call it like this:
7547 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
7548 where
7549 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
7550 same idea as BODY_DATA above.
7551 THROWN_TAG is the tag that the user threw to; usually this is
7552 TAG, but it could be something else if TAG was #t (i.e., a
7553 catch-all), or the user threw to a jmpbuf.
7554 THROW_ARGS is the list of arguments the user passed to the THROW
7555 function.
7556
7557 BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
7558 is just a pointer we pass through to HANDLER. We don't actually
7559 use either of those pointers otherwise ourselves. The idea is
7560 that, if our caller wants to communicate something to BODY or
7561 HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
7562 HANDLER can then use. Think of it as a way to make BODY and
7563 HANDLER closures, not just functions; MUMBLE_DATA points to the
7564 enclosed variables.
7565
7566 Of course, it's up to the caller to make sure that any data a
7567 MUMBLE_DATA needs is protected from GC. A common way to do this is
7568 to make MUMBLE_DATA a pointer to data stored in an automatic
7569 structure variable; since the collector must scan the stack for
7570 references anyway, this assures that any references in MUMBLE_DATA
7571 will be found.
7572
7573 ** The new function scm_internal_lazy_catch is exactly like
7574 scm_internal_catch, except:
7575
7576 - It does not unwind the stack (this is the major difference).
7577 - If handler returns, its value is returned from the throw.
7578 - BODY always receives #f as its JMPBUF argument (since there's no
7579 jmpbuf associated with a lazy catch, because we don't unwind the
7580 stack.)
7581
7582 ** scm_body_thunk is a new body function you can pass to
7583 scm_internal_catch if you want the body to be like Scheme's `catch'
7584 --- a thunk, or a function of one argument if the tag is #f.
7585
7586 BODY_DATA is a pointer to a scm_body_thunk_data structure, which
7587 contains the Scheme procedure to invoke as the body, and the tag
7588 we're catching. If the tag is #f, then we pass JMPBUF (created by
7589 scm_internal_catch) to the body procedure; otherwise, the body gets
7590 no arguments.
7591
7592 ** scm_handle_by_proc is a new handler function you can pass to
7593 scm_internal_catch if you want the handler to act like Scheme's catch
7594 --- call a procedure with the tag and the throw arguments.
7595
7596 If the user does a throw to this catch, this function runs a handler
7597 procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
7598 variable holding the Scheme procedure object to invoke. It ought to
7599 be a pointer to an automatic variable (i.e., one living on the stack),
7600 or the procedure object should be otherwise protected from GC.
7601
7602 ** scm_handle_by_message is a new handler function to use with
7603 `scm_internal_catch' if you want Guile to print a message and die.
7604 It's useful for dealing with throws to uncaught keys at the top level.
7605
7606 HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
7607 message header to print; if zero, we use "guile" instead. That
7608 text is followed by a colon, then the message described by ARGS.
7609
7610 ** The return type of scm_boot_guile is now void; the function does
7611 not return a value, and indeed, never returns at all.
7612
7613 ** The new function scm_shell makes it easy for user applications to
7614 process command-line arguments in a way that is compatible with the
7615 stand-alone guile interpreter (which is in turn compatible with SCSH,
7616 the Scheme shell).
7617
7618 To use the scm_shell function, first initialize any guile modules
7619 linked into your application, and then call scm_shell with the values
7620 of ARGC and ARGV your `main' function received. scm_shell will add
7621 any SCSH-style meta-arguments from the top of the script file to the
7622 argument vector, and then process the command-line arguments. This
7623 generally means loading a script file or starting up an interactive
7624 command interpreter. For details, see "Changes to the stand-alone
7625 interpreter" above.
7626
7627 ** The new functions scm_get_meta_args and scm_count_argv help you
7628 implement the SCSH-style meta-argument, `\'.
7629
7630 char **scm_get_meta_args (int ARGC, char **ARGV)
7631 If the second element of ARGV is a string consisting of a single
7632 backslash character (i.e. "\\" in Scheme notation), open the file
7633 named by the following argument, parse arguments from it, and return
7634 the spliced command line. The returned array is terminated by a
7635 null pointer.
7636
7637 For details of argument parsing, see above, under "guile now accepts
7638 command-line arguments compatible with SCSH..."
7639
7640 int scm_count_argv (char **ARGV)
7641 Count the arguments in ARGV, assuming it is terminated by a null
7642 pointer.
7643
7644 For an example of how these functions might be used, see the source
7645 code for the function scm_shell in libguile/script.c.
7646
7647 You will usually want to use scm_shell instead of calling this
7648 function yourself.
7649
7650 ** The new function scm_compile_shell_switches turns an array of
7651 command-line arguments into Scheme code to carry out the actions they
7652 describe. Given ARGC and ARGV, it returns a Scheme expression to
7653 evaluate, and calls scm_set_program_arguments to make any remaining
7654 command-line arguments available to the Scheme code. For example,
7655 given the following arguments:
7656
7657 -e main -s ekko a speckled gecko
7658
7659 scm_set_program_arguments will return the following expression:
7660
7661 (begin (load "ekko") (main (command-line)) (quit))
7662
7663 You will usually want to use scm_shell instead of calling this
7664 function yourself.
7665
7666 ** The function scm_shell_usage prints a usage message appropriate for
7667 an interpreter that uses scm_compile_shell_switches to handle its
7668 command-line arguments.
7669
7670 void scm_shell_usage (int FATAL, char *MESSAGE)
7671 Print a usage message to the standard error output. If MESSAGE is
7672 non-zero, write it before the usage message, followed by a newline.
7673 If FATAL is non-zero, exit the process, using FATAL as the
7674 termination status. (If you want to be compatible with Guile,
7675 always use 1 as the exit status when terminating due to command-line
7676 usage problems.)
7677
7678 You will usually want to use scm_shell instead of calling this
7679 function yourself.
7680
7681 ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
7682 expressions. It used to return SCM_EOL. Earth-shattering.
7683
7684 ** The macros for declaring scheme objects in C code have been
7685 rearranged slightly. They are now:
7686
7687 SCM_SYMBOL (C_NAME, SCHEME_NAME)
7688 Declare a static SCM variable named C_NAME, and initialize it to
7689 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
7690 be a C identifier, and SCHEME_NAME should be a C string.
7691
7692 SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
7693 Just like SCM_SYMBOL, but make C_NAME globally visible.
7694
7695 SCM_VCELL (C_NAME, SCHEME_NAME)
7696 Create a global variable at the Scheme level named SCHEME_NAME.
7697 Declare a static SCM variable named C_NAME, and initialize it to
7698 point to the Scheme variable's value cell.
7699
7700 SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
7701 Just like SCM_VCELL, but make C_NAME globally visible.
7702
7703 The `guile-snarf' script writes initialization code for these macros
7704 to its standard output, given C source code as input.
7705
7706 The SCM_GLOBAL macro is gone.
7707
7708 ** The scm_read_line and scm_read_line_x functions have been replaced
7709 by Scheme code based on the %read-delimited! procedure (known to C
7710 code as scm_read_delimited_x). See its description above for more
7711 information.
7712
7713 ** The function scm_sys_open has been renamed to scm_open. It now
7714 returns a port instead of an FD object.
7715
7716 * The dynamic linking support has changed. For more information, see
7717 libguile/DYNAMIC-LINKING.
7718
7719 \f
7720 Guile 1.0b3
7721
7722 User-visible changes from Thursday, September 5, 1996 until Guile 1.0
7723 (Sun 5 Jan 1997):
7724
7725 * Changes to the 'guile' program:
7726
7727 ** Guile now loads some new files when it starts up. Guile first
7728 searches the load path for init.scm, and loads it if found. Then, if
7729 Guile is not being used to execute a script, and the user's home
7730 directory contains a file named `.guile', Guile loads that.
7731
7732 ** You can now use Guile as a shell script interpreter.
7733
7734 To paraphrase the SCSH manual:
7735
7736 When Unix tries to execute an executable file whose first two
7737 characters are the `#!', it treats the file not as machine code to
7738 be directly executed by the native processor, but as source code
7739 to be executed by some interpreter. The interpreter to use is
7740 specified immediately after the #! sequence on the first line of
7741 the source file. The kernel reads in the name of the interpreter,
7742 and executes that instead. It passes the interpreter the source
7743 filename as its first argument, with the original arguments
7744 following. Consult the Unix man page for the `exec' system call
7745 for more information.
7746
7747 Now you can use Guile as an interpreter, using a mechanism which is a
7748 compatible subset of that provided by SCSH.
7749
7750 Guile now recognizes a '-s' command line switch, whose argument is the
7751 name of a file of Scheme code to load. It also treats the two
7752 characters `#!' as the start of a comment, terminated by `!#'. Thus,
7753 to make a file of Scheme code directly executable by Unix, insert the
7754 following two lines at the top of the file:
7755
7756 #!/usr/local/bin/guile -s
7757 !#
7758
7759 Guile treats the argument of the `-s' command-line switch as the name
7760 of a file of Scheme code to load, and treats the sequence `#!' as the
7761 start of a block comment, terminated by `!#'.
7762
7763 For example, here's a version of 'echo' written in Scheme:
7764
7765 #!/usr/local/bin/guile -s
7766 !#
7767 (let loop ((args (cdr (program-arguments))))
7768 (if (pair? args)
7769 (begin
7770 (display (car args))
7771 (if (pair? (cdr args))
7772 (display " "))
7773 (loop (cdr args)))))
7774 (newline)
7775
7776 Why does `#!' start a block comment terminated by `!#', instead of the
7777 end of the line? That is the notation SCSH uses, and although we
7778 don't yet support the other SCSH features that motivate that choice,
7779 we would like to be backward-compatible with any existing Guile
7780 scripts once we do. Furthermore, if the path to Guile on your system
7781 is too long for your kernel, you can start the script with this
7782 horrible hack:
7783
7784 #!/bin/sh
7785 exec /really/long/path/to/guile -s "$0" ${1+"$@"}
7786 !#
7787
7788 Note that some very old Unix systems don't support the `#!' syntax.
7789
7790
7791 ** You can now run Guile without installing it.
7792
7793 Previous versions of the interactive Guile interpreter (`guile')
7794 couldn't start up unless Guile's Scheme library had been installed;
7795 they used the value of the environment variable `SCHEME_LOAD_PATH'
7796 later on in the startup process, but not to find the startup code
7797 itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
7798 code.
7799
7800 To run Guile without installing it, build it in the normal way, and
7801 then set the environment variable `SCHEME_LOAD_PATH' to a
7802 colon-separated list of directories, including the top-level directory
7803 of the Guile sources. For example, if you unpacked Guile so that the
7804 full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
7805 you might say
7806
7807 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
7808
7809
7810 ** Guile's read-eval-print loop no longer prints #<unspecified>
7811 results. If the user wants to see this, she can evaluate the
7812 expression (assert-repl-print-unspecified #t), perhaps in her startup
7813 file.
7814
7815 ** Guile no longer shows backtraces by default when an error occurs;
7816 however, it does display a message saying how to get one, and how to
7817 request that they be displayed by default. After an error, evaluate
7818 (backtrace)
7819 to see a backtrace, and
7820 (debug-enable 'backtrace)
7821 to see them by default.
7822
7823
7824
7825 * Changes to Guile Scheme:
7826
7827 ** Guile now distinguishes between #f and the empty list.
7828
7829 This is for compatibility with the IEEE standard, the (possibly)
7830 upcoming Revised^5 Report on Scheme, and many extant Scheme
7831 implementations.
7832
7833 Guile used to have #f and '() denote the same object, to make Scheme's
7834 type system more compatible with Emacs Lisp's. However, the change
7835 caused too much trouble for Scheme programmers, and we found another
7836 way to reconcile Emacs Lisp with Scheme that didn't require this.
7837
7838
7839 ** Guile's delq, delv, delete functions, and their destructive
7840 counterparts, delq!, delv!, and delete!, now remove all matching
7841 elements from the list, not just the first. This matches the behavior
7842 of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
7843 functions which inspired them.
7844
7845 I recognize that this change may break code in subtle ways, but it
7846 seems best to make the change before the FSF's first Guile release,
7847 rather than after.
7848
7849
7850 ** The compiled-library-path function has been deleted from libguile.
7851
7852 ** The facilities for loading Scheme source files have changed.
7853
7854 *** The variable %load-path now tells Guile which directories to search
7855 for Scheme code. Its value is a list of strings, each of which names
7856 a directory.
7857
7858 *** The variable %load-extensions now tells Guile which extensions to
7859 try appending to a filename when searching the load path. Its value
7860 is a list of strings. Its default value is ("" ".scm").
7861
7862 *** (%search-load-path FILENAME) searches the directories listed in the
7863 value of the %load-path variable for a Scheme file named FILENAME,
7864 with all the extensions listed in %load-extensions. If it finds a
7865 match, then it returns its full filename. If FILENAME is absolute, it
7866 returns it unchanged. Otherwise, it returns #f.
7867
7868 %search-load-path will not return matches that refer to directories.
7869
7870 *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
7871 uses %seach-load-path to find a file named FILENAME, and loads it if
7872 it finds it. If it can't read FILENAME for any reason, it throws an
7873 error.
7874
7875 The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
7876 `read' function.
7877
7878 *** load uses the same searching semantics as primitive-load.
7879
7880 *** The functions %try-load, try-load-with-path, %load, load-with-path,
7881 basic-try-load-with-path, basic-load-with-path, try-load-module-with-
7882 path, and load-module-with-path have been deleted. The functions
7883 above should serve their purposes.
7884
7885 *** If the value of the variable %load-hook is a procedure,
7886 `primitive-load' applies its value to the name of the file being
7887 loaded (without the load path directory name prepended). If its value
7888 is #f, it is ignored. Otherwise, an error occurs.
7889
7890 This is mostly useful for printing load notification messages.
7891
7892
7893 ** The function `eval!' is no longer accessible from the scheme level.
7894 We can't allow operations which introduce glocs into the scheme level,
7895 because Guile's type system can't handle these as data. Use `eval' or
7896 `read-and-eval!' (see below) as replacement.
7897
7898 ** The new function read-and-eval! reads an expression from PORT,
7899 evaluates it, and returns the result. This is more efficient than
7900 simply calling `read' and `eval', since it is not necessary to make a
7901 copy of the expression for the evaluator to munge.
7902
7903 Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
7904 for the `read' function.
7905
7906
7907 ** The function `int?' has been removed; its definition was identical
7908 to that of `integer?'.
7909
7910 ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
7911 use the R4RS names for these functions.
7912
7913 ** The function object-properties no longer returns the hash handle;
7914 it simply returns the object's property list.
7915
7916 ** Many functions have been changed to throw errors, instead of
7917 returning #f on failure. The point of providing exception handling in
7918 the language is to simplify the logic of user code, but this is less
7919 useful if Guile's primitives don't throw exceptions.
7920
7921 ** The function `fileno' has been renamed from `%fileno'.
7922
7923 ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
7924
7925
7926 * Changes to Guile's C interface:
7927
7928 ** The library's initialization procedure has been simplified.
7929 scm_boot_guile now has the prototype:
7930
7931 void scm_boot_guile (int ARGC,
7932 char **ARGV,
7933 void (*main_func) (),
7934 void *closure);
7935
7936 scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
7937 MAIN_FUNC should do all the work of the program (initializing other
7938 packages, reading user input, etc.) before returning. When MAIN_FUNC
7939 returns, call exit (0); this function never returns. If you want some
7940 other exit value, MAIN_FUNC may call exit itself.
7941
7942 scm_boot_guile arranges for program-arguments to return the strings
7943 given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
7944 scm_set_program_arguments with the final list, so Scheme code will
7945 know which arguments have been processed.
7946
7947 scm_boot_guile establishes a catch-all catch handler which prints an
7948 error message and exits the process. This means that Guile exits in a
7949 coherent way when system errors occur and the user isn't prepared to
7950 handle it. If the user doesn't like this behavior, they can establish
7951 their own universal catcher in MAIN_FUNC to shadow this one.
7952
7953 Why must the caller do all the real work from MAIN_FUNC? The garbage
7954 collector assumes that all local variables of type SCM will be above
7955 scm_boot_guile's stack frame on the stack. If you try to manipulate
7956 SCM values after this function returns, it's the luck of the draw
7957 whether the GC will be able to find the objects you allocate. So,
7958 scm_boot_guile function exits, rather than returning, to discourage
7959 people from making that mistake.
7960
7961 The IN, OUT, and ERR arguments were removed; there are other
7962 convenient ways to override these when desired.
7963
7964 The RESULT argument was deleted; this function should never return.
7965
7966 The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
7967 general.
7968
7969
7970 ** Guile's header files should no longer conflict with your system's
7971 header files.
7972
7973 In order to compile code which #included <libguile.h>, previous
7974 versions of Guile required you to add a directory containing all the
7975 Guile header files to your #include path. This was a problem, since
7976 Guile's header files have names which conflict with many systems'
7977 header files.
7978
7979 Now only <libguile.h> need appear in your #include path; you must
7980 refer to all Guile's other header files as <libguile/mumble.h>.
7981 Guile's installation procedure puts libguile.h in $(includedir), and
7982 the rest in $(includedir)/libguile.
7983
7984
7985 ** Two new C functions, scm_protect_object and scm_unprotect_object,
7986 have been added to the Guile library.
7987
7988 scm_protect_object (OBJ) protects OBJ from the garbage collector.
7989 OBJ will not be freed, even if all other references are dropped,
7990 until someone does scm_unprotect_object (OBJ). Both functions
7991 return OBJ.
7992
7993 Note that calls to scm_protect_object do not nest. You can call
7994 scm_protect_object any number of times on a given object, and the
7995 next call to scm_unprotect_object will unprotect it completely.
7996
7997 Basically, scm_protect_object and scm_unprotect_object just
7998 maintain a list of references to things. Since the GC knows about
7999 this list, all objects it mentions stay alive. scm_protect_object
8000 adds its argument to the list; scm_unprotect_object remove its
8001 argument from the list.
8002
8003
8004 ** scm_eval_0str now returns the value of the last expression
8005 evaluated.
8006
8007 ** The new function scm_read_0str reads an s-expression from a
8008 null-terminated string, and returns it.
8009
8010 ** The new function `scm_stdio_to_port' converts a STDIO file pointer
8011 to a Scheme port object.
8012
8013 ** The new function `scm_set_program_arguments' allows C code to set
8014 the value returned by the Scheme `program-arguments' function.
8015
8016 \f
8017 Older changes:
8018
8019 * Guile no longer includes sophisticated Tcl/Tk support.
8020
8021 The old Tcl/Tk support was unsatisfying to us, because it required the
8022 user to link against the Tcl library, as well as Tk and Guile. The
8023 interface was also un-lispy, in that it preserved Tcl/Tk's practice of
8024 referring to widgets by names, rather than exporting widgets to Scheme
8025 code as a special datatype.
8026
8027 In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
8028 maintainers described some very interesting changes in progress to the
8029 Tcl/Tk internals, which would facilitate clean interfaces between lone
8030 Tk and other interpreters --- even for garbage-collected languages
8031 like Scheme. They expected the new Tk to be publicly available in the
8032 fall of 1996.
8033
8034 Since it seems that Guile might soon have a new, cleaner interface to
8035 lone Tk, and that the old Guile/Tk glue code would probably need to be
8036 completely rewritten, we (Jim Blandy and Richard Stallman) have
8037 decided not to support the old code. We'll spend the time instead on
8038 a good interface to the newer Tk, as soon as it is available.
8039
8040 Until then, gtcltk-lib provides trivial, low-maintenance functionality.
8041
8042 \f
8043 Copyright information:
8044
8045 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
8046
8047 Permission is granted to anyone to make or distribute verbatim copies
8048 of this document as received, in any medium, provided that the
8049 copyright notice and this permission notice are preserved,
8050 thus giving the recipient permission to redistribute in turn.
8051
8052 Permission is granted to distribute modified versions
8053 of this document, or of portions of it,
8054 under the above conditions, provided also that they
8055 carry prominent notices stating who last changed them.
8056
8057 \f
8058 Local variables:
8059 mode: outline
8060 paragraph-separate: "[ \f]*$"
8061 end: