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