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