Commit | Line | Data |
---|---|---|
b2cbe8d8 | 1 | Guile NEWS --- history of user-visible changes. |
de2811cc | 2 | Copyright (C) 1996-2013 Free Software Foundation, Inc. |
5c54da76 JB |
3 | See the end for copying conditions. |
4 | ||
1e457544 | 5 | Please send Guile bug reports to bug-guile@gnu.org. |
5ebbe4ef | 6 | |
66ad445d | 7 | |
de2811cc AW |
8 | Changes in 2.0.8 (since 2.0.7): |
9 | ||
10 | * TODO | |
11 | ||
eed0d26c | 12 | ** Reorder points in order of importance and make comprehensible |
de2811cc | 13 | |
eed0d26c | 14 | ** Assemble thanks |
de2811cc | 15 | |
f361bb93 | 16 | * Notable changes |
de2811cc | 17 | |
eed0d26c MW |
18 | ** New keyword arguments for procedures that open files |
19 | ||
20 | Several procedures that open files now support keyword arguments to | |
21 | request binary I/O or to specify the character encoding for text files. | |
22 | ||
23 | It is also now possible to specify whether Guile should scan files for | |
24 | Emacs-style coding declarations. This scan was done by default in | |
25 | versions 2.0.0 through 2.0.7, but now must be explicitly requested. | |
26 | ||
27 | See "File Ports" in the manual for details. | |
28 | ||
29 | ** New guile.m4 | |
de2811cc | 30 | |
f361bb93 AW |
31 | The `guile.m4' autoconf macros have been rewritten to use `guild' and |
32 | `pkg-config' instead of the deprecated `guile-config' (which itself | |
33 | calls pkg-config). | |
de2811cc | 34 | |
f361bb93 AW |
35 | There is also a new macro, `GUILE_PKG', which allows packages to select |
36 | the version of Guile that they want to compile against. See "Autoconf | |
37 | Macros" in the manual, for more information. | |
de2811cc | 38 | |
eed0d26c | 39 | ** Better Windows support |
de2811cc | 40 | |
f361bb93 AW |
41 | Guile now correctly identifies absolute paths on Windows (MinGW), and |
42 | creates files on that platform according to its path conventions. See | |
43 | XXX in the manual, for all details. | |
de2811cc | 44 | |
f361bb93 AW |
45 | In addition, the new Gnulib imports provide `select' and `poll' on |
46 | Windows builds. | |
de2811cc | 47 | |
f361bb93 AW |
48 | As an incompatible change, systems that are missing <sys/select.h> were |
49 | previously provided a public `scm_std_select' C function that defined a | |
50 | version of `select', but unhappily it also provided its own incompatible | |
51 | definitions for FD_SET, FD_ZERO, and other system interface. Guile | |
52 | should not be setting these macros in public API, so this interface was | |
53 | removed on those plaforms (basically only MinGW). | |
de2811cc | 54 | |
eed0d26c | 55 | ** Numerics improvements |
de2811cc | 56 | |
eed0d26c MW |
57 | `number->string' now reliably outputs enough digits to produce the same |
58 | number when read back in. Previously, it mishandled subnormal numbers | |
59 | (printing them as "#.#"), and failed to distinguish between some | |
60 | distinct inexact numbers, e.g. 1.0 and (+ 1.0 (expt 2.0 -52)). These | |
61 | problems had far-reaching implications, since the compiler uses | |
62 | `number->string' to serialize numeric constants into .go files. | |
63 | ||
64 | `sqrt' now produces exact rational results when possible, and handles | |
65 | very large or very small numbers more robustly. | |
de2811cc | 66 | |
22c76fd8 MW |
67 | A number (ahem) of operations involving exact rationals have been |
68 | optimized, most notably `integer-expt' and `expt'. | |
eed0d26c | 69 | |
22c76fd8 | 70 | `exact->inexact' now performs correct IEEE rounding. |
eed0d26c MW |
71 | |
72 | ** New optimizations | |
de2811cc | 73 | |
f361bb93 | 74 | There were a number of improvements to the partial evaluator, allowing |
01b83dbd | 75 | complete reduction of forms such as: |
de2811cc | 76 | |
f361bb93 | 77 | ((let ((_ 10)) (lambda () _))) |
de2811cc | 78 | |
f361bb93 | 79 | ((lambda _ _)) |
de2811cc | 80 | |
c608e1aa | 81 | (apply (lambda _ _) 1 2 3 '(4)) |
de2811cc | 82 | |
f361bb93 | 83 | (call-with-values (lambda () (values 1 2)) (lambda _ _)) |
de2811cc | 84 | |
eed0d26c MW |
85 | `string-join' now handles huge lists efficiently. |
86 | ||
87 | `get-bytevector-some' is much faster. | |
de2811cc | 88 | |
a24cda1d LC |
89 | Finally, `array-ref', `array-set!' on arrays of rank 1 or 2 is now |
90 | faster, because it avoids building a rest list. Similarly, the | |
91 | one-argument case of `array-for-each' and `array-map!' has been | |
92 | optimized, and `array-copy!' and `array-fill!' are faster. | |
de2811cc | 93 | |
7ca88a40 MW |
94 | ** `peek-char' no longer consumes EOF |
95 | ||
96 | As required by the R5RS, if `peek-char' returns EOF, then the next read | |
97 | will also return EOF. Previously `peek-char' would consume the EOF. | |
98 | This makes a difference for terminal devices where it is possible to | |
99 | read past an EOF. | |
100 | ||
eed0d26c MW |
101 | ** Gnulib update |
102 | ||
103 | Guile's copy of Gnulib was updated to v0.0-7865-ga828bb2. The following | |
104 | modules were imported from Gnulib: select, times, pipe-posix, fstat, | |
105 | getlogin, poll, and c-strcase. | |
106 | ||
107 | ** `include' resolves relative file names relative to including file | |
de2811cc | 108 | |
f361bb93 AW |
109 | Given a relative file name, `include' will look for it relative to the |
110 | directory of the including file. This harmonizes the behavior of | |
111 | `include' with that of `load'. | |
de2811cc | 112 | |
eed0d26c | 113 | ** SLIB compatibility restored |
de2811cc | 114 | |
f361bb93 AW |
115 | Guile 2.0.8 is now compatible with SLIB. You will have to use a |
116 | development version of SLIB, however, until a new version of SLIB is | |
117 | released. | |
de2811cc | 118 | |
eed0d26c | 119 | ** Better ,trace REPL command |
f361bb93 AW |
120 | |
121 | Sometimes the ,trace output for nested function calls could overflow the | |
122 | terminal width, which wasn't useful. Now there is a limit to the amount | |
123 | of space the prefix will take. See the documentation for ",trace" for | |
124 | more information. | |
de2811cc | 125 | |
eed0d26c MW |
126 | ** Better docstring syntax supported for `case-lambda' |
127 | ||
128 | Docstrings can now be placed immediately after the `case-lambda' or | |
129 | `case-lambda*' keyword. See "Case-lambda" in the manual. | |
130 | ||
131 | ** `get-bytevector-some' much faster; may read less than possible | |
132 | ||
133 | `get-bytevector-some' has been made much faster, but may now read less | |
134 | than possible, in accordance with the R6RS definition. | |
135 | ||
136 | ** SRFI-45 exports `promise?'; promises print more nicely | |
137 | ||
138 | SRFI-45 now exports a `promise?' procedure that works with its promises, | |
139 | and its promises print more nicely. | |
140 | ||
141 | ** Improved handling of Unicode byte order marks | |
142 | ||
143 | See "BOM Handling" in the manual for details. | |
144 | ||
145 | ** Update predefined character sets to Unicode 6.2 | |
de2811cc | 146 | |
465ff502 LC |
147 | ** GMP 4.2 or later required |
148 | ||
149 | Guile used to require GMP at least version 4.1 (released in May 2002), | |
150 | and now requires at least version 4.2 (released in March 2006). | |
151 | ||
de2811cc AW |
152 | * Manual updates |
153 | ||
eed0d26c | 154 | ** Better SXML documentation |
de2811cc | 155 | |
f361bb93 AW |
156 | The documentation for SXML modules was much improved, though there is |
157 | still far to go. See "SXML" in manual. | |
de2811cc | 158 | |
eed0d26c | 159 | ** Style updates |
de2811cc | 160 | |
f361bb93 AW |
161 | Use of "iff" was replaced with standard English. Keyword arguments are |
162 | now documented consistently, along with their default values. | |
de2811cc | 163 | |
eed0d26c | 164 | ** An end to the generated-documentation experiment |
de2811cc | 165 | |
f361bb93 AW |
166 | When Guile 2.0 imported some modules from Guile-Lib, they came with a |
167 | system that generated documentation from docstrings and module | |
168 | commentaries. This produced terrible documentation. We finally bit the | |
169 | bullet and incorporated these modules into the main text, and will be | |
170 | improving them manually over time, as is the case with SXML. Help is | |
171 | appreciated. | |
de2811cc | 172 | |
eed0d26c | 173 | ** New documentation |
de2811cc | 174 | |
f361bb93 AW |
175 | There is now documentation for `scm_array_type', and `scm_array_ref', as |
176 | well as for the new `array-length' / 'scm_c_array_length' / | |
177 | `scm_array_length' functions. `array-in-bounds?' has better | |
178 | documentation as well. The `program-arguments-alist' and | |
eed0d26c MW |
179 | `program-lambda-list' functions are now documented, as well as `and=>', |
180 | `exit', and `quit'. The (system repl server) module is now documented | |
181 | (see REPL Servers). Finally, the GOOPS class hierarchy diagram has been | |
182 | regenerated for the web and print output formats. | |
de2811cc | 183 | |
f361bb93 | 184 | * New deprecations |
de2811cc | 185 | |
eed0d26c | 186 | ** Deprecate generalized vector interface |
de2811cc | 187 | |
f361bb93 AW |
188 | The generalized vector interface, introduced in 1.8.0, is simply a |
189 | redundant, verbose interface to arrays of rank 1. `array-ref' and | |
190 | similar functions are entirely sufficient. Thus, | |
191 | `scm_generalized_vector_p', `scm_generalized_vector_length', | |
192 | `scm_generalized_vector_ref', `scm_generalized_vector_set_x', and | |
193 | `scm_generalized_vector_to_list' are now deprecated. | |
de2811cc | 194 | |
eed0d26c | 195 | ** Deprecate SCM_CHAR_CODE_LIMIT and char-code-limit |
de2811cc | 196 | |
f361bb93 AW |
197 | These constants were defined to 256, which is not the highest codepoint |
198 | supported by Guile. Given that they were useless and incorrect, they | |
199 | have been deprecated. | |
de2811cc | 200 | |
eed0d26c | 201 | ** Deprecate `http-get*' |
de2811cc | 202 | |
f361bb93 | 203 | The new `#:streaming?' argument to `http-get' subsumes the functionality |
ed4aa264 LC |
204 | of `http-get*' (introduced in 2.0.7). Also, the `#:extra-headers' |
205 | argument is deprecated in favor of `#:headers'. | |
de2811cc | 206 | |
eed0d26c | 207 | ** Deprecate (ice-9 mapping) |
de2811cc | 208 | |
f361bb93 AW |
209 | This module, present in Guile since 1996 but never used or documented, |
210 | has never worked in Guile 2.0. It has now been deprecated and will be | |
211 | removed in Guile 2.2. | |
de2811cc | 212 | |
eed0d26c | 213 | ** Deprecate undocumented array-related C functions |
a24cda1d LC |
214 | |
215 | These are `scm_array_fill_int', `scm_ra_eqp', `scm_ra_lessp', | |
216 | `scm_ra_leqp', `scm_ra_grp', `scm_ra_greqp', `scm_ra_sum', | |
217 | `scm_ra_product', `scm_ra_difference', `scm_ra_divide', and | |
218 | `scm_array_identity'. | |
219 | ||
de2811cc AW |
220 | * New interfaces |
221 | ||
eed0d26c | 222 | ** SRFI-41 Streams |
de2811cc | 223 | |
eed0d26c | 224 | See "SRFI-41" in the manual. |
de2811cc | 225 | |
eed0d26c | 226 | ** New HTTP client procedures |
de2811cc | 227 | |
eed0d26c MW |
228 | See "Web Client" for documentation on the new `http-head', `http-post', |
229 | `http-put', `http-delete', `http-trace', and `http-options' procedures, | |
230 | and also for more options to `http-get'. | |
de2811cc | 231 | |
eed0d26c | 232 | ** Much more capable `xml->sxml' |
ed4aa264 | 233 | |
eed0d26c MW |
234 | See "Reading and Writing XML" for information on how the `xml->sxml' |
235 | parser deals with namespaces, processed entities, doctypes, and literal | |
236 | strings. Incidentally, `current-ssax-error-port' is now a parameter | |
237 | object. | |
ed4aa264 | 238 | |
eed0d26c | 239 | ** New procedures for converting strings to and from bytevectors |
de2811cc | 240 | |
eed0d26c MW |
241 | See "Representing Strings as Bytes" for documention on the new `(ice-9 |
242 | iconv)' module and its `bytevector->string' and `string->bytevector' | |
243 | procedures. | |
de2811cc | 244 | |
a24cda1d LC |
245 | ** Escape continuations with `call/ec' and `let/ec' |
246 | ||
247 | See "Prompt Primitives". | |
248 | ||
eed0d26c MW |
249 | ** New procedures to read all characters from a port |
250 | ||
251 | See "Line/Delimited" in the manual for documentation on `read-string' | |
252 | and `read-string!'. | |
253 | ||
254 | ** New procedure `sendfile' | |
255 | ||
256 | See "File System". | |
257 | ||
258 | ** New procedure `unget-bytevector' | |
259 | ||
260 | See "R6RS Binary Input". | |
261 | ||
262 | ** New C helper: `scm_c_bind_keyword_arguments' | |
263 | ||
264 | See "Keyword Procedures". | |
265 | ||
266 | ** New command-line arguments: `--language' and `-C' | |
267 | ||
268 | See "Command-line Options" in the manual. | |
269 | ||
270 | ** New environment variables: `GUILE_STACK_SIZE', `GUILE_INSTALL_LOCALE' | |
271 | ||
272 | See "Environment Variables". | |
273 | ||
274 | ** New procedures for dealing with file names | |
275 | ||
276 | See "File System" for documentation on `system-file-name-convention', | |
277 | `file-name-separator?', `absolute-file-name?', and | |
278 | `file-name-separator-string'. | |
279 | ||
280 | ** `array-length', an array's first dimension | |
de2811cc | 281 | |
01b83dbd | 282 | See "Array Procedures". |
de2811cc | 283 | |
eed0d26c | 284 | ** `hash-count', for hash tables |
de2811cc | 285 | |
01b83dbd | 286 | See "Hash Tables". |
de2811cc | 287 | |
eed0d26c MW |
288 | ** `round-ash', a bit-shifting operator that rounds on right-shift |
289 | ||
290 | See "Bitwise Operations". | |
291 | ||
292 | ** New foreign types: `ssize_t', `ptrdiff_t' | |
de2811cc | 293 | |
01b83dbd | 294 | See "Foreign Types". |
de2811cc | 295 | |
eed0d26c | 296 | ** New C helpers: `scm_from_ptrdiff_t', `scm_to_ptrdiff_t' |
de2811cc | 297 | |
01b83dbd | 298 | See "Integers". |
de2811cc | 299 | |
eed0d26c | 300 | ** Socket option `SO_REUSEPORT' now available from Scheme |
de2811cc | 301 | |
eed0d26c MW |
302 | If supported on the platform, `SO_REUSEPORT' is now available from |
303 | Scheme as well. See "Network Sockets and Communication". | |
de2811cc | 304 | |
eed0d26c | 305 | ** `current-language' in default environment |
de2811cc | 306 | |
01b83dbd AW |
307 | Previously defined only in `(system base language)', `current-language' |
308 | is now defined in the default environment, and is used to determine the | |
309 | language for the REPL, and for `compile-and-load'. | |
de2811cc | 310 | |
01b83dbd | 311 | ** New procedure: `fluid->parameter' |
de2811cc | 312 | |
01b83dbd AW |
313 | See "Parameters", for information on how to convert a fluid to a |
314 | parameter. | |
de2811cc | 315 | |
eed0d26c | 316 | ** New `print' REPL option |
de2811cc | 317 | |
01b83dbd AW |
318 | See "REPL Commands" in the manual for information on the new |
319 | user-customizable REPL printer. | |
de2811cc | 320 | |
eed0d26c | 321 | ** New variable: %site-ccache-dir |
de2811cc | 322 | |
01b83dbd AW |
323 | The "Installing Site Packages" and "Build Config" manual sections now |
324 | refer to this variable to describe where users should install their | |
325 | `.go' files. | |
de2811cc AW |
326 | |
327 | * Build fixes | |
328 | ||
f361bb93 | 329 | ** Fix compilation against libgc 7.3. |
de2811cc | 330 | ** Fix cross-compilation of `c-tokenize.o'. |
f361bb93 AW |
331 | ** Fix warning when compiling against glibc 2.17. |
332 | ** Fix documentation build against Texinfo 5.0. | |
01b83dbd AW |
333 | ** Fix building Guile from a directory with non-ASCII characters. |
334 | ** Fix native MinGW build. | |
335 | ** Fix --disable-posix build. | |
336 | ** Fix MinGW builds with networking, POSIX, and thread support. | |
de2811cc AW |
337 | |
338 | * Bug fixes | |
339 | ||
eed0d26c MW |
340 | ** Fix inexact number printer. |
341 | (http://bugs.gnu.org/13757) | |
342 | ** Fix infinite loop when parsing optional-argument short options (SRFI-37). | |
ed4aa264 | 343 | (http://bugs.gnu.org/13176) |
eed0d26c | 344 | ** web: Support non-GMT date headers in the HTTP client. |
ed4aa264 | 345 | (http://bugs.gnu.org/13544) |
eed0d26c MW |
346 | ** web: support IP-literal (IPv6 address) in Host header. |
347 | ** Avoid stack overflows with `par-map' and nested futures in general. | |
ed4aa264 | 348 | (http://bugs.gnu.org/13188) |
eed0d26c MW |
349 | ** Peek-char no longer consumes EOF. |
350 | (http://bugs.gnu.org/12216) | |
351 | ** Avoid swallowing multiple EOFs in R6RS binary-input procedures. | |
01b83dbd AW |
352 | ** A fork when multiple threads are running will now print a warning. |
353 | ** Allow for spurious wakeups from pthread_cond_wait. | |
de2811cc | 354 | (http://bugs.gnu.org/10641) |
01b83dbd | 355 | ** Warn and ignore module autoload failures. |
de2811cc | 356 | (http://bugs.gnu.org/12202) |
01b83dbd AW |
357 | ** Use chmod portably in (system base compile). |
358 | (http://bugs.gnu.org/10474) | |
c608e1aa | 359 | ** Fix response-body-port for HTTP responses without content-length. |
01b83dbd AW |
360 | (http://bugs.gnu.org/13857) |
361 | ** Allow case-lambda expressions with no clauses. | |
362 | (http://bugs.gnu.org/9776) | |
de2811cc AW |
363 | ** Improve standards conformance of string->number. |
364 | (http://bugs.gnu.org/11887) | |
01b83dbd AW |
365 | ** Support calls and tail-calls with more than 255 formals. |
366 | ** ,option evaluates its right-hand-side. | |
de2811cc | 367 | (http://bugs.gnu.org/13076) |
01b83dbd | 368 | ** Structs with tail arrays are not simple. |
de2811cc AW |
369 | (http://bugs.gnu.org/12808) |
370 | ** Make `SCM_LONG_BIT' usable in preprocessor conditionals. | |
371 | (http://bugs.gnu.org/13848) | |
372 | ** Fix thread-unsafe lazy initializations. | |
01b83dbd | 373 | ** Allow SMOB mark procedures to be called from parallel markers. |
de2811cc AW |
374 | (http://bugs.gnu.org/13611) |
375 | ** Fix later-bindings-win logic in with-fluids. | |
376 | (http://bugs.gnu.org/13843) | |
377 | ** Fix duplicate removal of with-fluids. | |
378 | (http://bugs.gnu.org/13838) | |
379 | ** Support calling foreign functions of 10 arguments or more. | |
01b83dbd AW |
380 | (http://bugs.gnu.org/13809) |
381 | ** Let reverse! accept arbitrary types as second argument. | |
382 | (http://bugs.gnu.org/13835) | |
de2811cc AW |
383 | ** Recognize the `x86_64.*-gnux32' triplet. |
384 | ** Check whether a triplet's OS part specifies an ABI. | |
385 | ** Recognize mips64* as having 32-bit pointers by default. | |
eed0d26c MW |
386 | ** Use portable sed constructs. |
387 | (http://bugs.gnu.org/14042) | |
01b83dbd AW |
388 | ** Remove language/glil/decompile-assembly.scm. |
389 | (http://bugs.gnu.org/10622) | |
390 | ** Use O_BINARY in `copy-file', `load-objcode', `mkstemp'. | |
eed0d26c MW |
391 | ** Use byte-oriented functions in `get-bytevector*'. |
392 | ** Fix abort when iconv swallows BOM from UTF-16 or UTF-32 stream. | |
01b83dbd | 393 | ** Fix compilation of functions with more than 255 local variables. |
de2811cc | 394 | ** Fix `getgroups' for when zero supplementary group IDs exist. |
01b83dbd AW |
395 | ** Allow (define-macro name (lambda ...)). |
396 | ** Various fixes to the (texinfo) modules. | |
de2811cc | 397 | ** guild: Gracefully handle failures to install the locale. |
01b83dbd AW |
398 | ** Fix format string warnings for ~!, ~|, ~/, ~q, ~Q, and ~^. |
399 | (http://bugs.gnu.org/13485) | |
de2811cc | 400 | ** Fix source annotation bug in psyntax 'expand-body'. |
01b83dbd | 401 | ** Ecmascript: Fix conversion to boolean for non-numbers. |
eed0d26c MW |
402 | ** Use case-insensitive comparisons for encoding names. |
403 | ** Add missing cond-expand feature identifiers. | |
01b83dbd AW |
404 | ** A failure to find a module's file does not prevent future loading. |
405 | ** Many (oop goops save) fixes. | |
406 | ** `http-get': don't shutdown write end of socket. | |
407 | (http://bugs.gnu.org/13095) | |
408 | ** Avoid signed integer overflow in scm_product. | |
c608e1aa | 409 | ** http: read-response-body always returns bytevector or #f, never EOF. |
de2811cc | 410 | ** web: Correctly detect "No route to host" conditions. |
eed0d26c | 411 | ** `system*': failure to execvp no longer leaks dangling processes. |
de2811cc | 412 | (http://bugs.gnu.org/13166) |
eed0d26c | 413 | ** More sensible case-lambda* dispatch. |
01b83dbd | 414 | (http://bugs.gnu.org/12929) |
de2811cc AW |
415 | ** Do not defer expansion of internal define-syntax forms. |
416 | (http://bugs.gnu.org/13509) | |
417 | ||
418 | ||
419 | \f | |
13fac282 LC |
420 | Changes in 2.0.7 (since 2.0.6): |
421 | ||
422 | * Notable changes | |
423 | ||
424 | ** SRFI-105 curly infix expressions are supported | |
425 | ||
426 | Curly infix expressions as described at | |
427 | http://srfi.schemers.org/srfi-105/srfi-105.html are now supported by | |
428 | Guile's reader. This allows users to write things like {a * {b + c}} | |
429 | instead of (* a (+ b c)). SRFI-105 support is enabled by using the | |
430 | `#!curly-infix' directive in source code, or the `curly-infix' reader | |
431 | option. See the manual for details. | |
432 | ||
433 | ** Reader options may now be per-port | |
434 | ||
435 | Historically, `read-options' and related procedures would manipulate | |
436 | global options, affecting the `read' procedure for all threads, and all | |
437 | current uses of `read'. | |
438 | ||
439 | Guile can now associate `read' options with specific ports, allowing | |
440 | different ports to use different options. For instance, the | |
441 | `#!fold-case' and `#!no-fold-case' reader directives have been | |
442 | implemented, and their effect is to modify the current read options of | |
443 | the current port only; similarly for `#!curly-infix'. Thus, it is | |
444 | possible, for instance, to have one port reading case-sensitive code, | |
445 | while another port reads case-insensitive code. | |
446 | ||
447 | ** Futures may now be nested | |
448 | ||
449 | Futures may now be nested: a future can itself spawn and then `touch' | |
450 | other futures. In addition, any thread that touches a future that has | |
451 | not completed now processes other futures while waiting for the touched | |
452 | future to completed. This allows all threads to be kept busy, and was | |
453 | made possible by the use of delimited continuations (see the manual for | |
454 | details.) | |
455 | ||
2813d725 MW |
456 | Consequently, `par-map' and `par-for-each' have been rewritten and can |
457 | now use all cores. | |
13fac282 | 458 | |
3919585f MW |
459 | ** `GUILE_LOAD_PATH' et al can now add directories to the end of the path |
460 | ||
461 | `GUILE_LOAD_PATH' and `GUILE_LOAD_COMPILED_PATH' can now be used to add | |
462 | directories to both ends of the load path. If the special path | |
463 | component `...' (ellipsis) is present in these environment variables, | |
464 | then the default path is put in place of the ellipsis, otherwise the | |
465 | default path is placed at the end. See "Environment Variables" in the | |
466 | manual for details. | |
467 | ||
13fac282 LC |
468 | ** `load-in-vicinity' search for `.go' files in `%load-compiled-path' |
469 | ||
470 | Previously, `load-in-vicinity' would look for compiled files in the | |
471 | auto-compilation cache, but not in `%load-compiled-path'. This is now | |
472 | fixed. This affects `load', and the `-l' command-line flag. See | |
473 | <http://bugs.gnu.org/12519> for details. | |
474 | ||
475 | ** Extension search order fixed, and LD_LIBRARY_PATH preserved | |
476 | ||
477 | Up to 2.0.6, Guile would modify the `LD_LIBRARY_PATH' environment | |
478 | variable (or whichever is relevant for the host OS) to insert its own | |
479 | default extension directories in the search path (using GNU libltdl | |
480 | facilities was not possible here.) This approach was problematic in two | |
481 | ways. | |
482 | ||
483 | First, the `LD_LIBRARY_PATH' modification would be visible to | |
484 | sub-processes, and would also affect future calls to `dlopen', which | |
485 | could lead to subtle bugs in the application or sub-processes. Second, | |
a94e7d85 MW |
486 | when the installation prefix is /usr, the `LD_LIBRARY_PATH' modification |
487 | would typically end up inserting /usr/lib before /usr/local/lib in the | |
488 | search path, which is often the opposite of system-wide settings such as | |
489 | `ld.so.conf'. | |
13fac282 LC |
490 | |
491 | Both issues have now been fixed. | |
492 | ||
493 | ** `make-vtable-vtable' is now deprecated | |
494 | ||
495 | Programs should instead use `make-vtable' and `<standard-vtable>'. | |
496 | ||
497 | ** The `-Wduplicate-case-datum' and `-Wbad-case-datum' are enabled | |
498 | ||
499 | These recently introduced warnings have been documented and are now | |
500 | enabled by default when auto-compiling. | |
501 | ||
a94e7d85 | 502 | ** Optimize calls to `equal?' or `eqv?' with a constant argument |
13fac282 | 503 | |
a94e7d85 MW |
504 | The compiler simplifies calls to `equal?' or `eqv?' with a constant |
505 | argument to use `eq?' instead, when applicable. | |
13fac282 LC |
506 | |
507 | * Manual updates | |
508 | ||
509 | ** SRFI-9 records now documented under "Compound Data Types" | |
510 | ||
511 | The documentation of SRFI-9 record types has been moved in the "Compound | |
512 | Data Types", next to Guile's other record APIs. A new section | |
513 | introduces the various record APIs, and describes the trade-offs they | |
514 | make. These changes were made in an attempt to better guide users | |
515 | through the maze of records API, and to recommend SRFI-9 as the main | |
516 | API. | |
517 | ||
518 | The documentation of Guile's raw `struct' API has also been improved. | |
519 | ||
520 | ** (ice-9 and-let-star) and (ice-9 curried-definitions) now documented | |
521 | ||
522 | These modules were missing from the manual. | |
523 | ||
524 | * New interfaces | |
525 | ||
526 | ** New "functional record setters" as a GNU extension of SRFI-9 | |
527 | ||
528 | The (srfi srfi-9 gnu) module now provides three new macros to deal with | |
529 | "updates" of immutable records: `define-immutable-record-type', | |
530 | `set-field', and `set-fields'. | |
531 | ||
532 | The first one allows record type "functional setters" to be defined; | |
533 | such setters keep the record unchanged, and instead return a new record | |
534 | with only one different field. The remaining macros provide the same | |
535 | functionality, and also optimize updates of multiple or nested fields. | |
536 | See the manual for details. | |
537 | ||
538 | ** web: New `http-get*', `response-body-port', and `text-content-type?' | |
539 | procedures | |
540 | ||
541 | These procedures return a port from which to read the response's body. | |
542 | Unlike `http-get' and `read-response-body', they allow the body to be | |
543 | processed incrementally instead of being stored entirely in memory. | |
544 | ||
545 | The `text-content-type?' predicate allows users to determine whether the | |
546 | content type of a response is textual. | |
547 | ||
548 | See the manual for details. | |
549 | ||
550 | ** `string-split' accepts character sets and predicates | |
551 | ||
552 | The `string-split' procedure can now be given a SRFI-14 character set or | |
553 | a predicate, instead of just a character. | |
554 | ||
3b539098 | 555 | ** R6RS SRFI support |
13fac282 | 556 | |
3b539098 LC |
557 | Previously, in R6RS modules, Guile incorrectly ignored components of |
558 | SRFI module names after the SRFI number, making it impossible to specify | |
559 | sub-libraries. This release corrects this, bringing us into accordance | |
560 | with SRFI 97. | |
13fac282 LC |
561 | |
562 | ** `define-public' is no a longer curried definition by default | |
563 | ||
564 | The (ice-9 curried-definitions) should be used for such uses. See the | |
565 | manual for details. | |
566 | ||
567 | * Build fixes | |
568 | ||
569 | ** Remove reference to `scm_init_popen' when `fork' is unavailable | |
570 | ||
571 | This fixes a MinGW build issue (http://bugs.gnu.org/12477). | |
572 | ||
573 | ** Fix race between installing `guild' and the `guile-tools' symlink | |
574 | ||
575 | * Bug fixes | |
576 | ||
577 | ** Procedures returned by `eval' now have docstrings | |
578 | (http://bugs.gnu.org/12173) | |
579 | ** web client: correctly handle uri-query, etc. in relative URI headers | |
580 | (http://bugs.gnu.org/12827) | |
581 | ** Fix docs for R6RS `hashtable-copy' | |
582 | ** R6RS `string-for-each' now accepts multiple string arguments | |
583 | ** Fix out-of-range error in the compiler's CSE pass | |
584 | (http://bugs.gnu.org/12883) | |
585 | ** Add missing R6RS `open-file-input/output-port' procedure | |
586 | ** Futures: Avoid creating the worker pool more than once | |
587 | ** Fix invalid assertion about mutex ownership in threads.c | |
588 | (http://bugs.gnu.org/12719) | |
589 | ** Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double' | |
590 | ** The `scandir' procedure now uses `lstat' instead of `stat' | |
591 | ** Fix `generalized-vector->list' indexing bug with shared arrays | |
592 | (http://bugs.gnu.org/12465) | |
593 | ** web: Change `http-get' to try all the addresses for the given URI | |
594 | ** Implement `hash' for structs | |
595 | (http://lists.gnu.org/archive/html/guile-devel/2012-10/msg00031.html) | |
596 | ** `read' now adds source properties for data types beyond pairs | |
597 | ** Improve error reporting in `append!' | |
598 | ** In fold-matches, set regexp/notbol unless matching string start | |
599 | ** Don't stat(2) and access(2) the .go location before using it | |
600 | ** SRFI-19: use zero padding for hours in ISO 8601 format, not blanks | |
601 | ** web: Fix uri-encoding for strings with no unreserved chars, and octets 0-15 | |
602 | ** More robust texinfo alias handling | |
603 | ** Optimize `format' and `simple-format' | |
604 | (http://bugs.gnu.org/12033) | |
605 | ** Angle of -0.0 is pi, not zero | |
606 | ||
607 | \f | |
d2e35793 AW |
608 | Changes in 2.0.6 (since 2.0.5): |
609 | ||
610 | * Notable changes | |
611 | ||
612 | ** New optimization pass: common subexpression elimination (CSE) | |
613 | ||
614 | Guile's optimizer will now run a CSE pass after partial evaluation. | |
615 | This pass propagates static information about branches taken, bound | |
616 | lexicals, and effects from an expression's dominators. It can replace | |
617 | common subexpressions with their boolean values (potentially enabling | |
618 | dead code elimination), equivalent bound lexicals, or it can elide them | |
619 | entirely, depending on the context in which they are executed. This | |
620 | pass is especially useful in removing duplicate type checks, such as | |
d7a33b64 | 621 | those produced by SRFI-9 record accessors. |
d2e35793 AW |
622 | |
623 | ** Improvements to the partial evaluator | |
624 | ||
625 | Peval can now hoist tests that are common to both branches of a | |
626 | conditional into the test. This can help with long chains of | |
627 | conditionals, such as those generated by the `match' macro. Peval can | |
628 | now do simple beta-reductions of procedures with rest arguments. It | |
629 | also avoids residualizing degenerate lexical aliases, even when full | |
630 | inlining is not possible. Finally, peval now uses the effects analysis | |
631 | introduced for the CSE pass. More precise effects analysis allows peval | |
632 | to move more code. | |
633 | ||
634 | ** Run finalizers asynchronously in asyncs | |
635 | ||
636 | Finalizers are now run asynchronously, via an async. See Asyncs in the | |
637 | manual. This allows Guile and user code to safely allocate memory while | |
638 | holding a mutex. | |
639 | ||
640 | ** Update SRFI-14 character sets to Unicode 6.1 | |
641 | ||
642 | Note that this update causes the Latin-1 characters `§' and `¶' to be | |
643 | reclassified as punctuation. They were previously considered to be part | |
644 | of `char-set:symbol'. | |
645 | ||
646 | ** Better source information for datums | |
647 | ||
648 | When the `positions' reader option is on, as it is by default, Guile's | |
649 | reader will record source information for more kinds of datums. | |
650 | ||
651 | ** Improved error and warning messages | |
652 | ||
d7a33b64 LC |
653 | `syntax-violation' errors now prefer `subform' for source info, with |
654 | `form' as fallback. Syntactic errors in `cond' and `case' now produce | |
d2e35793 AW |
655 | better errors. `case' can now warn on duplicate datums, or datums that |
656 | cannot be usefully compared with `eqv?'. `-Warity-mismatch' now handles | |
657 | applicable structs. `-Wformat' is more robust in the presence of | |
658 | `gettext'. Finally, various exceptions thrown by the Web modules now | |
659 | define appropriate exception printers. | |
660 | ||
661 | ** A few important bug fixes in the HTTP modules. | |
662 | ||
663 | Guile's web server framework now checks if an application returns a body | |
d7a33b64 | 664 | where it is not permitted, for example in response to a HEAD request, |
d2e35793 AW |
665 | and warn or truncate the response as appropriate. Bad requests now |
666 | cause a 400 Bad Request response to be printed before closing the port. | |
667 | Finally, some date-printing and URL-parsing bugs were fixed. | |
668 | ||
669 | ** Pretty-print improvements | |
670 | ||
671 | When Guile needs to pretty-print Tree-IL, it will try to reconstruct | |
672 | `cond', `or`, and other derived syntax forms from the primitive tree-IL | |
673 | forms. It also uses the original names instead of the fresh unique | |
674 | names, when it is unambiguous to do so. This can be seen in the output | |
675 | of REPL commands like `,optimize'. | |
676 | ||
677 | Also, the `pretty-print' procedure has a new keyword argument, | |
678 | `#:max-expr-width'. | |
679 | ||
680 | ** Fix memory leak involving applicable SMOBs | |
681 | ||
682 | At some point in the 1.9.x series, Guile began leaking any applicable | |
683 | SMOB that was actually applied. (There was a weak-key map from SMOB to | |
684 | trampoline functions, where the value had a strong reference on the | |
685 | key.) This has been fixed. There was much rejoicing! | |
686 | ||
32299e49 AW |
687 | ** Support for HTTP/1.1 chunked transfer coding |
688 | ||
689 | See "Transfer Codings" in the manual, for more. | |
690 | ||
d2e35793 AW |
691 | ** Micro-optimizations |
692 | ||
693 | A pile of micro-optimizations: the `string-trim' function when called | |
694 | with `char-set:whitespace'; the `(web http)' parsers; SMOB application; | |
695 | conversion of raw UTF-8 and UTF-32 data to and from SCM strings; vlists | |
696 | and vhashes; `read' when processing string literals. | |
697 | ||
698 | ** Incompatible change to `scandir' | |
699 | ||
700 | As was the original intention, `scandir' now runs the `select?' | |
701 | procedure on all items, including subdirectories and the `.' and `..' | |
702 | entries. It receives the basename of the file in question instead of | |
703 | the full name. We apologize for this incompatible change to this | |
704 | function introduced in the 2.0.4 release. | |
705 | ||
706 | * Manual updates | |
707 | ||
708 | The manual has been made much more consistent in its naming conventions | |
709 | with regards to formal parameters of functions. Thanks to Bake Timmons. | |
710 | ||
711 | * New interfaces | |
712 | ||
713 | ** New C function: `scm_to_pointer' | |
32299e49 | 714 | ** New C inline functions: `scm_new_smob', `scm_new_double_smob' |
d2e35793 AW |
715 | ** (ice-9 format): Add ~h specifier for localized number output. |
716 | ** (web response): New procedure: `response-must-not-include-body?' | |
717 | ** New predicate: 'supports-source-properties?' | |
8898f43c | 718 | ** New C helpers: `scm_c_values', `scm_c_nvalues' |
d2e35793 AW |
719 | ** Newly public inline C function: `scm_unget_byte' |
720 | ** (language tree-il): New functions: `tree-il=?', `tree-il-hash' | |
721 | ** New fluid: `%default-port-conversion-strategy' | |
722 | ** New syntax: `=>' within `case' | |
32299e49 AW |
723 | ** (web http): `make-chunked-input-port', `make-chunked-output-port' |
724 | ** (web http): `declare-opaque-header!' | |
d2e35793 AW |
725 | |
726 | Search the manual for these identifiers, for more information. | |
727 | ||
728 | * New deprecations | |
729 | ||
730 | ** `close-io-port' deprecated | |
731 | ||
732 | Use `close-port'. | |
733 | ||
734 | ** `scm_sym2var' deprecated | |
735 | ||
736 | In most cases, replace with `scm_lookup' or `scm_module_variable'. Use | |
737 | `scm_define' or `scm_module_ensure_local_variable' if the second | |
738 | argument is nonzero. See "Accessing Modules from C" in the manual, for | |
739 | full details. | |
740 | ||
741 | ** Lookup closures deprecated | |
742 | ||
743 | These were never documented. See "Module System Reflection" in the | |
744 | manual for replacements. | |
745 | ||
746 | * Build fixes | |
747 | ||
748 | ** Fix compilation against uninstalled Guile on non-GNU platforms. | |
749 | ** Fix `SCM_I_ERROR' definition for MinGW without networking. | |
750 | ** Fix compilation with the Sun C compiler. | |
751 | ** Fix check for `clock_gettime' on OpenBSD and some other systems. | |
752 | ** Fix build with --enable-debug-malloc. | |
753 | ** Honor $(program_transform_name) for the `guile-tools' symlink. | |
754 | ** Fix cross-compilation of GOOPS-using code. | |
755 | ||
756 | * Bug fixes | |
757 | ||
758 | ** Fix use of unitialized stat buffer in search-path of absolute paths. | |
759 | ** Avoid calling `freelocale' with a NULL argument. | |
760 | ** Work around erroneous tr_TR locale in Darwin 8 in tests. | |
761 | ** Fix `getaddrinfo' test for Darwin 8. | |
762 | ** Use Gnulib's `regex' module for better regex portability. | |
763 | ** `source-properties' and friends work on any object | |
764 | ** Rewrite open-process in C, for robustness related to threads and fork | |
765 | ** Fix <TAG>vector-length when applied to other uniform vector types | |
766 | ** Fix escape-only prompt optimization (was disabled previously) | |
767 | ** Fix a segfault when /dev/urandom is not accessible | |
768 | ** Fix flush on soft ports, so that it actually runs. | |
769 | ** Better compatibility of SRFI-9 records with core records | |
770 | ** Fix and clarify documentation of `sorted?'. | |
771 | ** Fix IEEE-754 endianness conversion in bytevectors. | |
772 | ** Correct thunk check in the `wind' instruction. | |
773 | ** Add @acronym support to texinfo modules | |
774 | ** Fix docbook->texi for <ulink> without URL | |
775 | ** Fix `setvbuf' to leave the line/column number unchanged. | |
776 | ** Add missing public declaration for `scm_take_from_input_buffers'. | |
777 | ** Fix relative file name canonicalization with empty %LOAD-PATH entries. | |
778 | ** Import newer (ice-9 match) from Chibi-Scheme. | |
779 | ** Fix unbound variables and unbound values in ECMAScript runtime. | |
780 | ** Make SRFI-6 string ports Unicode-capable. | |
781 | ||
782 | \f | |
f7cf5898 LC |
783 | Changes in 2.0.5 (since 2.0.4): |
784 | ||
785 | This release fixes the binary interface information (SONAME) of | |
786 | libguile, which was incorrect in 2.0.4. It does not contain other | |
787 | changes. | |
788 | ||
789 | \f | |
f43622a2 AW |
790 | Changes in 2.0.4 (since 2.0.3): |
791 | ||
f41ef416 | 792 | * Notable changes |
f43622a2 | 793 | |
f41ef416 | 794 | ** Better debuggability for interpreted procedures. |
f43622a2 AW |
795 | |
796 | Guile 2.0 came with a great debugging experience for compiled | |
797 | procedures, but the story for interpreted procedures was terrible. Now, | |
486bd70d AW |
798 | at least, interpreted procedures have names, and the `arity' procedure |
799 | property is always correct (or, as correct as it can be, in the presence | |
800 | of `case-lambda'). | |
f43622a2 AW |
801 | |
802 | ** Support for cross-compilation. | |
803 | ||
804 | One can now use a native Guile to cross-compile `.go' files for a | |
805 | different architecture. See the documentation for `--target' in the | |
486bd70d AW |
806 | "Compilation" section of the manual, for information on how to use the |
807 | cross-compiler. See the "Cross building Guile" section of the README, | |
808 | for more on how to cross-compile Guile itself. | |
f43622a2 | 809 | |
d4b5c773 AW |
810 | ** The return of `local-eval'. |
811 | ||
812 | Back by popular demand, `the-environment' and `local-eval' allow the | |
813 | user to capture a lexical environment, and then evaluate arbitrary | |
814 | expressions in that context. There is also a new `local-compile' | |
815 | command. See "Local Evaluation" in the manual, for more. Special | |
816 | thanks to Mark Weaver for an initial implementation of this feature. | |
817 | ||
f43622a2 AW |
818 | ** Fluids can now have default values. |
819 | ||
820 | Fluids are used for dynamic and thread-local binding. They have always | |
821 | inherited their values from the context or thread that created them. | |
822 | However, there was a case in which a new thread would enter Guile, and | |
823 | the default values of all the fluids would be `#f' for that thread. | |
824 | ||
825 | This has now been fixed so that `make-fluid' has an optional default | |
486bd70d | 826 | value for fluids in unrelated dynamic roots, which defaults to `#f'. |
f43622a2 AW |
827 | |
828 | ** Garbage collector tuning. | |
829 | ||
830 | The garbage collector has now been tuned to run more often under some | |
831 | circumstances. | |
832 | ||
833 | *** Unmanaged allocation | |
834 | ||
835 | The new `scm_gc_register_allocation' function will notify the collector | |
836 | of unmanaged allocation. This will cause the collector to run sooner. | |
837 | Guile's `scm_malloc', `scm_calloc', and `scm_realloc' unmanaged | |
838 | allocators eventually call this function. This leads to better | |
839 | performance under steady-state unmanaged allocation. | |
840 | ||
841 | *** Transient allocation | |
842 | ||
843 | When the collector runs, it will try to record the total memory | |
844 | footprint of a process, if the platform supports this information. If | |
845 | the memory footprint is growing, the collector will run more frequently. | |
846 | This reduces the increase of the resident size of a process in response | |
847 | to a transient increase in allocation. | |
848 | ||
849 | *** Management of threads, bignums | |
850 | ||
851 | Creating a thread will allocate a fair amount of memory. Guile now does | |
852 | some GC work (using `GC_collect_a_little') when allocating a thread. | |
853 | This leads to a better memory footprint when creating many short-lived | |
854 | threads. | |
855 | ||
856 | Similarly, bignums can occupy a lot of memory. Guile now offers hooks | |
857 | to enable custom GMP allocators that end up calling | |
486bd70d | 858 | `scm_gc_register_allocation'. These allocators are enabled by default |
f43622a2 AW |
859 | when running Guile from the command-line. To enable them in libraries, |
860 | set the `scm_install_gmp_memory_functions' variable to a nonzero value | |
861 | before loading Guile. | |
862 | ||
f43622a2 AW |
863 | ** SRFI-39 parameters are available by default. |
864 | ||
f41ef416 AW |
865 | Guile now includes support for parameters, as defined by SRFI-39, in the |
866 | default environment. See "Parameters" in the manual, for more | |
867 | information. `current-input-port', `current-output-port', and | |
868 | `current-error-port' are now parameters. | |
f43622a2 | 869 | |
d4b5c773 | 870 | ** Add `current-warning-port'. |
f43622a2 | 871 | |
f41ef416 AW |
872 | Guile now outputs warnings on a separate port, `current-warning-port', |
873 | initialized to the value that `current-error-port' has on startup. | |
f43622a2 | 874 | |
f41ef416 | 875 | ** Syntax parameters. |
f43622a2 | 876 | |
f41ef416 AW |
877 | Following Racket's lead, Guile now supports syntax parameters. See |
878 | "Syntax parameters" in the manual, for more. | |
f43622a2 | 879 | |
f41ef416 AW |
880 | Also see Barzilay, Culpepper, and Flatt's 2011 SFP workshop paper, |
881 | "Keeping it Clean with syntax-parameterize". | |
f43622a2 | 882 | |
f41ef416 | 883 | ** Parse command-line arguments from the locale encoding. |
f43622a2 | 884 | |
f41ef416 AW |
885 | Guile now attempts to parse command-line arguments using the user's |
886 | locale. However for backwards compatibility with other 2.0.x releases, | |
887 | it does so without actually calling `setlocale'. Please report any bugs | |
888 | in this facility to bug-guile@gnu.org. | |
f43622a2 | 889 | |
d4b5c773 AW |
890 | ** One-armed conditionals: `when' and `unless' |
891 | ||
892 | Guile finally has `when' and `unless' in the default environment. Use | |
893 | them whenever you would use an `if' with only one branch. See | |
894 | "Conditionals" in the manual, for more. | |
895 | ||
896 | ** `current-filename', `add-to-load-path' | |
897 | ||
898 | There is a new form, `(current-filename)', which expands out to the | |
899 | source file in which it occurs. Combined with the new | |
900 | `add-to-load-path', this allows simple scripts to easily add nearby | |
901 | directories to the load path. See "Load Paths" in the manual, for more. | |
902 | ||
903 | ** `random-state-from-platform' | |
904 | ||
905 | This procedure initializes a random seed using good random sources | |
906 | available on your platform, such as /dev/urandom. See "Random Number | |
907 | Generation" in the manual, for more. | |
908 | ||
7cb11224 LC |
909 | ** Warn about unsupported `simple-format' options. |
910 | ||
911 | The `-Wformat' compilation option now reports unsupported format options | |
912 | passed to `simple-format'. | |
913 | ||
241247e8 AW |
914 | ** Manual updates |
915 | ||
916 | Besides the sections already mentioned, the following manual sections | |
917 | are new in this release: "Modules and the File System", "Module System | |
918 | Reflection", "Syntax Transformer Helpers", and "Local Inclusion". | |
919 | ||
f41ef416 AW |
920 | * New interfaces |
921 | ||
922 | ** (ice-9 session): `apropos-hook' | |
923 | ** New print option: `escape-newlines', defaults to #t. | |
924 | ** (ice-9 ftw): `file-system-fold', `file-system-tree', `scandir' | |
d4b5c773 | 925 | ** `scm_c_value_ref': access to multiple returned values from C |
07c2ca0f | 926 | ** scm_call (a varargs version), scm_call_7, scm_call_8, scm_call_9 |
d4b5c773 AW |
927 | ** Some new syntax helpers in (system syntax) |
928 | ||
929 | Search the manual for these identifiers and modules, for more. | |
930 | ||
931 | * Build fixes | |
932 | ||
933 | ** FreeBSD build fixes. | |
934 | ** OpenBSD compilation fixes. | |
935 | ** Solaris 2.10 test suite fixes. | |
936 | ** IA64 compilation fix. | |
937 | ** MinGW build fixes. | |
938 | ** Work around instruction reordering on SPARC and HPPA in the VM. | |
939 | ** Gnulib updates: added `dirfd', `setenv' modules. | |
f43622a2 | 940 | |
f43622a2 AW |
941 | * Bug fixes |
942 | ||
d4b5c773 AW |
943 | ** Add a deprecated alias for $expt. |
944 | ** Add an exception printer for `getaddrinfo-error'. | |
945 | ** Add deprecated shim for `scm_display_error' with stack as first argument. | |
946 | ** Add warnings for unsupported `simple-format' options. | |
947 | ** Allow overlapping regions to be passed to `bytevector-copy!'. | |
d4b5c773 AW |
948 | ** Better function prologue disassembly |
949 | ** Compiler: fix miscompilation of (values foo ...) in some contexts. | |
950 | ** Compiler: fix serialization of #nil-terminated lists. | |
951 | ** Compiler: allow values bound in non-tail let expressions to be collected. | |
952 | ** Deprecate SCM_ASRTGO. | |
953 | ** Document invalidity of (begin) as expression; add back-compat shim. | |
954 | ** Don't leak file descriptors when mmaping objcode. | |
955 | ** Empty substrings no longer reference the original stringbuf. | |
956 | ** FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged. | |
f43622a2 | 957 | ** FFI: Hold a weak reference to the CIF made by `procedure->pointer'. |
f41ef416 AW |
958 | ** FFI: Hold a weak reference to the procedure passed to `procedure->pointer'. |
959 | ** FFI: Properly unpack small integer return values in closure call. | |
d4b5c773 | 960 | ** Fix R6RS `fold-left' so the accumulator is the first argument. |
d4b5c773 AW |
961 | ** Fix bit-set*! bug from 2005. |
962 | ** Fix bug in `make-repl' when `lang' is actually a <language>. | |
963 | ** Fix bugs related to mutation, the null string, and shared substrings. | |
964 | ** Fix <dynwind> serialization. | |
965 | ** Fix erroneous check in `set-procedure-properties!'. | |
966 | ** Fix generalized-vector-{ref,set!} for slices. | |
40e92f09 | 967 | ** Fix error messages involving definition forms. |
adb8054c | 968 | ** Fix primitive-eval to return #<unspecified> for definitions. |
f41ef416 | 969 | ** HTTP: Extend handling of "Cache-Control" header. |
f43622a2 | 970 | ** HTTP: Fix qstring writing of cache-extension values |
d4b5c773 | 971 | ** HTTP: Fix validators for various list-style headers. |
f41ef416 | 972 | ** HTTP: Permit non-date values for Expires header. |
d4b5c773 AW |
973 | ** HTTP: `write-request-line' writes absolute paths, not absolute URIs. |
974 | ** Hack the port-column of current-output-port after printing a prompt. | |
d4b5c773 AW |
975 | ** Make sure `regexp-quote' tests use Unicode-capable string ports. |
976 | ** Peval: Fix bugs in the new optimizer. | |
d4b5c773 AW |
977 | ** Statistically unique marks and labels, for robust hygiene across sessions. |
978 | ** Web: Allow URIs with empty authorities, like "file:///etc/hosts". | |
979 | ** `,language' at REPL sets the current-language fluid. | |
980 | ** `primitive-load' returns the value(s) of the last expression. | |
f41ef416 | 981 | ** `scm_from_stringn' always returns unique strings. |
f41ef416 | 982 | ** `scm_i_substring_copy' tries to narrow the substring. |
d4b5c773 | 983 | ** i18n: Fix gc_malloc/free mismatch on non-GNU systems. |
f43622a2 | 984 | |
7cb11224 | 985 | \f |
02f91898 AW |
986 | Changes in 2.0.3 (since 2.0.2): |
987 | ||
988 | * Speed improvements | |
989 | ||
990 | ** Guile has a new optimizer, `peval'. | |
991 | ||
992 | `Peval' is a partial evaluator that performs constant folding, dead code | |
993 | elimination, copy propagation, and inlining. By default it runs on | |
994 | every piece of code that Guile compiles, to fold computations that can | |
995 | happen at compile-time, so they don't have to happen at runtime. | |
996 | ||
997 | If we did our job right, the only impact you would see would be your | |
998 | programs getting faster. But if you notice slowdowns or bloated code, | |
999 | please send a mail to bug-guile@gnu.org with details. | |
1000 | ||
1001 | Thanks to William R. Cook, Oscar Waddell, and Kent Dybvig for inspiring | |
1002 | peval and its implementation. | |
1003 | ||
1004 | You can see what peval does on a given piece of code by running the new | |
1005 | `,optimize' REPL meta-command, and comparing it to the output of | |
1006 | `,expand'. See "Compile Commands" in the manual, for more. | |
1007 | ||
1008 | ** Fewer calls to `stat'. | |
1009 | ||
1010 | Guile now stats only the .go file and the .scm file when loading a fresh | |
1011 | compiled file. | |
1012 | ||
1013 | * Notable changes | |
1014 | ||
1015 | ** New module: `(web client)', a simple synchronous web client. | |
1016 | ||
1017 | See "Web Client" in the manual, for more. | |
1018 | ||
1019 | ** Users can now install compiled `.go' files. | |
1020 | ||
1021 | See "Installing Site Packages" in the manual. | |
1022 | ||
1023 | ** Remove Front-Cover and Back-Cover text from the manual. | |
1024 | ||
1025 | The manual is still under the GNU Free Documentation License, but no | |
1026 | longer has any invariant sections. | |
1027 | ||
1028 | ** More helpful `guild help'. | |
1029 | ||
1030 | `guild' is Guile's multi-tool, for use in shell scripting. Now it has a | |
1031 | nicer interface for querying the set of existing commands, and getting | |
1032 | help on those commands. Try it out and see! | |
1033 | ||
1034 | ** New macro: `define-syntax-rule' | |
1035 | ||
1036 | `define-syntax-rule' is a shorthand to make a `syntax-rules' macro with | |
1037 | one clause. See "Syntax Rules" in the manual, for more. | |
1038 | ||
1039 | ** The `,time' REPL meta-command now has more precision. | |
1040 | ||
1041 | The output of this command now has microsecond precision, instead of | |
1042 | 10-millisecond precision. | |
1043 | ||
1044 | ** `(ice-9 match)' can now match records. | |
1045 | ||
1046 | See "Pattern Matching" in the manual, for more on matching records. | |
1047 | ||
1048 | ** New module: `(language tree-il debug)'. | |
1049 | ||
1050 | This module provides a tree-il verifier. This is useful for people that | |
1051 | generate tree-il, usually as part of a language compiler. | |
1052 | ||
1053 | ** New functions: `scm_is_exact', `scm_is_inexact'. | |
1054 | ||
1055 | These provide a nice C interface for Scheme's `exact?' and `inexact?', | |
1056 | respectively. | |
1057 | ||
1058 | * Bugs fixed | |
1059 | ||
1060 | See the git log (or the ChangeLog) for more details on these bugs. | |
1061 | ||
1062 | ** Fix order of importing modules and resolving duplicates handlers. | |
1063 | ** Fix a number of bugs involving extended (merged) generics. | |
1064 | ** Fix invocation of merge-generics duplicate handler. | |
1065 | ** Fix write beyond array end in arrays.c. | |
1066 | ** Fix read beyond end of hashtable size array in hashtab.c. | |
1067 | ** (web http): Locale-independent parsing and serialization of dates. | |
1068 | ** Ensure presence of Host header in HTTP/1.1 requests. | |
1069 | ** Fix take-right and drop-right for improper lists. | |
1070 | ** Fix leak in get_current_locale(). | |
1071 | ** Fix recursive define-inlinable expansions. | |
1072 | ** Check that srfi-1 procedure arguments are procedures. | |
1073 | ** Fix r6rs `map' for multiple returns. | |
1074 | ** Fix scm_tmpfile leak on POSIX platforms. | |
1075 | ** Fix a couple of leaks (objcode->bytecode, make-boot-program). | |
1076 | ** Fix guile-lib back-compatibility for module-stexi-documentation. | |
1077 | ** Fix --listen option to allow other ports. | |
1078 | ** Fix scm_to_latin1_stringn for substrings. | |
1079 | ** Fix compilation of untyped arrays of rank not 1. | |
1080 | ** Fix unparse-tree-il of <dynset>. | |
1081 | ** Fix reading of #||||#. | |
2be3feb1 LC |
1082 | ** Fix segfault in GOOPS when class fields are redefined. |
1083 | ** Prefer poll(2) over select(2) to allow file descriptors above FD_SETSIZE. | |
02f91898 AW |
1084 | |
1085 | \f | |
e4a2807e AW |
1086 | Changes in 2.0.2 (since 2.0.1): |
1087 | ||
1088 | * Notable changes | |
1089 | ||
2dd49486 AW |
1090 | ** `guile-tools' renamed to `guild' |
1091 | ||
1092 | The new name is shorter. Its intended future use is for a CPAN-like | |
1093 | system for Guile wizards and journeyfolk to band together to share code; | |
1094 | hence the name. `guile-tools' is provided as a backward-compatible | |
1095 | symbolic link. See "Using Guile Tools" in the manual, for more. | |
1096 | ||
e4a2807e AW |
1097 | ** New control operators: `shift' and `reset' |
1098 | ||
1099 | See "Shift and Reset" in the manual, for more information. | |
1100 | ||
1101 | ** `while' as an expression | |
1102 | ||
1103 | Previously the return value of `while' was unspecified. Now its | |
1104 | values are specified both in the case of normal termination, and via | |
1105 | termination by invoking `break', possibly with arguments. See "while | |
1106 | do" in the manual for more. | |
1107 | ||
1108 | ** Disallow access to handles of weak hash tables | |
1109 | ||
1110 | `hash-get-handle' and `hash-create-handle!' are no longer permitted to | |
1111 | be called on weak hash tables, because the fields in a weak handle could | |
1112 | be nulled out by the garbage collector at any time, but yet they are | |
1113 | otherwise indistinguishable from pairs. Use `hash-ref' and `hash-set!' | |
1114 | instead. | |
1115 | ||
1116 | ** More precision for `get-internal-run-time', `get-internal-real-time' | |
1117 | ||
1118 | On 64-bit systems which support POSIX clocks, Guile's internal timing | |
1119 | procedures offer nanosecond resolution instead of the 10-millisecond | |
1120 | resolution previously available. 32-bit systems now use 1-millisecond | |
1121 | timers. | |
1122 | ||
1123 | ** Guile now measures time spent in GC | |
1124 | ||
1125 | `gc-stats' now returns a meaningful value for `gc-time-taken'. | |
1126 | ||
1127 | ** Add `gcprof' | |
1128 | ||
1129 | The statprof profiler now exports a `gcprof' procedure, driven by the | |
1130 | `after-gc-hook', to see which parts of your program are causing GC. Let | |
1131 | us know if you find it useful. | |
1132 | ||
1133 | ** `map', `for-each' and some others now implemented in Scheme | |
1134 | ||
1135 | We would not mention this in NEWS, as it is not a user-visible change, | |
1136 | if it were not for one thing: `map' and `for-each' are no longer | |
1137 | primitive generics. Instead they are normal bindings, which can be | |
1138 | wrapped by normal generics. This fixes some modularity issues between | |
1139 | core `map', SRFI-1 `map', and GOOPS. | |
1140 | ||
1141 | Also it's pretty cool that we can do this without a performance impact. | |
1142 | ||
1143 | ** Add `scm_peek_byte_or_eof'. | |
1144 | ||
1145 | This helper is like `scm_peek_char_or_eof', but for bytes instead of | |
1146 | full characters. | |
1147 | ||
1148 | ** Implement #:stop-at-first-non-option option for getopt-long | |
1149 | ||
1150 | See "getopt-long Reference" in the manual, for more information. | |
1151 | ||
1152 | ** Improve R6RS conformance for conditions in the I/O libraries | |
1153 | ||
1154 | The `(rnrs io simple)' module now raises the correct R6RS conditions in | |
1155 | error cases. `(rnrs io ports)' is also more correct now, though it is | |
1156 | still a work in progress. | |
1157 | ||
1158 | ** All deprecated routines emit warnings | |
1159 | ||
1160 | A few deprecated routines were lacking deprecation warnings. This has | |
1161 | been fixed now. | |
1162 | ||
1163 | * Speed improvements | |
1164 | ||
1165 | ** Constants in compiled code now share state better | |
1166 | ||
1167 | Constants with shared state, like `("foo")' and `"foo"', now share state | |
1168 | as much as possible, in the entire compilation unit. This cuts compiled | |
1169 | `.go' file sizes in half, generally, and speeds startup. | |
1170 | ||
1171 | ** VLists: optimize `vlist-fold-right', and add `vhash-fold-right' | |
1172 | ||
1173 | These procedures are now twice as fast as they were. | |
1174 | ||
1175 | ** UTF-8 ports to bypass `iconv' entirely | |
1176 | ||
1177 | This reduces memory usage in a very common case. | |
1178 | ||
1179 | ** Compiler speedups | |
1180 | ||
1181 | The compiler is now about 40% faster. (Note that this is only the case | |
1182 | once the compiler is itself compiled, so the build still takes as long | |
1183 | as it did before.) | |
1184 | ||
1185 | ** VM speed tuning | |
1186 | ||
1187 | Some assertions that were mostly useful for sanity-checks on the | |
1188 | bytecode compiler are now off for both "regular" and "debug" engines. | |
1189 | This together with a fix to cache a TLS access and some other tweaks | |
1190 | improve the VM's performance by about 20%. | |
1191 | ||
1192 | ** SRFI-1 list-set optimizations | |
1193 | ||
1194 | lset-adjoin and lset-union now have fast paths for eq? sets. | |
1195 | ||
1196 | ** `memq', `memv' optimizations | |
1197 | ||
1198 | These procedures are now at least twice as fast than in 2.0.1. | |
1199 | ||
1200 | * Deprecations | |
1201 | ||
1202 | ** Deprecate scm_whash API | |
1203 | ||
1204 | `scm_whash_get_handle', `SCM_WHASHFOUNDP', `SCM_WHASHREF', | |
1205 | `SCM_WHASHSET', `scm_whash_create_handle', `scm_whash_lookup', and | |
1206 | `scm_whash_insert' are now deprecated. Use the normal hash table API | |
1207 | instead. | |
1208 | ||
1209 | ** Deprecate scm_struct_table | |
1210 | ||
1211 | `SCM_STRUCT_TABLE_NAME', `SCM_SET_STRUCT_TABLE_NAME', | |
1212 | `SCM_STRUCT_TABLE_CLASS', `SCM_SET_STRUCT_TABLE_CLASS', | |
1213 | `scm_struct_table', and `scm_struct_create_handle' are now deprecated. | |
1214 | These routines formed part of the internals of the map between structs | |
1215 | and classes. | |
1216 | ||
1217 | ** Deprecate scm_internal_dynamic_wind | |
1218 | ||
1219 | The `scm_t_inner' type and `scm_internal_dynamic_wind' are deprecated, | |
1220 | as the `scm_dynwind' API is better, and this API encourages users to | |
1221 | stuff SCM values into pointers. | |
1222 | ||
1223 | ** Deprecate scm_immutable_cell, scm_immutable_double_cell | |
1224 | ||
1225 | These routines are deprecated, as the GC_STUBBORN API doesn't do | |
1226 | anything any more. | |
1227 | ||
1228 | * Manual updates | |
1229 | ||
1230 | Andreas Rottman kindly transcribed the missing parts of the `(rnrs io | |
1231 | ports)' documentation from the R6RS documentation. Thanks Andreas! | |
1232 | ||
1233 | * Bugs fixed | |
1234 | ||
1235 | ** Fix double-loading of script in -ds case | |
1236 | ** -x error message fix | |
1237 | ** iconveh-related cross-compilation fixes | |
1238 | ** Fix small integer return value packing on big endian machines. | |
1239 | ** Fix hash-set! in weak-value table from non-immediate to immediate | |
1240 | ** Fix call-with-input-file & relatives for multiple values | |
1241 | ** Fix `hash' for inf and nan | |
1242 | ** Fix libguile internal type errors caught by typing-strictness==2 | |
f39779b1 LC |
1243 | ** Fix compile error in MinGW fstat socket detection |
1244 | ** Fix generation of auto-compiled file names on MinGW | |
e4a2807e AW |
1245 | ** Fix multithreaded access to internal hash tables |
1246 | ** Emit a 1-based line number in error messages | |
1247 | ** Fix define-module ordering | |
7505c6e0 | 1248 | ** Fix several POSIX functions to use the locale encoding |
f39779b1 LC |
1249 | ** Add type and range checks to the complex generalized vector accessors |
1250 | ** Fix unaligned accesses for bytevectors of complex numbers | |
1251 | ** Fix '(a #{.} b) | |
1252 | ** Fix erroneous VM stack overflow for canceled threads | |
e4a2807e AW |
1253 | |
1254 | \f | |
882c8963 MW |
1255 | Changes in 2.0.1 (since 2.0.0): |
1256 | ||
7c81eba2 | 1257 | * Notable changes |
9d6a151f | 1258 | |
7c81eba2 | 1259 | ** guile.m4 supports linking with rpath |
9d6a151f | 1260 | |
7c81eba2 AW |
1261 | The GUILE_FLAGS macro now sets GUILE_LIBS and GUILE_LTLIBS, which |
1262 | include appropriate directives to the linker to include libguile-2.0.so | |
1263 | in the runtime library lookup path. | |
9d6a151f | 1264 | |
7c81eba2 | 1265 | ** `begin' expands macros in its body before other expressions |
9d6a151f | 1266 | |
7c81eba2 | 1267 | This enables support for programs like the following: |
9d6a151f | 1268 | |
7c81eba2 AW |
1269 | (begin |
1270 | (define even? | |
1271 | (lambda (x) | |
1272 | (or (= x 0) (odd? (- x 1))))) | |
1273 | (define-syntax odd? | |
1274 | (syntax-rules () | |
1275 | ((odd? x) (not (even? x))))) | |
1276 | (even? 10)) | |
9d6a151f | 1277 | |
7c81eba2 | 1278 | ** REPL reader usability enhancements |
9d6a151f | 1279 | |
7c81eba2 AW |
1280 | The REPL now flushes input after a read error, which should prevent one |
1281 | error from causing other errors. The REPL also now interprets comments | |
1282 | as whitespace. | |
9d6a151f | 1283 | |
7c81eba2 | 1284 | ** REPL output has configurable width |
9d6a151f | 1285 | |
7c81eba2 AW |
1286 | The REPL now defaults to output with the current terminal's width, in |
1287 | columns. See "Debug Commands" in the manual for more information on | |
1288 | the ,width command. | |
9d6a151f | 1289 | |
7c81eba2 | 1290 | ** Better C access to the module system |
9d6a151f | 1291 | |
7c81eba2 AW |
1292 | Guile now has convenient C accessors to look up variables or values in |
1293 | modules and their public interfaces. See `scm_c_public_ref' and friends | |
1294 | in "Accessing Modules from C" in the manual. | |
9d6a151f | 1295 | |
7c81eba2 | 1296 | ** Added `scm_call_5', `scm_call_6' |
9d6a151f | 1297 | |
7c81eba2 | 1298 | See "Fly Evaluation" in the manual. |
9d6a151f | 1299 | |
7c81eba2 | 1300 | ** Added `scm_from_latin1_keyword', `scm_from_utf8_keyword' |
9d6a151f | 1301 | |
7c81eba2 AW |
1302 | See "Keyword Procedures" in the manual, for more. Note that |
1303 | `scm_from_locale_keyword' should not be used when the name is a C string | |
1304 | constant. | |
9d6a151f | 1305 | |
7c81eba2 | 1306 | ** R6RS unicode and string I/O work |
9d6a151f | 1307 | |
7c81eba2 AW |
1308 | Added efficient implementations of `get-string-n' and `get-string-n!' |
1309 | for binary ports. Exported `current-input-port', `current-output-port' | |
1310 | and `current-error-port' from `(rnrs io ports)', and enhanced support | |
1311 | for transcoders. | |
9d6a151f | 1312 | |
7c81eba2 | 1313 | ** Added `pointer->scm', `scm->pointer' to `(system foreign)' |
9d6a151f | 1314 | |
7c81eba2 AW |
1315 | These procedure are useful if one needs to pass and receive SCM values |
1316 | to and from foreign functions. See "Foreign Variables" in the manual, | |
1317 | for more. | |
9d6a151f | 1318 | |
7c81eba2 | 1319 | ** Added `heap-allocated-since-gc' to `(gc-stats)' |
9d6a151f | 1320 | |
7c81eba2 | 1321 | Also fixed the long-standing bug in the REPL `,stat' command. |
9d6a151f | 1322 | |
7c81eba2 | 1323 | ** Add `on-error' REPL option |
9d6a151f | 1324 | |
7c81eba2 AW |
1325 | This option controls what happens when an error occurs at the REPL, and |
1326 | defaults to `debug', indicating that Guile should enter the debugger. | |
1327 | Other values include `report', which will simply print a backtrace | |
1328 | without entering the debugger. See "System Commands" in the manual. | |
9d6a151f | 1329 | |
7c81eba2 | 1330 | ** Enforce immutability of string literals |
9d6a151f | 1331 | |
7c81eba2 | 1332 | Attempting to mutate a string literal now causes a runtime error. |
9d6a151f | 1333 | |
7c81eba2 | 1334 | ** Fix pthread redirection |
9d6a151f | 1335 | |
7c81eba2 AW |
1336 | Guile 2.0.0 shipped with headers that, if configured with pthread |
1337 | support, would re-define `pthread_create', `pthread_join', and other API | |
1338 | to redirect to the BDW-GC wrappers, `GC_pthread_create', etc. This was | |
1339 | unintended, and not necessary: because threads must enter Guile with | |
2e6829d2 | 1340 | `scm_with_guile', Guile can handle thread registration itself, without |
7c81eba2 AW |
1341 | needing to make the GC aware of all threads. This oversight has been |
1342 | fixed. | |
9d6a151f | 1343 | |
7c81eba2 | 1344 | ** `with-continuation-barrier' now unwinds on `quit' |
9d6a151f | 1345 | |
7c81eba2 AW |
1346 | A throw to `quit' in a continuation barrier will cause Guile to exit. |
1347 | Before, it would do so before unwinding to the barrier, which would | |
1348 | prevent cleanup handlers from running. This has been fixed so that it | |
1349 | exits only after unwinding. | |
9d6a151f | 1350 | |
7c81eba2 | 1351 | ** `string->pointer' and `pointer->string' have optional encoding arg |
9d6a151f | 1352 | |
7c81eba2 AW |
1353 | This allows users of the FFI to more easily deal in strings with |
1354 | particular (non-locale) encodings, like "utf-8". See "Void Pointers and | |
1355 | Byte Access" in the manual, for more. | |
9d6a151f | 1356 | |
7c81eba2 | 1357 | ** R6RS fixnum arithmetic optimizations |
9d6a151f | 1358 | |
7c81eba2 AW |
1359 | R6RS fixnum operations are are still slower than generic arithmetic, |
1360 | however. | |
9d6a151f | 1361 | |
7c81eba2 | 1362 | ** New procedure: `define-inlinable' |
9d6a151f | 1363 | |
7c81eba2 | 1364 | See "Inlinable Procedures" in the manual, for more. |
9d6a151f | 1365 | |
7c81eba2 | 1366 | ** New procedure: `exact-integer-sqrt' |
9d6a151f | 1367 | |
7c81eba2 | 1368 | See "Integer Operations" in the manual, for more. |
9d6a151f | 1369 | |
7c81eba2 | 1370 | ** "Extended read syntax" for symbols parses better |
9d6a151f | 1371 | |
7c81eba2 AW |
1372 | In #{foo}# symbols, backslashes are now treated as escapes, as the |
1373 | symbol-printing code intended. Additionally, "\x" within #{foo}# is now | |
1374 | interpreted as starting an R6RS hex escape. This is backward compatible | |
1375 | because the symbol printer would never produce a "\x" before. The | |
1376 | printer also works better too. | |
9d6a151f | 1377 | |
6b480ced | 1378 | ** Added `--fresh-auto-compile' option |
1e56cff2 AW |
1379 | |
1380 | This allows a user to invalidate the auto-compilation cache. It's | |
1381 | usually not needed. See "Compilation" in the manual, for a discussion. | |
1382 | ||
7c81eba2 | 1383 | * Manual updates |
9d6a151f | 1384 | |
7c81eba2 | 1385 | ** GOOPS documentation updates |
9d6a151f | 1386 | |
7c81eba2 | 1387 | ** New man page |
9d6a151f | 1388 | |
7c81eba2 | 1389 | Thanks to Mark Harig for improvements to guile.1. |
9d6a151f | 1390 | |
7c81eba2 | 1391 | ** SRFI-23 documented |
9d6a151f | 1392 | |
7c81eba2 | 1393 | The humble `error' SRFI now has an entry in the manual. |
9d6a151f | 1394 | |
7c81eba2 | 1395 | * New modules |
9d6a151f | 1396 | |
de424d95 | 1397 | ** `(ice-9 binary-ports)': "R6RS I/O Ports", in the manual |
7c81eba2 | 1398 | ** `(ice-9 eval-string)': "Fly Evaluation", in the manual |
2e6829d2 | 1399 | ** `(ice-9 command-line)', not documented yet |
9d6a151f | 1400 | |
882c8963 MW |
1401 | * Bugs fixed |
1402 | ||
2e6829d2 | 1403 | ** Fixed `iconv_t' memory leak on close-port |
7c81eba2 AW |
1404 | ** Fixed some leaks with weak hash tables |
1405 | ** Export `vhash-delq' and `vhash-delv' from `(ice-9 vlist)' | |
1406 | ** `after-gc-hook' works again | |
1407 | ** `define-record-type' now allowed in nested contexts | |
1408 | ** `exact-integer-sqrt' now handles large integers correctly | |
1409 | ** Fixed C extension examples in manual | |
1410 | ** `vhash-delete' honors HASH argument | |
1411 | ** Make `locale-digit-grouping' more robust | |
1412 | ** Default exception printer robustness fixes | |
1413 | ** Fix presence of non-I CPPFLAGS in `guile-2.0.pc' | |
1414 | ** `read' updates line/column numbers when reading SCSH block comments | |
1415 | ** Fix imports of multiple custom interfaces of same module | |
1416 | ** Fix encoding scanning for non-seekable ports | |
1417 | ** Fix `setter' when called with a non-setter generic | |
1418 | ** Fix f32 and f64 bytevectors to not accept rationals | |
1419 | ** Fix description of the R6RS `finite?' in manual | |
1420 | ** Quotient, remainder and modulo accept inexact integers again | |
1421 | ** Fix `continue' within `while' to take zero arguments | |
1422 | ** Fix alignment for structures in FFI | |
1423 | ** Fix port-filename of stdin, stdout, stderr to match the docs | |
1424 | ** Fix weak hash table-related bug in `define-wrapped-pointer-type' | |
1425 | ** Fix partial continuation application with pending procedure calls | |
1426 | ** scm_{to,from}_locale_string use current locale, not current ports | |
1427 | ** Fix thread cleanup, by using a pthread_key destructor | |
1428 | ** Fix `quit' at the REPL | |
1429 | ** Fix a failure to sync regs in vm bytevector ops | |
1430 | ** Fix (texinfo reflection) to handle nested structures like syntax patterns | |
1431 | ** Fix stexi->html double translation | |
1432 | ** Fix tree-il->scheme fix for <prompt> | |
1433 | ** Fix compilation of <prompt> in <fix> in single-value context | |
1434 | ** Fix race condition in ensure-writable-dir | |
1435 | ** Fix error message on ,disassemble "non-procedure" | |
1436 | ** Fix prompt and abort with the boot evaluator | |
1437 | ** Fix `procedure->pointer' for functions returning `void' | |
1438 | ** Fix error reporting in dynamic-pointer | |
1439 | ** Fix problems detecting coding: in block comments | |
1440 | ** Fix duplicate load-path and load-compiled-path in compilation environment | |
1441 | ** Add fallback read(2) suppport for .go files if mmap(2) unavailable | |
1442 | ** Fix c32vector-set!, c64vector-set! | |
1443 | ** Fix mistakenly deprecated read syntax for uniform complex vectors | |
1444 | ** Fix parsing of exact numbers with negative exponents | |
1445 | ** Ignore SIGPIPE in (system repl server) | |
1446 | ** Fix optional second arg to R6RS log function | |
1447 | ** Fix R6RS `assert' to return true value. | |
1448 | ** Fix fencepost error when seeking in bytevector input ports | |
2e6829d2 LC |
1449 | ** Gracefully handle `setlocale' errors when starting the REPL |
1450 | ** Improve support of the `--disable-posix' configure option | |
1451 | ** Make sure R6RS binary ports pass `binary-port?' regardless of the locale | |
1452 | ** Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert' | |
882c8963 | 1453 | |
882c8963 MW |
1454 | |
1455 | \f | |
d9f46472 | 1456 | Changes in 2.0.0 (changes since the 1.8.x series): |
96b73e84 AW |
1457 | |
1458 | * New modules (see the manual for details) | |
1459 | ||
1460 | ** `(srfi srfi-18)', more sophisticated multithreading support | |
ef6b0e8d | 1461 | ** `(srfi srfi-27)', sources of random bits |
7cd99cba | 1462 | ** `(srfi srfi-38)', External Representation for Data With Shared Structure |
ef6b0e8d AW |
1463 | ** `(srfi srfi-42)', eager comprehensions |
1464 | ** `(srfi srfi-45)', primitives for expressing iterative lazy algorithms | |
1465 | ** `(srfi srfi-67)', compare procedures | |
96b73e84 | 1466 | ** `(ice-9 i18n)', internationalization support |
7cd99cba | 1467 | ** `(ice-9 futures)', fine-grain parallelism |
0f13fcde | 1468 | ** `(rnrs bytevectors)', the R6RS bytevector API |
93617170 | 1469 | ** `(rnrs io ports)', a subset of the R6RS I/O port API |
96b73e84 | 1470 | ** `(system xref)', a cross-referencing facility (FIXME undocumented) |
dbd9532e | 1471 | ** `(ice-9 vlist)', lists with constant-time random access; hash lists |
fb53c347 | 1472 | ** `(system foreign)', foreign function interface |
18e90860 AW |
1473 | ** `(sxml match)', a pattern matcher for SXML |
1474 | ** `(srfi srfi-9 gnu)', extensions to the SRFI-9 record library | |
1475 | ** `(system vm coverage)', a line-by-line code coverage library | |
7cd99cba AW |
1476 | ** `(web uri)', URI data type, parser, and unparser |
1477 | ** `(web http)', HTTP header parsers and unparsers | |
1478 | ** `(web request)', HTTP request data type, reader, and writer | |
1479 | ** `(web response)', HTTP response data type, reader, and writer | |
1480 | ** `(web server)', Generic HTTP server | |
1481 | ** `(ice-9 poll)', a poll wrapper | |
1482 | ** `(web server http)', HTTP-over-TCP web server implementation | |
66ad445d | 1483 | |
51cb0cca AW |
1484 | ** Replaced `(ice-9 match)' with Alex Shinn's compatible, hygienic matcher. |
1485 | ||
1486 | Guile's copy of Andrew K. Wright's `match' library has been replaced by | |
1487 | a compatible hygienic implementation by Alex Shinn. It is now | |
1488 | documented, see "Pattern Matching" in the manual. | |
1489 | ||
1490 | Compared to Andrew K. Wright's `match', the new `match' lacks | |
1491 | `match-define', `match:error-control', `match:set-error-control', | |
1492 | `match:error', `match:set-error', and all structure-related procedures. | |
1493 | ||
cf8ec359 AW |
1494 | ** Imported statprof, SSAX, and texinfo modules from Guile-Lib |
1495 | ||
1496 | The statprof statistical profiler, the SSAX XML toolkit, and the texinfo | |
1497 | toolkit from Guile-Lib have been imported into Guile proper. See | |
1498 | "Standard Library" in the manual for more details. | |
1499 | ||
139fa149 AW |
1500 | ** Integration of lalr-scm, a parser generator |
1501 | ||
1502 | Guile has included Dominique Boucher's fine `lalr-scm' parser generator | |
1503 | as `(system base lalr)'. See "LALR(1) Parsing" in the manual, for more | |
1504 | information. | |
1505 | ||
96b73e84 AW |
1506 | * Changes to the stand-alone interpreter |
1507 | ||
1508 | ** Guile now can compile Scheme to bytecode for a custom virtual machine. | |
1509 | ||
1510 | Compiled code loads much faster than Scheme source code, and runs around | |
1511 | 3 or 4 times as fast, generating much less garbage in the process. | |
fa1804e9 | 1512 | |
29b98fb2 | 1513 | ** Evaluating Scheme code does not use the C stack. |
fa1804e9 | 1514 | |
29b98fb2 AW |
1515 | Besides when compiling Guile itself, Guile no longer uses a recursive C |
1516 | function as an evaluator. This obviates the need to check the C stack | |
1517 | pointer for overflow. Continuations still capture the C stack, however. | |
fa1804e9 | 1518 | |
96b73e84 AW |
1519 | ** New environment variables: GUILE_LOAD_COMPILED_PATH, |
1520 | GUILE_SYSTEM_LOAD_COMPILED_PATH | |
fa1804e9 | 1521 | |
96b73e84 AW |
1522 | GUILE_LOAD_COMPILED_PATH is for compiled files what GUILE_LOAD_PATH is |
1523 | for source files. It is a different path, however, because compiled | |
1524 | files are architecture-specific. GUILE_SYSTEM_LOAD_COMPILED_PATH is like | |
1525 | GUILE_SYSTEM_PATH. | |
1526 | ||
1527 | ** New read-eval-print loop (REPL) implementation | |
1528 | ||
51cb0cca AW |
1529 | Running Guile with no arguments drops the user into the new REPL. See |
1530 | "Using Guile Interactively" in the manual, for more information. | |
96b73e84 | 1531 | |
51cb0cca AW |
1532 | ** Remove old Emacs interface |
1533 | ||
1534 | Guile had an unused `--emacs' command line argument that was supposed to | |
1535 | help when running Guile inside Emacs. This option has been removed, and | |
1536 | the helper functions `named-module-use!' and `load-emacs-interface' have | |
1537 | been deprecated. | |
1538 | ||
ef6b0e8d AW |
1539 | ** Add `(system repl server)' module and `--listen' command-line argument |
1540 | ||
1541 | The `(system repl server)' module exposes procedures to listen on | |
1542 | sockets for connections, and serve REPLs to those clients. The --listen | |
1543 | command-line argument allows any Guile program to thus be remotely | |
1544 | debuggable. | |
1545 | ||
1546 | See "Invoking Guile" for more information on `--listen'. | |
1547 | ||
7cd99cba AW |
1548 | ** Command line additions |
1549 | ||
1550 | The guile binary now supports a new switch "-x", which can be used to | |
1551 | extend the list of filename extensions tried when loading files | |
1552 | (%load-extensions). | |
1553 | ||
487bacf4 AW |
1554 | ** New reader options: `square-brackets', `r6rs-hex-escapes', |
1555 | `hungry-eol-escapes' | |
6bf927ab LC |
1556 | |
1557 | The reader supports a new option (changeable via `read-options'), | |
1558 | `square-brackets', which instructs it to interpret square brackets as | |
29b98fb2 | 1559 | parentheses. This option is on by default. |
6bf927ab LC |
1560 | |
1561 | When the new `r6rs-hex-escapes' reader option is enabled, the reader | |
51cb0cca AW |
1562 | will recognize string escape sequences as defined in R6RS. R6RS string |
1563 | escape sequences are incompatible with Guile's existing escapes, though, | |
1564 | so this option is off by default. | |
6bf927ab | 1565 | |
487bacf4 AW |
1566 | Additionally, Guile follows the R6RS newline escaping rules when the |
1567 | `hungry-eol-escapes' option is enabled. | |
1568 | ||
1569 | See "String Syntax" in the manual, for more information. | |
1570 | ||
cf8ec359 AW |
1571 | ** Function profiling and tracing at the REPL |
1572 | ||
1573 | The `,profile FORM' REPL meta-command can now be used to statistically | |
1574 | profile execution of a form, to see which functions are taking the most | |
1575 | time. See `,help profile' for more information. | |
1576 | ||
1577 | Similarly, `,trace FORM' traces all function applications that occur | |
1578 | during the execution of `FORM'. See `,help trace' for more information. | |
1579 | ||
51cb0cca AW |
1580 | ** Recursive debugging REPL on error |
1581 | ||
1582 | When Guile sees an error at the REPL, instead of saving the stack, Guile | |
1583 | will directly enter a recursive REPL in the dynamic context of the | |
1584 | error. See "Error Handling" in the manual, for more information. | |
1585 | ||
1586 | A recursive REPL is the same as any other REPL, except that it | |
1587 | has been augmented with debugging information, so that one can inspect | |
1588 | the context of the error. The debugger has been integrated with the REPL | |
1589 | via a set of debugging meta-commands. | |
cf8ec359 | 1590 | |
51cb0cca AW |
1591 | For example, one may access a backtrace with `,backtrace' (or |
1592 | `,bt'). See "Interactive Debugging" in the manual, for more | |
1593 | information. | |
cf8ec359 | 1594 | |
96b73e84 AW |
1595 | ** New `guile-tools' commands: `compile', `disassemble' |
1596 | ||
93617170 | 1597 | Pass the `--help' command-line option to these commands for more |
96b73e84 AW |
1598 | information. |
1599 | ||
b0217d17 AW |
1600 | ** Guile now adds its install prefix to the LTDL_LIBRARY_PATH |
1601 | ||
1602 | Users may now install Guile to nonstandard prefixes and just run | |
1603 | `/path/to/bin/guile', instead of also having to set LTDL_LIBRARY_PATH to | |
1604 | include `/path/to/lib'. | |
1605 | ||
1606 | ** Guile's Emacs integration is now more keyboard-friendly | |
1607 | ||
1608 | Backtraces may now be disclosed with the keyboard in addition to the | |
1609 | mouse. | |
1610 | ||
cf8ec359 AW |
1611 | ** Load path change: search in version-specific paths before site paths |
1612 | ||
1613 | When looking for a module, Guile now searches first in Guile's | |
1614 | version-specific path (the library path), *then* in the site dir. This | |
1615 | allows Guile's copy of SSAX to override any Guile-Lib copy the user has | |
1616 | installed. Also it should cut the number of `stat' system calls by half, | |
1617 | in the common case. | |
1618 | ||
51cb0cca AW |
1619 | ** Value history in the REPL on by default |
1620 | ||
1621 | By default, the REPL will save computed values in variables like `$1', | |
1622 | `$2', and the like. There are programmatic and interactive interfaces to | |
1623 | control this. See "Value History" in the manual, for more information. | |
1624 | ||
1625 | ** Readline tab completion for arguments | |
1626 | ||
1627 | When readline is enabled, tab completion works for arguments too, not | |
1628 | just for the operator position. | |
1629 | ||
7cd99cba AW |
1630 | ** Expression-oriented readline history |
1631 | ||
1632 | Guile's readline history now tries to operate on expressions instead of | |
1633 | input lines. Let us know what you think! | |
1634 | ||
139fa149 AW |
1635 | ** Interactive Guile follows GNU conventions |
1636 | ||
1637 | As recommended by the GPL, Guile now shows a brief copyright and | |
1638 | warranty disclaimer on startup, along with pointers to more information. | |
cf8ec359 | 1639 | |
96b73e84 AW |
1640 | * Changes to Scheme functions and syntax |
1641 | ||
18e90860 AW |
1642 | ** Support for R6RS libraries |
1643 | ||
1644 | The `library' and `import' forms from the latest Scheme report have been | |
1645 | added to Guile, in such a way that R6RS libraries share a namespace with | |
1646 | Guile modules. R6RS modules may import Guile modules, and are available | |
1647 | for Guile modules to import via use-modules and all the rest. See "R6RS | |
1648 | Libraries" in the manual for more information. | |
1649 | ||
1650 | ** Implementations of R6RS libraries | |
1651 | ||
1652 | Guile now has implementations for all of the libraries defined in the | |
1653 | R6RS. Thanks to Julian Graham for this excellent hack. See "R6RS | |
1654 | Standard Libraries" in the manual for a full list of libraries. | |
1655 | ||
1656 | ** Partial R6RS compatibility | |
1657 | ||
1658 | Guile now has enough support for R6RS to run a reasonably large subset | |
1659 | of R6RS programs. | |
1660 | ||
1661 | Guile is not fully R6RS compatible. Many incompatibilities are simply | |
1662 | bugs, though some parts of Guile will remain R6RS-incompatible for the | |
1663 | foreseeable future. See "R6RS Incompatibilities" in the manual, for more | |
1664 | information. | |
1665 | ||
1666 | Please contact bug-guile@gnu.org if you have found an issue not | |
1667 | mentioned in that compatibility list. | |
1668 | ||
4a457691 AW |
1669 | ** New implementation of `primitive-eval' |
1670 | ||
1671 | Guile's `primitive-eval' is now implemented in Scheme. Actually there is | |
1672 | still a C evaluator, used when building a fresh Guile to interpret the | |
1673 | compiler, so we can compile eval.scm. Thereafter all calls to | |
1674 | primitive-eval are implemented by VM-compiled code. | |
1675 | ||
1676 | This allows all of Guile's procedures, be they interpreted or compiled, | |
1677 | to execute on the same stack, unifying multiple-value return semantics, | |
1678 | providing for proper tail recursion between interpreted and compiled | |
1679 | code, and simplifying debugging. | |
1680 | ||
1681 | As part of this change, the evaluator no longer mutates the internal | |
1682 | representation of the code being evaluated in a thread-unsafe manner. | |
1683 | ||
1684 | There are two negative aspects of this change, however. First, Guile | |
1685 | takes a lot longer to compile now. Also, there is less debugging | |
1686 | information available for debugging interpreted code. We hope to improve | |
1687 | both of these situations. | |
1688 | ||
1689 | There are many changes to the internal C evalator interface, but all | |
1690 | public interfaces should be the same. See the ChangeLog for details. If | |
1691 | we have inadvertantly changed an interface that you were using, please | |
1692 | contact bug-guile@gnu.org. | |
1693 | ||
96b73e84 AW |
1694 | ** Procedure removed: `the-environment' |
1695 | ||
1696 | This procedure was part of the interpreter's execution model, and does | |
1697 | not apply to the compiler. | |
fa1804e9 | 1698 | |
4a457691 AW |
1699 | ** No more `local-eval' |
1700 | ||
1701 | `local-eval' used to exist so that one could evaluate code in the | |
1702 | lexical context of a function. Since there is no way to get the lexical | |
1703 | environment any more, as that concept has no meaning for the compiler, | |
1704 | and a different meaning for the interpreter, we have removed the | |
1705 | function. | |
1706 | ||
1707 | If you think you need `local-eval', you should probably implement your | |
1708 | own metacircular evaluator. It will probably be as fast as Guile's | |
1709 | anyway. | |
1710 | ||
139fa149 | 1711 | ** Scheme source files will now be compiled automatically. |
fa1804e9 AW |
1712 | |
1713 | If a compiled .go file corresponding to a .scm file is not found or is | |
1714 | not fresh, the .scm file will be compiled on the fly, and the resulting | |
1715 | .go file stored away. An advisory note will be printed on the console. | |
1716 | ||
51cb0cca AW |
1717 | Note that this mechanism depends on the timestamp of the .go file being |
1718 | newer than that of the .scm file; if the .scm or .go files are moved | |
1719 | after installation, care should be taken to preserve their original | |
fa1804e9 AW |
1720 | timestamps. |
1721 | ||
6f06e8d3 | 1722 | Auto-compiled files will be stored in the $XDG_CACHE_HOME/guile/ccache |
19fef497 AW |
1723 | directory, where $XDG_CACHE_HOME defaults to ~/.cache. This directory |
1724 | will be created if needed. | |
fa1804e9 | 1725 | |
6f06e8d3 AW |
1726 | To inhibit automatic compilation, set the GUILE_AUTO_COMPILE environment |
1727 | variable to 0, or pass --no-auto-compile on the Guile command line. | |
fa1804e9 | 1728 | |
96b73e84 | 1729 | ** New POSIX procedures: `getrlimit' and `setrlimit' |
fa1804e9 | 1730 | |
96b73e84 AW |
1731 | Note however that the interface of these functions is likely to change |
1732 | in the next prerelease. | |
fa1804e9 | 1733 | |
4a457691 AW |
1734 | ** New POSIX procedure: `getsid' |
1735 | ||
1736 | Scheme binding for the `getsid' C library call. | |
1737 | ||
dbd9532e LC |
1738 | ** New POSIX procedure: `getaddrinfo' |
1739 | ||
1740 | Scheme binding for the `getaddrinfo' C library function. | |
1741 | ||
7cd99cba AW |
1742 | ** Multicast socket options |
1743 | ||
1744 | Support was added for the IP_MULTICAST_TTL and IP_MULTICAST_IF socket | |
1745 | options. See "Network Sockets and Communication" in the manual, for | |
1746 | more information. | |
1747 | ||
487bacf4 AW |
1748 | ** `recv!', `recvfrom!', `send', `sendto' now deal in bytevectors |
1749 | ||
1750 | These socket procedures now take bytevectors as arguments, instead of | |
1751 | strings. There is some deprecated string support, however. | |
1752 | ||
7cd99cba AW |
1753 | ** New GNU procedures: `setaffinity' and `getaffinity'. |
1754 | ||
1755 | See "Processes" in the manual, for more information. | |
1756 | ||
1757 | ** New procedures: `compose', `negate', and `const' | |
1758 | ||
1759 | See "Higher-Order Functions" in the manual, for more information. | |
1760 | ||
96b73e84 | 1761 | ** New procedure in `(oops goops)': `method-formals' |
fa1804e9 | 1762 | |
96b73e84 AW |
1763 | ** New procedures in (ice-9 session): `add-value-help-handler!', |
1764 | `remove-value-help-handler!', `add-name-help-handler!' | |
29b98fb2 | 1765 | `remove-name-help-handler!', `procedure-arguments' |
fa1804e9 | 1766 | |
96b73e84 AW |
1767 | The value and name help handlers provide some minimal extensibility to |
1768 | the help interface. Guile-lib's `(texinfo reflection)' uses them, for | |
1769 | example, to make stexinfo help documentation available. See those | |
1770 | procedures' docstrings for more information. | |
1771 | ||
1772 | `procedure-arguments' describes the arguments that a procedure can take, | |
1773 | combining arity and formals. For example: | |
1774 | ||
1775 | (procedure-arguments resolve-interface) | |
1776 | => ((required . (name)) (rest . args)) | |
fa1804e9 | 1777 | |
96b73e84 AW |
1778 | Additionally, `module-commentary' is now publically exported from |
1779 | `(ice-9 session). | |
1780 | ||
cf8ec359 | 1781 | ** Removed: `procedure->memoizing-macro', `procedure->syntax' |
96b73e84 | 1782 | |
cf8ec359 AW |
1783 | These procedures created primitive fexprs for the old evaluator, and are |
1784 | no longer supported. If you feel that you need these functions, you | |
1785 | probably need to write your own metacircular evaluator (which will | |
1786 | probably be as fast as Guile's, anyway). | |
96b73e84 AW |
1787 | |
1788 | ** New language: ECMAScript | |
1789 | ||
1790 | Guile now ships with one other high-level language supported, | |
1791 | ECMAScript. The goal is to support all of version 3.1 of the standard, | |
1792 | but not all of the libraries are there yet. This support is not yet | |
1793 | documented; ask on the mailing list if you are interested. | |
1794 | ||
19fef497 AW |
1795 | ** New language: Brainfuck |
1796 | ||
1797 | Brainfuck is a toy language that closely models Turing machines. Guile's | |
1798 | brainfuck compiler is meant to be an example of implementing other | |
1799 | languages. See the manual for details, or | |
1800 | http://en.wikipedia.org/wiki/Brainfuck for more information about the | |
1801 | Brainfuck language itself. | |
1802 | ||
4a457691 AW |
1803 | ** New language: Elisp |
1804 | ||
1805 | Guile now has an experimental Emacs Lisp compiler and runtime. You can | |
1806 | now switch to Elisp at the repl: `,language elisp'. All kudos to Daniel | |
7cd99cba | 1807 | Kraft and Brian Templeton, and all bugs to bug-guile@gnu.org. |
4a457691 | 1808 | |
139fa149 AW |
1809 | ** Better documentation infrastructure for macros |
1810 | ||
1811 | It is now possible to introspect on the type of a macro, e.g. | |
1812 | syntax-rules, identifier-syntax, etc, and extract information about that | |
1813 | macro, such as the syntax-rules patterns or the defmacro arguments. | |
1814 | `(texinfo reflection)' takes advantage of this to give better macro | |
1815 | documentation. | |
1816 | ||
139fa149 AW |
1817 | ** Support for arbitrary procedure metadata |
1818 | ||
1819 | Building on its support for docstrings, Guile now supports multiple | |
1820 | docstrings, adding them to the tail of a compiled procedure's | |
1821 | properties. For example: | |
1822 | ||
1823 | (define (foo) | |
1824 | "one" | |
1825 | "two" | |
1826 | 3) | |
29b98fb2 | 1827 | (procedure-properties foo) |
139fa149 AW |
1828 | => ((name . foo) (documentation . "one") (documentation . "two")) |
1829 | ||
1830 | Also, vectors of pairs are now treated as additional metadata entries: | |
1831 | ||
1832 | (define (bar) | |
1833 | #((quz . #f) (docstring . "xyzzy")) | |
1834 | 3) | |
29b98fb2 | 1835 | (procedure-properties bar) |
139fa149 AW |
1836 | => ((name . bar) (quz . #f) (docstring . "xyzzy")) |
1837 | ||
1838 | This allows arbitrary literals to be embedded as metadata in a compiled | |
1839 | procedure. | |
1840 | ||
96b73e84 AW |
1841 | ** The psyntax expander now knows how to interpret the @ and @@ special |
1842 | forms. | |
1843 | ||
1844 | ** The psyntax expander is now hygienic with respect to modules. | |
1845 | ||
1846 | Free variables in a macro are scoped in the module that the macro was | |
1847 | defined in, not in the module the macro is used in. For example, code | |
1848 | like this works now: | |
1849 | ||
1850 | (define-module (foo) #:export (bar)) | |
1851 | (define (helper x) ...) | |
1852 | (define-syntax bar | |
1853 | (syntax-rules () ((_ x) (helper x)))) | |
1854 | ||
1855 | (define-module (baz) #:use-module (foo)) | |
1856 | (bar qux) | |
1857 | ||
1858 | It used to be you had to export `helper' from `(foo)' as well. | |
1859 | Thankfully, this has been fixed. | |
1860 | ||
51cb0cca | 1861 | ** Support for version information in Guile's `module' form |
cf8ec359 | 1862 | |
51cb0cca AW |
1863 | Guile modules now have a `#:version' field. See "R6RS Version |
1864 | References", "General Information about Modules", "Using Guile Modules", | |
1865 | and "Creating Guile Modules" in the manual for more information. | |
96b73e84 | 1866 | |
cf8ec359 AW |
1867 | ** Support for renaming bindings on module export |
1868 | ||
1869 | Wherever Guile accepts a symbol as an argument to specify a binding to | |
1870 | export, it now also accepts a pair of symbols, indicating that a binding | |
1871 | should be renamed on export. See "Creating Guile Modules" in the manual | |
1872 | for more information. | |
96b73e84 | 1873 | |
18e90860 AW |
1874 | ** New procedure: `module-export-all!' |
1875 | ||
1876 | This procedure exports all current and future bindings from a module. | |
1877 | Use as `(module-export-all! (current-module))'. | |
1878 | ||
7cd99cba AW |
1879 | ** New procedure `reload-module', and `,reload' REPL command |
1880 | ||
1881 | See "Module System Reflection" and "Module Commands" in the manual, for | |
1882 | more information. | |
1883 | ||
96b73e84 AW |
1884 | ** `eval-case' has been deprecated, and replaced by `eval-when'. |
1885 | ||
29b98fb2 AW |
1886 | The semantics of `eval-when' are easier to understand. See "Eval When" |
1887 | in the manual, for more information. | |
96b73e84 AW |
1888 | |
1889 | ** Guile is now more strict about prohibiting definitions in expression | |
1890 | contexts. | |
1891 | ||
1892 | Although previous versions of Guile accepted it, the following | |
1893 | expression is not valid, in R5RS or R6RS: | |
1894 | ||
1895 | (if test (define foo 'bar) (define foo 'baz)) | |
1896 | ||
1897 | In this specific case, it would be better to do: | |
1898 | ||
1899 | (define foo (if test 'bar 'baz)) | |
1900 | ||
79b3863d AW |
1901 | It is possible to circumvent this restriction with e.g. |
1902 | `(module-define! (current-module) 'foo 'baz)'. Contact the list if you | |
1903 | have any questions. | |
96b73e84 | 1904 | |
51cb0cca AW |
1905 | ** Support for `letrec*' |
1906 | ||
1907 | Guile now supports `letrec*', a recursive lexical binding operator in | |
1908 | which the identifiers are bound in order. See "Local Bindings" in the | |
1909 | manual, for more details. | |
1910 | ||
1911 | ** Internal definitions now expand to `letrec*' | |
1912 | ||
1913 | Following the R6RS, internal definitions now expand to letrec* instead | |
1914 | of letrec. The following program is invalid for R5RS, but valid for | |
1915 | R6RS: | |
1916 | ||
1917 | (define (foo) | |
1918 | (define bar 10) | |
1919 | (define baz (+ bar 20)) | |
1920 | baz) | |
1921 | ||
1922 | ;; R5RS and Guile <= 1.8: | |
1923 | (foo) => Unbound variable: bar | |
1924 | ;; R6RS and Guile >= 2.0: | |
1925 | (foo) => 30 | |
1926 | ||
1927 | This change should not affect correct R5RS programs, or programs written | |
1928 | in earlier Guile dialects. | |
1929 | ||
18e90860 AW |
1930 | ** Macro expansion produces structures instead of s-expressions |
1931 | ||
1932 | In the olden days, macroexpanding an s-expression would yield another | |
1933 | s-expression. Though the lexical variables were renamed, expansions of | |
1934 | core forms like `if' and `begin' were still non-hygienic, as they relied | |
1935 | on the toplevel definitions of `if' et al being the conventional ones. | |
1936 | ||
1937 | The solution is to expand to structures instead of s-expressions. There | |
1938 | is an `if' structure, a `begin' structure, a `toplevel-ref' structure, | |
1939 | etc. The expander already did this for compilation, producing Tree-IL | |
1940 | directly; it has been changed now to do so when expanding for the | |
1941 | evaluator as well. | |
1942 | ||
96b73e84 AW |
1943 | ** Defmacros must now produce valid Scheme expressions. |
1944 | ||
1945 | It used to be that defmacros could unquote in Scheme values, as a way of | |
1946 | supporting partial evaluation, and avoiding some hygiene issues. For | |
1947 | example: | |
1948 | ||
1949 | (define (helper x) ...) | |
1950 | (define-macro (foo bar) | |
1951 | `(,helper ,bar)) | |
1952 | ||
1953 | Assuming this macro is in the `(baz)' module, the direct translation of | |
1954 | this code would be: | |
1955 | ||
1956 | (define (helper x) ...) | |
1957 | (define-macro (foo bar) | |
1958 | `((@@ (baz) helper) ,bar)) | |
1959 | ||
1960 | Of course, one could just use a hygienic macro instead: | |
1961 | ||
1962 | (define-syntax foo | |
1963 | (syntax-rules () | |
1964 | ((_ bar) (helper bar)))) | |
1965 | ||
1966 | ** Guile's psyntax now supports docstrings and internal definitions. | |
1967 | ||
1968 | The following Scheme is not strictly legal: | |
1969 | ||
1970 | (define (foo) | |
1971 | "bar" | |
1972 | (define (baz) ...) | |
1973 | (baz)) | |
1974 | ||
1975 | However its intent is fairly clear. Guile interprets "bar" to be the | |
1976 | docstring of `foo', and the definition of `baz' is still in definition | |
1977 | context. | |
1978 | ||
51cb0cca AW |
1979 | ** Support for settable identifier syntax |
1980 | ||
1981 | Following the R6RS, "variable transformers" are settable | |
1982 | identifier-syntax. See "Identifier macros" in the manual, for more | |
1983 | information. | |
1984 | ||
1985 | ** syntax-case treats `_' as a placeholder | |
1986 | ||
1987 | Following R6RS, a `_' in a syntax-rules or syntax-case pattern matches | |
1988 | anything, and binds no pattern variables. Unlike the R6RS, Guile also | |
1989 | permits `_' to be in the literals list for a pattern. | |
1990 | ||
96b73e84 AW |
1991 | ** Macros need to be defined before their first use. |
1992 | ||
1993 | It used to be that with lazy memoization, this might work: | |
1994 | ||
1995 | (define (foo x) | |
1996 | (ref x)) | |
1997 | (define-macro (ref x) x) | |
1998 | (foo 1) => 1 | |
1999 | ||
2000 | But now, the body of `foo' is interpreted to mean a call to the toplevel | |
2001 | `ref' function, instead of a macro expansion. The solution is to define | |
2002 | macros before code that uses them. | |
2003 | ||
2004 | ** Functions needed by macros at expand-time need to be present at | |
2005 | expand-time. | |
2006 | ||
2007 | For example, this code will work at the REPL: | |
2008 | ||
2009 | (define (double-helper x) (* x x)) | |
2010 | (define-macro (double-literal x) (double-helper x)) | |
2011 | (double-literal 2) => 4 | |
2012 | ||
2013 | But it will not work when a file is compiled, because the definition of | |
2014 | `double-helper' is not present at expand-time. The solution is to wrap | |
2015 | the definition of `double-helper' in `eval-when': | |
2016 | ||
2017 | (eval-when (load compile eval) | |
2018 | (define (double-helper x) (* x x))) | |
2019 | (define-macro (double-literal x) (double-helper x)) | |
2020 | (double-literal 2) => 4 | |
2021 | ||
29b98fb2 | 2022 | See the documentation for eval-when for more information. |
96b73e84 | 2023 | |
29b98fb2 | 2024 | ** `macroexpand' produces structures, not S-expressions. |
96b73e84 | 2025 | |
29b98fb2 AW |
2026 | Given the need to maintain referential transparency, both lexically and |
2027 | modular, the result of expanding Scheme expressions is no longer itself | |
2028 | an s-expression. If you want a human-readable approximation of the | |
2029 | result of `macroexpand', call `tree-il->scheme' from `(language | |
2030 | tree-il)'. | |
96b73e84 | 2031 | |
29b98fb2 | 2032 | ** Removed function: `macroexpand-1' |
96b73e84 | 2033 | |
29b98fb2 AW |
2034 | It is unclear how to implement `macroexpand-1' with syntax-case, though |
2035 | PLT Scheme does prove that it is possible. | |
fa1804e9 AW |
2036 | |
2037 | ** New reader macros: #' #` #, #,@ | |
2038 | ||
2039 | These macros translate, respectively, to `syntax', `quasisyntax', | |
2040 | `unsyntax', and `unsyntax-splicing'. See the R6RS for more information. | |
2041 | These reader macros may be overridden by `read-hash-extend'. | |
2042 | ||
2043 | ** Incompatible change to #' | |
2044 | ||
2045 | Guile did have a #' hash-extension, by default, which just returned the | |
2046 | subsequent datum: #'foo => foo. In the unlikely event that anyone | |
2047 | actually used this, this behavior may be reinstated via the | |
2048 | `read-hash-extend' mechanism. | |
2049 | ||
b47fea09 AW |
2050 | ** `unquote' and `unquote-splicing' accept multiple expressions |
2051 | ||
2052 | As per the R6RS, these syntax operators can now accept any number of | |
2053 | expressions to unquote. | |
2054 | ||
fa1804e9 AW |
2055 | ** Scheme expresssions may be commented out with #; |
2056 | ||
93617170 LC |
2057 | #; comments out an entire expression. See SRFI-62 or the R6RS for more |
2058 | information. | |
fa1804e9 | 2059 | |
b0abbaa7 AW |
2060 | ** Prompts: Delimited, composable continuations |
2061 | ||
2062 | Guile now has prompts as part of its primitive language. See "Prompts" | |
2063 | in the manual, for more information. | |
2064 | ||
2065 | Expressions entered in at the REPL, or from the command line, are | |
2066 | surrounded by a prompt with the default prompt tag. | |
2067 | ||
93617170 | 2068 | ** `make-stack' with a tail-called procedural narrowing argument no longer |
fa1804e9 AW |
2069 | works (with compiled procedures) |
2070 | ||
2071 | It used to be the case that a captured stack could be narrowed to select | |
2072 | calls only up to or from a certain procedure, even if that procedure | |
2073 | already tail-called another procedure. This was because the debug | |
2074 | information from the original procedure was kept on the stack. | |
2075 | ||
2076 | Now with the new compiler, the stack only contains active frames from | |
2077 | the current continuation. A narrow to a procedure that is not in the | |
2078 | stack will result in an empty stack. To fix this, narrow to a procedure | |
2079 | that is active in the current continuation, or narrow to a specific | |
2080 | number of stack frames. | |
2081 | ||
29b98fb2 | 2082 | ** Backtraces through compiled procedures only show procedures that are |
fa1804e9 AW |
2083 | active in the current continuation |
2084 | ||
2085 | Similarly to the previous issue, backtraces in compiled code may be | |
2086 | different from backtraces in interpreted code. There are no semantic | |
2087 | differences, however. Please mail bug-guile@gnu.org if you see any | |
2088 | deficiencies with Guile's backtraces. | |
2089 | ||
b47fea09 AW |
2090 | ** `positions' reader option enabled by default |
2091 | ||
2092 | This change allows primitive-load without --auto-compile to also | |
2093 | propagate source information through the expander, for better errors and | |
2094 | to let macros know their source locations. The compiler was already | |
2095 | turning it on anyway. | |
2096 | ||
51cb0cca AW |
2097 | ** New macro: `current-source-location' |
2098 | ||
2099 | The macro returns the current source location (to be documented). | |
2100 | ||
fa1804e9 AW |
2101 | ** syntax-rules and syntax-case macros now propagate source information |
2102 | through to the expanded code | |
2103 | ||
2104 | This should result in better backtraces. | |
2105 | ||
2106 | ** The currying behavior of `define' has been removed. | |
2107 | ||
2108 | Before, `(define ((f a) b) (* a b))' would translate to | |
2109 | ||
2110 | (define f (lambda (a) (lambda (b) (* a b)))) | |
2111 | ||
93617170 | 2112 | Now a syntax error is signaled, as this syntax is not supported by |
29b98fb2 AW |
2113 | default. Use the `(ice-9 curried-definitions)' module to get back the |
2114 | old behavior. | |
fa1804e9 | 2115 | |
4a457691 AW |
2116 | ** New procedure, `define!' |
2117 | ||
2118 | `define!' is a procedure that takes two arguments, a symbol and a value, | |
2119 | and binds the value to the symbol in the current module. It's useful to | |
2120 | programmatically make definitions in the current module, and is slightly | |
2121 | less verbose than `module-define!'. | |
2122 | ||
fa1804e9 AW |
2123 | ** All modules have names now |
2124 | ||
2125 | Before, you could have anonymous modules: modules without names. Now, | |
2126 | because of hygiene and macros, all modules have names. If a module was | |
2127 | created without a name, the first time `module-name' is called on it, a | |
2128 | fresh name will be lazily generated for it. | |
2129 | ||
18e90860 AW |
2130 | ** The module namespace is now separate from the value namespace |
2131 | ||
2132 | It was a little-known implementation detail of Guile's module system | |
2133 | that it was built on a single hierarchical namespace of values -- that | |
2134 | if there was a module named `(foo bar)', then in the module named | |
2135 | `(foo)' there was a binding from `bar' to the `(foo bar)' module. | |
2136 | ||
2137 | This was a neat trick, but presented a number of problems. One problem | |
2138 | was that the bindings in a module were not apparent from the module | |
2139 | itself; perhaps the `(foo)' module had a private binding for `bar', and | |
2140 | then an external contributor defined `(foo bar)'. In the end there can | |
2141 | be only one binding, so one of the two will see the wrong thing, and | |
2142 | produce an obtuse error of unclear provenance. | |
2143 | ||
2144 | Also, the public interface of a module was also bound in the value | |
2145 | namespace, as `%module-public-interface'. This was a hack from the early | |
2146 | days of Guile's modules. | |
2147 | ||
2148 | Both of these warts have been fixed by the addition of fields in the | |
2149 | `module' data type. Access to modules and their interfaces from the | |
2150 | value namespace has been deprecated, and all accessors use the new | |
2151 | record accessors appropriately. | |
2152 | ||
2153 | When Guile is built with support for deprecated code, as is the default, | |
2154 | the value namespace is still searched for modules and public interfaces, | |
2155 | and a deprecation warning is raised as appropriate. | |
2156 | ||
2157 | Finally, to support lazy loading of modules as one used to be able to do | |
2158 | with module binder procedures, Guile now has submodule binders, called | |
2159 | if a given submodule is not found. See boot-9.scm for more information. | |
2160 | ||
2161 | ** New procedures: module-ref-submodule, module-define-submodule, | |
2162 | nested-ref-module, nested-define-module!, local-ref-module, | |
2163 | local-define-module | |
2164 | ||
2165 | These new accessors are like their bare variants, but operate on | |
2166 | namespaces instead of values. | |
2167 | ||
2168 | ** The (app modules) module tree is officially deprecated | |
2169 | ||
2170 | It used to be that one could access a module named `(foo bar)' via | |
2171 | `(nested-ref the-root-module '(app modules foo bar))'. The `(app | |
2172 | modules)' bit was a never-used and never-documented abstraction, and has | |
2173 | been deprecated. See the following mail for a full discussion: | |
2174 | ||
2175 | http://lists.gnu.org/archive/html/guile-devel/2010-04/msg00168.html | |
2176 | ||
2177 | The `%app' binding is also deprecated. | |
2178 | ||
51cb0cca AW |
2179 | ** `module-filename' field and accessor |
2180 | ||
2181 | Modules now record the file in which they are defined. This field may be | |
2182 | accessed with the new `module-filename' procedure. | |
2183 | ||
2184 | ** Modules load within a known environment | |
2185 | ||
2186 | It takes a few procedure calls to define a module, and those procedure | |
2187 | calls need to be in scope. Now we ensure that the current module when | |
2188 | loading a module is one that has the needed bindings, instead of relying | |
2189 | on chance. | |
2190 | ||
b47fea09 AW |
2191 | ** `load' is a macro (!) that resolves paths relative to source file dir |
2192 | ||
2193 | The familiar Schem `load' procedure is now a macro that captures the | |
2194 | name of the source file being expanded, and dispatches to the new | |
2195 | `load-in-vicinity'. Referencing `load' by bare name returns a closure | |
2196 | that embeds the current source file name. | |
2197 | ||
2198 | This fix allows `load' of relative paths to be resolved with respect to | |
2199 | the location of the file that calls `load'. | |
2200 | ||
fa1804e9 AW |
2201 | ** Many syntax errors have different texts now |
2202 | ||
2203 | Syntax errors still throw to the `syntax-error' key, but the arguments | |
2204 | are often different now. Perhaps in the future, Guile will switch to | |
93617170 | 2205 | using standard SRFI-35 conditions. |
fa1804e9 AW |
2206 | |
2207 | ** Returning multiple values to compiled code will silently truncate the | |
2208 | values to the expected number | |
2209 | ||
2210 | For example, the interpreter would raise an error evaluating the form, | |
2211 | `(+ (values 1 2) (values 3 4))', because it would see the operands as | |
2212 | being two compound "values" objects, to which `+' does not apply. | |
2213 | ||
2214 | The compiler, on the other hand, receives multiple values on the stack, | |
2215 | not as a compound object. Given that it must check the number of values | |
2216 | anyway, if too many values are provided for a continuation, it chooses | |
2217 | to truncate those values, effectively evaluating `(+ 1 3)' instead. | |
2218 | ||
2219 | The idea is that the semantics that the compiler implements is more | |
2220 | intuitive, and the use of the interpreter will fade out with time. | |
2221 | This behavior is allowed both by the R5RS and the R6RS. | |
2222 | ||
2223 | ** Multiple values in compiled code are not represented by compound | |
2224 | objects | |
2225 | ||
2226 | This change may manifest itself in the following situation: | |
2227 | ||
2228 | (let ((val (foo))) (do-something) val) | |
2229 | ||
2230 | In the interpreter, if `foo' returns multiple values, multiple values | |
2231 | are produced from the `let' expression. In the compiler, those values | |
2232 | are truncated to the first value, and that first value is returned. In | |
2233 | the compiler, if `foo' returns no values, an error will be raised, while | |
2234 | the interpreter would proceed. | |
2235 | ||
2236 | Both of these behaviors are allowed by R5RS and R6RS. The compiler's | |
2237 | behavior is more correct, however. If you wish to preserve a potentially | |
2238 | multiply-valued return, you will need to set up a multiple-value | |
2239 | continuation, using `call-with-values'. | |
2240 | ||
2241 | ** Defmacros are now implemented in terms of syntax-case. | |
2242 | ||
2243 | The practical ramification of this is that the `defmacro?' predicate has | |
2244 | been removed, along with `defmacro-transformer', `macro-table', | |
2245 | `xformer-table', `assert-defmacro?!', `set-defmacro-transformer!' and | |
2246 | `defmacro:transformer'. This is because defmacros are simply macros. If | |
2247 | any of these procedures provided useful facilities to you, we encourage | |
2248 | you to contact the Guile developers. | |
2249 | ||
139fa149 AW |
2250 | ** Hygienic macros documented as the primary syntactic extension mechanism. |
2251 | ||
2252 | The macro documentation was finally fleshed out with some documentation | |
29b98fb2 AW |
2253 | on `syntax-rules' and `syntax-case' macros, and other parts of the macro |
2254 | expansion process. See "Macros" in the manual, for details. | |
139fa149 | 2255 | |
fa1804e9 AW |
2256 | ** psyntax is now the default expander |
2257 | ||
2258 | Scheme code is now expanded by default by the psyntax hygienic macro | |
2259 | expander. Expansion is performed completely before compilation or | |
2260 | interpretation. | |
2261 | ||
2262 | Notably, syntax errors will be signalled before interpretation begins. | |
2263 | In the past, many syntax errors were only detected at runtime if the | |
2264 | code in question was memoized. | |
2265 | ||
2266 | As part of its expansion, psyntax renames all lexically-bound | |
2267 | identifiers. Original identifier names are preserved and given to the | |
2268 | compiler, but the interpreter will see the renamed variables, e.g., | |
2269 | `x432' instead of `x'. | |
2270 | ||
2271 | Note that the psyntax that Guile uses is a fork, as Guile already had | |
2272 | modules before incompatible modules were added to psyntax -- about 10 | |
2273 | years ago! Thus there are surely a number of bugs that have been fixed | |
2274 | in psyntax since then. If you find one, please notify bug-guile@gnu.org. | |
2275 | ||
2276 | ** syntax-rules and syntax-case are available by default. | |
2277 | ||
2278 | There is no longer any need to import the `(ice-9 syncase)' module | |
2279 | (which is now deprecated). The expander may be invoked directly via | |
29b98fb2 | 2280 | `macroexpand', though it is normally searched for via the current module |
fa1804e9 AW |
2281 | transformer. |
2282 | ||
2283 | Also, the helper routines for syntax-case are available in the default | |
2284 | environment as well: `syntax->datum', `datum->syntax', | |
2285 | `bound-identifier=?', `free-identifier=?', `generate-temporaries', | |
2286 | `identifier?', and `syntax-violation'. See the R6RS for documentation. | |
2287 | ||
4a457691 AW |
2288 | ** Tail patterns in syntax-case |
2289 | ||
2290 | Guile has pulled in some more recent changes from the psyntax portable | |
2291 | syntax expander, to implement support for "tail patterns". Such patterns | |
2292 | are supported by syntax-rules and syntax-case. This allows a syntax-case | |
2293 | match clause to have ellipses, then a pattern at the end. For example: | |
2294 | ||
2295 | (define-syntax case | |
2296 | (syntax-rules (else) | |
2297 | ((_ val match-clause ... (else e e* ...)) | |
2298 | [...]))) | |
2299 | ||
2300 | Note how there is MATCH-CLAUSE, which is ellipsized, then there is a | |
2301 | tail pattern for the else clause. Thanks to Andreas Rottmann for the | |
2302 | patch, and Kent Dybvig for the code. | |
2303 | ||
fa1804e9 AW |
2304 | ** Lexical bindings introduced by hygienic macros may not be referenced |
2305 | by nonhygienic macros. | |
2306 | ||
2307 | If a lexical binding is introduced by a hygienic macro, it may not be | |
2308 | referenced by a nonhygienic macro. For example, this works: | |
2309 | ||
2310 | (let () | |
2311 | (define-macro (bind-x val body) | |
2312 | `(let ((x ,val)) ,body)) | |
2313 | (define-macro (ref x) | |
2314 | x) | |
2315 | (bind-x 10 (ref x))) | |
2316 | ||
2317 | But this does not: | |
2318 | ||
2319 | (let () | |
2320 | (define-syntax bind-x | |
2321 | (syntax-rules () | |
2322 | ((_ val body) (let ((x val)) body)))) | |
2323 | (define-macro (ref x) | |
2324 | x) | |
2325 | (bind-x 10 (ref x))) | |
2326 | ||
2327 | It is not normal to run into this situation with existing code. However, | |
51cb0cca | 2328 | if you have defmacros that expand to hygienic macros, it is possible to |
66ad445d AW |
2329 | run into situations like this. For example, if you have a defmacro that |
2330 | generates a `while' expression, the `break' bound by the `while' may not | |
2331 | be visible within other parts of your defmacro. The solution is to port | |
2332 | from defmacros to syntax-rules or syntax-case. | |
fa1804e9 AW |
2333 | |
2334 | ** Macros may no longer be referenced as first-class values. | |
2335 | ||
2336 | In the past, you could evaluate e.g. `if', and get its macro value. Now, | |
2337 | expanding this form raises a syntax error. | |
2338 | ||
2339 | Macros still /exist/ as first-class values, but they must be | |
2340 | /referenced/ via the module system, e.g. `(module-ref (current-module) | |
2341 | 'if)'. | |
2342 | ||
29b98fb2 AW |
2343 | ** Macros may now have docstrings. |
2344 | ||
2345 | `object-documentation' from `(ice-9 documentation)' may be used to | |
2346 | retrieve the docstring, once you have a macro value -- but see the above | |
2347 | note about first-class macros. Docstrings are associated with the syntax | |
2348 | transformer procedures. | |
fa1804e9 | 2349 | |
e614d375 AW |
2350 | ** `case-lambda' is now available in the default environment. |
2351 | ||
2352 | The binding in the default environment is equivalent to the one from the | |
2353 | `(srfi srfi-16)' module. Use the srfi-16 module explicitly if you wish | |
2354 | to maintain compatibility with Guile 1.8 and earlier. | |
2355 | ||
29b98fb2 | 2356 | ** Procedures may now have more than one arity. |
5bb408cc AW |
2357 | |
2358 | This can be the case, for example, in case-lambda procedures. The | |
2359 | arities of compiled procedures may be accessed via procedures from the | |
2360 | `(system vm program)' module; see "Compiled Procedures", "Optional | |
2361 | Arguments", and "Case-lambda" in the manual. | |
2362 | ||
18e90860 AW |
2363 | ** Deprecate arity access via (procedure-properties proc 'arity) |
2364 | ||
2365 | Instead of accessing a procedure's arity as a property, use the new | |
2366 | `procedure-minimum-arity' function, which gives the most permissive | |
b3da54d1 | 2367 | arity that the function has, in the same format as the old arity |
18e90860 AW |
2368 | accessor. |
2369 | ||
e614d375 AW |
2370 | ** `lambda*' and `define*' are now available in the default environment |
2371 | ||
2372 | As with `case-lambda', `(ice-9 optargs)' continues to be supported, for | |
2373 | compatibility purposes. No semantic change has been made (we hope). | |
2374 | Optional and keyword arguments now dispatch via special VM operations, | |
2375 | without the need to cons rest arguments, making them very fast. | |
2376 | ||
487bacf4 AW |
2377 | ** New syntax: define-once |
2378 | ||
2379 | `define-once' is like Lisp's `defvar': it creates a toplevel binding, | |
2380 | but only if one does not exist already. | |
2381 | ||
cf8ec359 AW |
2382 | ** New function, `truncated-print', with `format' support |
2383 | ||
2384 | `(ice-9 pretty-print)' now exports `truncated-print', a printer that | |
2385 | will ensure that the output stays within a certain width, truncating the | |
2386 | output in what is hopefully an intelligent manner. See the manual for | |
2387 | more details. | |
2388 | ||
2389 | There is a new `format' specifier, `~@y', for doing a truncated | |
2390 | print (as opposed to `~y', which does a pretty-print). See the `format' | |
2391 | documentation for more details. | |
2392 | ||
7cd99cba AW |
2393 | ** Better pretty-printing |
2394 | ||
2395 | Indentation recognizes more special forms, like `syntax-case', and read | |
2396 | macros like `quote' are printed better. | |
2397 | ||
51cb0cca AW |
2398 | ** Passing a number as the destination of `format' is deprecated |
2399 | ||
2400 | The `format' procedure in `(ice-9 format)' now emits a deprecation | |
2401 | warning if a number is passed as its first argument. | |
2402 | ||
487bacf4 AW |
2403 | Also, it used to be that you could omit passing a port to `format', in |
2404 | some cases. This still works, but has been formally deprecated. | |
2405 | ||
cf8ec359 AW |
2406 | ** SRFI-4 vectors reimplemented in terms of R6RS bytevectors |
2407 | ||
2408 | Guile now implements SRFI-4 vectors using bytevectors. Often when you | |
2409 | have a numeric vector, you end up wanting to write its bytes somewhere, | |
2410 | or have access to the underlying bytes, or read in bytes from somewhere | |
2411 | else. Bytevectors are very good at this sort of thing. But the SRFI-4 | |
2412 | APIs are nicer to use when doing number-crunching, because they are | |
2413 | addressed by element and not by byte. | |
2414 | ||
2415 | So as a compromise, Guile allows all bytevector functions to operate on | |
2416 | numeric vectors. They address the underlying bytes in the native | |
2417 | endianness, as one would expect. | |
2418 | ||
2419 | Following the same reasoning, that it's just bytes underneath, Guile | |
2420 | also allows uniform vectors of a given type to be accessed as if they | |
2421 | were of any type. One can fill a u32vector, and access its elements with | |
2422 | u8vector-ref. One can use f64vector-ref on bytevectors. It's all the | |
2423 | same to Guile. | |
2424 | ||
2425 | In this way, uniform numeric vectors may be written to and read from | |
2426 | input/output ports using the procedures that operate on bytevectors. | |
2427 | ||
2428 | Calls to SRFI-4 accessors (ref and set functions) from Scheme are now | |
2429 | inlined to the VM instructions for bytevector access. | |
2430 | ||
2431 | See "SRFI-4" in the manual, for more information. | |
2432 | ||
2433 | ** Nonstandard SRFI-4 procedures now available from `(srfi srfi-4 gnu)' | |
2434 | ||
2435 | Guile's `(srfi srfi-4)' now only exports those srfi-4 procedures that | |
2436 | are part of the standard. Complex uniform vectors and the | |
2437 | `any->FOOvector' family are now available only from `(srfi srfi-4 gnu)'. | |
2438 | ||
2439 | Guile's default environment imports `(srfi srfi-4)', and probably should | |
2440 | import `(srfi srfi-4 gnu)' as well. | |
2441 | ||
2442 | See "SRFI-4 Extensions" in the manual, for more information. | |
2443 | ||
e614d375 AW |
2444 | ** New syntax: include-from-path. |
2445 | ||
2446 | `include-from-path' is like `include', except it looks for its file in | |
2447 | the load path. It can be used to compile other files into a file. | |
2448 | ||
2449 | ** New syntax: quasisyntax. | |
2450 | ||
2451 | `quasisyntax' is to `syntax' as `quasiquote' is to `quote'. See the R6RS | |
2452 | documentation for more information. Thanks to Andre van Tonder for the | |
2453 | implementation. | |
2454 | ||
51cb0cca AW |
2455 | ** `*unspecified*' is identifier syntax |
2456 | ||
2457 | `*unspecified*' is no longer a variable, so it is optimized properly by | |
2458 | the compiler, and is not `set!'-able. | |
2459 | ||
487bacf4 AW |
2460 | ** Changes and bugfixes in numerics code |
2461 | ||
2462 | *** Added six new sets of fast quotient and remainder operators | |
2463 | ||
2464 | Added six new sets of fast quotient and remainder operator pairs with | |
2465 | different semantics than the R5RS operators. They support not only | |
2466 | integers, but all reals, including exact rationals and inexact | |
2467 | floating point numbers. | |
2468 | ||
2469 | These procedures accept two real numbers N and D, where the divisor D | |
2470 | must be non-zero. Each set of operators computes an integer quotient | |
2471 | Q and a real remainder R such that N = Q*D + R and |R| < |D|. They | |
2472 | differ only in how N/D is rounded to produce Q. | |
2473 | ||
2474 | `euclidean-quotient' returns the integer Q and `euclidean-remainder' | |
2475 | returns the real R such that N = Q*D + R and 0 <= R < |D|. `euclidean/' | |
2476 | returns both Q and R, and is more efficient than computing each | |
2477 | separately. Note that when D > 0, `euclidean-quotient' returns | |
2478 | floor(N/D), and when D < 0 it returns ceiling(N/D). | |
2479 | ||
2480 | `centered-quotient', `centered-remainder', and `centered/' are similar | |
2481 | except that the range of remainders is -abs(D/2) <= R < abs(D/2), and | |
2482 | `centered-quotient' rounds N/D to the nearest integer. Note that these | |
2483 | operators are equivalent to the R6RS integer division operators `div', | |
2484 | `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. | |
2485 | ||
2486 | `floor-quotient' and `floor-remainder' compute Q and R, respectively, | |
2487 | where Q has been rounded toward negative infinity. `floor/' returns | |
2488 | both Q and R, and is more efficient than computing each separately. | |
2489 | Note that when applied to integers, `floor-remainder' is equivalent to | |
2490 | the R5RS integer-only `modulo' operator. `ceiling-quotient', | |
2491 | `ceiling-remainder', and `ceiling/' are similar except that Q is | |
2492 | rounded toward positive infinity. | |
2493 | ||
2494 | For `truncate-quotient', `truncate-remainder', and `truncate/', Q is | |
2495 | rounded toward zero. Note that when applied to integers, | |
2496 | `truncate-quotient' and `truncate-remainder' are equivalent to the | |
2497 | R5RS integer-only operators `quotient' and `remainder'. | |
2498 | ||
2499 | For `round-quotient', `round-remainder', and `round/', Q is rounded to | |
2500 | the nearest integer, with ties going to the nearest even integer. | |
2501 | ||
2502 | *** Complex number changes | |
2503 | ||
2504 | Guile is now able to represent non-real complex numbers whose | |
2505 | imaginary part is an _inexact_ zero (0.0 or -0.0), per R6RS. | |
2506 | Previously, such numbers were immediately changed into inexact reals. | |
2507 | ||
2508 | (real? 0.0+0.0i) now returns #f, per R6RS, although (zero? 0.0+0.0i) | |
2509 | still returns #t, per R6RS. (= 0 0.0+0.0i) and (= 0.0 0.0+0.0i) are | |
2510 | #t, but the same comparisons using `eqv?' or `equal?' are #f. | |
2511 | ||
2512 | Like other non-real numbers, these complex numbers with inexact zero | |
2513 | imaginary part will raise exceptions is passed to procedures requiring | |
2514 | reals, such as `<', `>', `<=', `>=', `min', `max', `positive?', | |
2515 | `negative?', `inf?', `nan?', `finite?', etc. | |
2516 | ||
2517 | **** `make-rectangular' changes | |
2518 | ||
2519 | scm_make_rectangular `make-rectangular' now returns a real number only | |
2520 | if the imaginary part is an _exact_ 0. Previously, it would return a | |
2521 | real number if the imaginary part was an inexact zero. | |
2522 | ||
2523 | scm_c_make_rectangular now always returns a non-real complex number, | |
2524 | even if the imaginary part is zero. Previously, it would return a | |
2525 | real number if the imaginary part was zero. | |
2526 | ||
2527 | **** `make-polar' changes | |
2528 | ||
2529 | scm_make_polar `make-polar' now returns a real number only if the | |
2530 | angle or magnitude is an _exact_ 0. If the magnitude is an exact 0, | |
2531 | it now returns an exact 0. Previously, it would return a real | |
2532 | number if the imaginary part was an inexact zero. | |
2533 | ||
2534 | scm_c_make_polar now always returns a non-real complex number, even if | |
2535 | the imaginary part is 0.0. Previously, it would return a real number | |
2536 | if the imaginary part was 0.0. | |
2537 | ||
2538 | **** `imag-part' changes | |
2539 | ||
2540 | scm_imag_part `imag-part' now returns an exact 0 if applied to an | |
2541 | inexact real number. Previously it returned an inexact zero in this | |
2542 | case. | |
2543 | ||
2544 | *** `eqv?' and `equal?' now compare numbers equivalently | |
2545 | ||
2546 | scm_equal_p `equal?' now behaves equivalently to scm_eqv_p `eqv?' for | |
2547 | numeric values, per R5RS. Previously, equal? worked differently, | |
2548 | e.g. `(equal? 0.0 -0.0)' returned #t but `(eqv? 0.0 -0.0)' returned #f, | |
2549 | and `(equal? +nan.0 +nan.0)' returned #f but `(eqv? +nan.0 +nan.0)' | |
2550 | returned #t. | |
2551 | ||
2552 | *** `(equal? +nan.0 +nan.0)' now returns #t | |
2553 | ||
2554 | Previously, `(equal? +nan.0 +nan.0)' returned #f, although | |
2555 | `(let ((x +nan.0)) (equal? x x))' and `(eqv? +nan.0 +nan.0)' | |
2556 | both returned #t. R5RS requires that `equal?' behave like | |
2557 | `eqv?' when comparing numbers. | |
2558 | ||
2559 | *** Change in handling products `*' involving exact 0 | |
2560 | ||
2561 | scm_product `*' now handles exact 0 differently. A product containing | |
2562 | an exact 0 now returns an exact 0 if and only if the other arguments | |
2563 | are all exact. An inexact zero is returned if and only if the other | |
2564 | arguments are all finite but not all exact. If an infinite or NaN | |
2565 | value is present, a NaN value is returned. Previously, any product | |
2566 | containing an exact 0 yielded an exact 0, regardless of the other | |
2567 | arguments. | |
2568 | ||
2569 | *** `expt' and `integer-expt' changes when the base is 0 | |
2570 | ||
2571 | While `(expt 0 0)' is still 1, and `(expt 0 N)' for N > 0 is still | |
2572 | zero, `(expt 0 N)' for N < 0 is now a NaN value, and likewise for | |
2573 | integer-expt. This is more correct, and conforming to R6RS, but seems | |
2574 | to be incompatible with R5RS, which would return 0 for all non-zero | |
2575 | values of N. | |
2576 | ||
2577 | *** `expt' and `integer-expt' are more generic, less strict | |
2578 | ||
2579 | When raising to an exact non-negative integer exponent, `expt' and | |
2580 | `integer-expt' are now able to exponentiate any object that can be | |
2581 | multiplied using `*'. They can also raise an object to an exact | |
2582 | negative integer power if its reciprocal can be taken using `/'. | |
2583 | In order to allow this, the type of the first argument is no longer | |
2584 | checked when raising to an exact integer power. If the exponent is 0 | |
2585 | or 1, the first parameter is not manipulated at all, and need not | |
2586 | even support multiplication. | |
2587 | ||
2588 | *** Infinities are no longer integers, nor rationals | |
2589 | ||
2590 | scm_integer_p `integer?' and scm_rational_p `rational?' now return #f | |
2591 | for infinities, per R6RS. Previously they returned #t for real | |
2592 | infinities. The real infinities and NaNs are still considered real by | |
2593 | scm_real `real?' however, per R6RS. | |
2594 | ||
2595 | *** NaNs are no longer rationals | |
2596 | ||
2597 | scm_rational_p `rational?' now returns #f for NaN values, per R6RS. | |
2598 | Previously it returned #t for real NaN values. They are still | |
2599 | considered real by scm_real `real?' however, per R6RS. | |
2600 | ||
2601 | *** `inf?' and `nan?' now throw exceptions for non-reals | |
2602 | ||
2603 | The domain of `inf?' and `nan?' is the real numbers. Guile now signals | |
2604 | an error when a non-real number or non-number is passed to these | |
2605 | procedures. (Note that NaNs _are_ considered numbers by scheme, despite | |
2606 | their name). | |
2607 | ||
2608 | *** `rationalize' bugfixes and changes | |
2609 | ||
2610 | Fixed bugs in scm_rationalize `rationalize'. Previously, it returned | |
2611 | exact integers unmodified, although that was incorrect if the epsilon | |
2612 | was at least 1 or inexact, e.g. (rationalize 4 1) should return 3 per | |
2613 | R5RS and R6RS, but previously it returned 4. It also now handles | |
2614 | cases involving infinities and NaNs properly, per R6RS. | |
2615 | ||
2616 | *** Trigonometric functions now return exact numbers in some cases | |
2617 | ||
2618 | scm_sin `sin', scm_cos `cos', scm_tan `tan', scm_asin `asin', scm_acos | |
2619 | `acos', scm_atan `atan', scm_sinh `sinh', scm_cosh `cosh', scm_tanh | |
2620 | `tanh', scm_sys_asinh `asinh', scm_sys_acosh `acosh', and | |
2621 | scm_sys_atanh `atanh' now return exact results in some cases. | |
2622 | ||
2623 | *** New procedure: `finite?' | |
2624 | ||
2625 | Add scm_finite_p `finite?' from R6RS to guile core, which returns #t | |
2626 | if and only if its argument is neither infinite nor a NaN. Note that | |
2627 | this is not the same as (not (inf? x)) or (not (infinite? x)), since | |
2628 | NaNs are neither finite nor infinite. | |
2629 | ||
2630 | *** Improved exactness handling for complex number parsing | |
2631 | ||
2632 | When parsing non-real complex numbers, exactness specifiers are now | |
2633 | applied to each component, as is done in PLT Scheme. For complex | |
2634 | numbers written in rectangular form, exactness specifiers are applied | |
2635 | to the real and imaginary parts before calling scm_make_rectangular. | |
2636 | For complex numbers written in polar form, exactness specifiers are | |
2637 | applied to the magnitude and angle before calling scm_make_polar. | |
2638 | ||
2639 | Previously, exactness specifiers were applied to the number as a whole | |
2640 | _after_ calling scm_make_rectangular or scm_make_polar. | |
2641 | ||
2642 | For example, (string->number "#i5.0+0i") now does the equivalent of: | |
2643 | ||
2644 | (make-rectangular (exact->inexact 5.0) (exact->inexact 0)) | |
2645 | ||
2646 | which yields 5.0+0.0i. Previously it did the equivalent of: | |
2647 | ||
2648 | (exact->inexact (make-rectangular 5.0 0)) | |
2649 | ||
2650 | which yielded 5.0. | |
2651 | ||
108e18b1 AW |
2652 | ** Unicode characters |
2653 | ||
2654 | Unicode characters may be entered in octal format via e.g. `#\454', or | |
2655 | created via (integer->char 300). A hex external representation will | |
2656 | probably be introduced at some point. | |
2657 | ||
2658 | ** Unicode strings | |
2659 | ||
2660 | Internally, strings are now represented either in the `latin-1' | |
2661 | encoding, one byte per character, or in UTF-32, with four bytes per | |
2662 | character. Strings manage their own allocation, switching if needed. | |
2663 | ||
99e31c32 AW |
2664 | Extended characters may be written in a literal string using the |
2665 | hexadecimal escapes `\xXX', `\uXXXX', or `\UXXXXXX', for 8-bit, 16-bit, | |
2666 | or 24-bit codepoints, respectively, or entered directly in the native | |
2667 | encoding of the port on which the string is read. | |
2668 | ||
56664c08 AW |
2669 | ** Unicode symbols |
2670 | ||
2671 | One may now use U+03BB (GREEK SMALL LETTER LAMBDA) as an identifier. | |
2672 | ||
99e31c32 AW |
2673 | ** Support for non-ASCII source code files |
2674 | ||
2675 | The default reader now handles source code files for some of the | |
2676 | non-ASCII character encodings, such as UTF-8. A non-ASCII source file | |
2677 | should have an encoding declaration near the top of the file. Also, | |
2678 | there is a new function, `file-encoding', that scans a port for a coding | |
2679 | declaration. See the section of the manual entitled, "Character Encoding | |
2680 | of Source Files". | |
2681 | ||
2682 | The pre-1.9.3 reader handled 8-bit clean but otherwise unspecified source | |
51cb0cca AW |
2683 | code. This use is now discouraged. Binary input and output is |
2684 | currently supported by opening ports in the ISO-8859-1 locale. | |
99e31c32 | 2685 | |
487bacf4 AW |
2686 | ** Source files default to UTF-8. |
2687 | ||
2688 | If source files do not specify their encoding via a `coding:' block, | |
2689 | the default encoding is UTF-8, instead of being taken from the current | |
2690 | locale. | |
2691 | ||
2692 | ** Interactive Guile installs the current locale. | |
2693 | ||
2694 | Instead of leaving the user in the "C" locale, running the Guile REPL | |
2695 | installs the current locale. [FIXME xref?] | |
2696 | ||
99e31c32 AW |
2697 | ** Support for locale transcoding when reading from and writing to ports |
2698 | ||
2699 | Ports now have an associated character encoding, and port read and write | |
2700 | operations do conversion to and from locales automatically. Ports also | |
2701 | have an associated strategy for how to deal with locale conversion | |
2702 | failures. | |
2703 | ||
2704 | See the documentation in the manual for the four new support functions, | |
2705 | `set-port-encoding!', `port-encoding', `set-port-conversion-strategy!', | |
2706 | and `port-conversion-strategy'. | |
2707 | ||
2708 | ** String and SRFI-13 functions can operate on Unicode strings | |
2709 | ||
2710 | ** Unicode support for SRFI-14 character sets | |
2711 | ||
2712 | The default character sets are no longer locale dependent and contain | |
2713 | characters from the whole Unicode range. There is a new predefined | |
2714 | character set, `char-set:designated', which contains all assigned | |
2715 | Unicode characters. There is a new debugging function, `%char-set-dump'. | |
2716 | ||
2717 | ** Character functions operate on Unicode characters | |
2718 | ||
2719 | `char-upcase' and `char-downcase' use default Unicode casing rules. | |
2720 | Character comparisons such as `char<?' and `char-ci<?' now sort based on | |
2721 | Unicode code points. | |
108e18b1 AW |
2722 | |
2723 | ** Global variables `scm_charnames' and `scm_charnums' are removed | |
2724 | ||
2725 | These variables contained the names of control characters and were | |
2726 | used when writing characters. While these were global, they were | |
2727 | never intended to be public API. They have been replaced with private | |
2728 | functions. | |
2729 | ||
2730 | ** EBCDIC support is removed | |
2731 | ||
2732 | There was an EBCDIC compile flag that altered some of the character | |
2733 | processing. It appeared that full EBCDIC support was never completed | |
2734 | and was unmaintained. | |
2735 | ||
6bf927ab | 2736 | ** Compile-time warnings |
b0217d17 AW |
2737 | |
2738 | Guile can warn about potentially unbound free variables. Pass the | |
2739 | -Wunbound-variable on the `guile-tools compile' command line, or add | |
2740 | `#:warnings '(unbound-variable)' to your `compile' or `compile-file' | |
51cb0cca AW |
2741 | invocation. Warnings are also enabled by default for expressions entered |
2742 | at the REPL. | |
b0217d17 | 2743 | |
6cf43047 AW |
2744 | Guile can also warn when you pass the wrong number of arguments to a |
2745 | procedure, with -Warity-mismatch, or `arity-mismatch' in the | |
2746 | `#:warnings' as above. | |
2747 | ||
6bf927ab | 2748 | Other warnings include `-Wunused-variable' and `-Wunused-toplevel', to |
ef6b0e8d AW |
2749 | warn about unused local or global (top-level) variables, and `-Wformat', |
2750 | to check for various errors related to the `format' procedure. | |
6bf927ab | 2751 | |
93617170 LC |
2752 | ** A new `memoize-symbol' evaluator trap has been added. |
2753 | ||
2754 | This trap can be used for efficiently implementing a Scheme code | |
2755 | coverage. | |
fa1804e9 | 2756 | |
96b73e84 | 2757 | ** Duplicate bindings among used modules are resolved lazily. |
93617170 | 2758 | |
96b73e84 | 2759 | This slightly improves program startup times. |
fa1804e9 | 2760 | |
96b73e84 | 2761 | ** New thread cancellation and thread cleanup API |
93617170 | 2762 | |
96b73e84 | 2763 | See `cancel-thread', `set-thread-cleanup!', and `thread-cleanup'. |
fa1804e9 | 2764 | |
51cb0cca AW |
2765 | ** New threads are in `(guile-user)' by default, not `(guile)' |
2766 | ||
2767 | It used to be that a new thread entering Guile would do so in the | |
2768 | `(guile)' module, unless this was the first time Guile was initialized, | |
2769 | in which case it was `(guile-user)'. This has been fixed to have all | |
2770 | new threads unknown to Guile default to `(guile-user)'. | |
2771 | ||
b47fea09 AW |
2772 | ** New helpers: `print-exception', `set-exception-printer!' |
2773 | ||
2774 | These functions implement an extensible exception printer. Guile | |
2775 | registers printers for all of the exceptions it throws. Users may add | |
2776 | their own printers. There is also `scm_print_exception', for use by C | |
2777 | programs. Pleasantly, this allows SRFI-35 and R6RS exceptions to be | |
2778 | printed appropriately. | |
2779 | ||
4a457691 AW |
2780 | ** GOOPS dispatch in scheme |
2781 | ||
2782 | As an implementation detail, GOOPS dispatch is no longer implemented by | |
2783 | special evaluator bytecodes, but rather directly via a Scheme function | |
2784 | associated with an applicable struct. There is some VM support for the | |
2785 | underlying primitives, like `class-of'. | |
2786 | ||
2787 | This change will in the future allow users to customize generic function | |
2788 | dispatch without incurring a performance penalty, and allow us to | |
2789 | implement method combinations. | |
2790 | ||
4a457691 AW |
2791 | ** Applicable struct support |
2792 | ||
2793 | One may now make structs from Scheme that may be applied as procedures. | |
2794 | To do so, make a struct whose vtable is `<applicable-struct-vtable>'. | |
2795 | That struct will be the vtable of your applicable structs; instances of | |
2796 | that new struct are assumed to have the procedure in their first slot. | |
2797 | `<applicable-struct-vtable>' is like Common Lisp's | |
2798 | `funcallable-standard-class'. Likewise there is | |
2799 | `<applicable-struct-with-setter-vtable>', which looks for the setter in | |
2800 | the second slot. This needs to be better documented. | |
2801 | ||
29b98fb2 AW |
2802 | ** GOOPS cleanups. |
2803 | ||
2804 | GOOPS had a number of concepts that were relevant to the days of Tcl, | |
2805 | but not any more: operators and entities, mainly. These objects were | |
2806 | never documented, and it is unlikely that they were ever used. Operators | |
2807 | were a kind of generic specific to the Tcl support. Entities were | |
2808 | replaced by applicable structs, mentioned above. | |
2809 | ||
4a457691 AW |
2810 | ** New struct slot allocation: "hidden" |
2811 | ||
2812 | A hidden slot is readable and writable, but will not be initialized by a | |
2813 | call to make-struct. For example in your layout you would say "ph" | |
2814 | instead of "pw". Hidden slots are useful for adding new slots to a | |
2815 | vtable without breaking existing invocations to make-struct. | |
2816 | ||
2817 | ** eqv? not a generic | |
2818 | ||
2819 | One used to be able to extend `eqv?' as a primitive-generic, but no | |
2820 | more. Because `eqv?' is in the expansion of `case' (via `memv'), which | |
2821 | should be able to compile to static dispatch tables, it doesn't make | |
2822 | sense to allow extensions that would subvert this optimization. | |
2823 | ||
e614d375 AW |
2824 | ** `inet-ntop' and `inet-pton' are always available. |
2825 | ||
2826 | Guile now use a portable implementation of `inet_pton'/`inet_ntop', so | |
2827 | there is no more need to use `inet-aton'/`inet-ntoa'. The latter | |
2828 | functions are deprecated. | |
2829 | ||
b47fea09 AW |
2830 | ** `getopt-long' parsing errors throw to `quit', not `misc-error' |
2831 | ||
2832 | This change should inhibit backtraces on argument parsing errors. | |
2833 | `getopt-long' has been modified to print out the error that it throws | |
2834 | itself. | |
2835 | ||
51cb0cca AW |
2836 | ** New primitive: `tmpfile'. |
2837 | ||
2838 | See "File System" in the manual. | |
2839 | ||
2840 | ** Random generator state may be serialized to a datum | |
2841 | ||
2842 | `random-state->datum' will serialize a random state to a datum, which | |
2843 | may be written out, read back in later, and revivified using | |
2844 | `datum->random-state'. See "Random" in the manual, for more details. | |
2845 | ||
2846 | ** Fix random number generator on 64-bit platforms | |
2847 | ||
2848 | There was a nasty bug on 64-bit platforms in which asking for a random | |
2849 | integer with a range between 2**32 and 2**64 caused a segfault. After | |
2850 | many embarrassing iterations, this was fixed. | |
2851 | ||
5bb408cc AW |
2852 | ** Fast bit operations. |
2853 | ||
2854 | The bit-twiddling operations `ash', `logand', `logior', and `logxor' now | |
2855 | have dedicated bytecodes. Guile is not just for symbolic computation, | |
2856 | it's for number crunching too. | |
2857 | ||
4a457691 AW |
2858 | ** Faster SRFI-9 record access |
2859 | ||
2860 | SRFI-9 records are now implemented directly on top of Guile's structs, | |
2861 | and their accessors are defined in such a way that normal call-sites | |
2862 | inline to special VM opcodes, while still allowing for the general case | |
2863 | (e.g. passing a record accessor to `apply'). | |
2864 | ||
e614d375 AW |
2865 | ** R6RS block comment support |
2866 | ||
2867 | Guile now supports R6RS nested block comments. The start of a comment is | |
2868 | marked with `#|', and the end with `|#'. | |
2869 | ||
2870 | ** `guile-2' cond-expand feature | |
2871 | ||
2872 | To test if your code is running under Guile 2.0 (or its alpha releases), | |
2873 | test for the `guile-2' cond-expand feature. Like this: | |
2874 | ||
2875 | (cond-expand (guile-2 (eval-when (compile) | |
2876 | ;; This must be evaluated at compile time. | |
2877 | (fluid-set! current-reader my-reader))) | |
2878 | (guile | |
2879 | ;; Earlier versions of Guile do not have a | |
2880 | ;; separate compilation phase. | |
2881 | (fluid-set! current-reader my-reader))) | |
2882 | ||
96b73e84 | 2883 | ** New global variables: %load-compiled-path, %load-compiled-extensions |
fa1804e9 | 2884 | |
96b73e84 | 2885 | These are analogous to %load-path and %load-extensions. |
fa1804e9 | 2886 | |
18e90860 AW |
2887 | ** New fluid: `%file-port-name-canonicalization' |
2888 | ||
2889 | This fluid parameterizes the file names that are associated with file | |
2890 | ports. If %file-port-name-canonicalization is 'absolute, then file names | |
2891 | are canonicalized to be absolute paths. If it is 'relative, then the | |
2892 | name is canonicalized, but any prefix corresponding to a member of | |
2893 | `%load-path' is stripped off. Otherwise the names are passed through | |
2894 | unchanged. | |
2895 | ||
2896 | In addition, the `compile-file' and `compile-and-load' procedures bind | |
2897 | %file-port-name-canonicalization to their `#:canonicalization' keyword | |
2898 | argument, which defaults to 'relative. In this way, one might compile | |
2899 | "../module/ice-9/boot-9.scm", but the path that gets residualized into | |
2900 | the .go is "ice-9/boot-9.scm". | |
2901 | ||
96b73e84 | 2902 | ** New procedure, `make-promise' |
fa1804e9 | 2903 | |
96b73e84 | 2904 | `(make-promise (lambda () foo))' is equivalent to `(delay foo)'. |
fa1804e9 | 2905 | |
108e18b1 AW |
2906 | ** `defined?' may accept a module as its second argument |
2907 | ||
2908 | Previously it only accepted internal structures from the evaluator. | |
2909 | ||
96b73e84 | 2910 | ** New entry into %guile-build-info: `ccachedir' |
fa1804e9 | 2911 | |
96b73e84 | 2912 | ** Fix bug in `module-bound?'. |
fa1804e9 | 2913 | |
96b73e84 AW |
2914 | `module-bound?' was returning true if a module did have a local |
2915 | variable, but one that was unbound, but another imported module bound | |
2916 | the variable. This was an error, and was fixed. | |
fa1804e9 | 2917 | |
96b73e84 | 2918 | ** `(ice-9 syncase)' has been deprecated. |
fa1804e9 | 2919 | |
96b73e84 AW |
2920 | As syntax-case is available by default, importing `(ice-9 syncase)' has |
2921 | no effect, and will trigger a deprecation warning. | |
fa1804e9 | 2922 | |
b0217d17 AW |
2923 | ** New readline history functions |
2924 | ||
2925 | The (ice-9 readline) module now provides add-history, read-history, | |
2926 | write-history and clear-history, which wrap the corresponding GNU | |
2927 | History library functions. | |
2928 | ||
86d88a22 AW |
2929 | ** Removed deprecated uniform array procedures: |
2930 | dimensions->uniform-array, list->uniform-array, array-prototype | |
2931 | ||
2932 | Instead, use make-typed-array, list->typed-array, or array-type, | |
2933 | respectively. | |
2934 | ||
51cb0cca AW |
2935 | ** Deprecate the old `scm-style-repl' |
2936 | ||
2937 | The following bindings from boot-9 are now found in `(ice-9 | |
2938 | scm-style-repl)': `scm-style-repl', `error-catching-loop', | |
2939 | `error-catching-repl', `bad-throw', `scm-repl-silent' | |
2940 | `assert-repl-silence', `repl-print-unspecified', | |
2941 | `assert-repl-print-unspecified', `scm-repl-verbose', | |
2942 | `assert-repl-verbosity', `scm-repl-prompt', `set-repl-prompt!', `repl', | |
2943 | `default-pre-unwind-handler', `handle-system-error', | |
2944 | ||
2945 | The following bindings have been deprecated, with no replacement: | |
2946 | `pre-unwind-handler-dispatch'. | |
2947 | ||
2948 | The following bindings have been totally removed: | |
2949 | `before-signal-stack'. | |
2950 | ||
2951 | Deprecated forwarding shims have been installed so that users that | |
2952 | expect these bindings in the main namespace will still work, but receive | |
2953 | a deprecation warning. | |
2954 | ||
2955 | ** `set-batch-mode?!' replaced by `ensure-batch-mode!' | |
2956 | ||
2957 | "Batch mode" is a flag used to tell a program that it is not running | |
2958 | interactively. One usually turns it on after a fork. It may not be | |
2959 | turned off. `ensure-batch-mode!' deprecates the old `set-batch-mode?!', | |
2960 | because it is a better interface, as it can only turn on batch mode, not | |
2961 | turn it off. | |
2962 | ||
2963 | ** Deprecate `save-stack', `the-last-stack' | |
2964 | ||
2965 | It used to be that the way to debug programs in Guile was to capture the | |
2966 | stack at the time of error, drop back to the REPL, then debug that | |
2967 | stack. But this approach didn't compose, was tricky to get right in the | |
2968 | presence of threads, and was not very powerful. | |
2969 | ||
2970 | So `save-stack', `stack-saved?', and `the-last-stack' have been moved to | |
2971 | `(ice-9 save-stack)', with deprecated bindings left in the root module. | |
2972 | ||
2973 | ** `top-repl' has its own module | |
2974 | ||
2975 | The `top-repl' binding, called with Guile is run interactively, is now | |
2976 | is its own module, `(ice-9 top-repl)'. A deprecated forwarding shim was | |
2977 | left in the default environment. | |
2978 | ||
2979 | ** `display-error' takes a frame | |
2980 | ||
2981 | The `display-error' / `scm_display_error' helper now takes a frame as an | |
2982 | argument instead of a stack. Stacks are still supported in deprecated | |
2983 | builds. Additionally, `display-error' will again source location | |
2984 | information for the error. | |
2985 | ||
2986 | ** No more `(ice-9 debug)' | |
2987 | ||
2988 | This module had some debugging helpers that are no longer applicable to | |
2989 | the current debugging model. Importing this module will produce a | |
2990 | deprecation warning. Users should contact bug-guile for support. | |
2991 | ||
ef6b0e8d AW |
2992 | ** Remove obsolete debug-options |
2993 | ||
2994 | Removed `breakpoints', `trace', `procnames', `indent', `frames', | |
2995 | `maxdepth', and `debug' debug-options. | |
2996 | ||
2997 | ** `backtrace' debug option on by default | |
2998 | ||
2999 | Given that Guile 2.0 can always give you a backtrace, backtraces are now | |
3000 | on by default. | |
3001 | ||
3002 | ** `turn-on-debugging' deprecated | |
3003 | ||
3004 | ** Remove obsolete print-options | |
3005 | ||
3006 | The `source' and `closure-hook' print options are obsolete, and have | |
3007 | been removed. | |
3008 | ||
3009 | ** Remove obsolete read-options | |
3010 | ||
3011 | The "elisp-strings" and "elisp-vectors" read options were unused and | |
3012 | obsolete, so they have been removed. | |
3013 | ||
3014 | ** Remove eval-options and trap-options | |
3015 | ||
3016 | Eval-options and trap-options are obsolete with the new VM and | |
3017 | evaluator. | |
3018 | ||
3019 | ** Remove (ice-9 debugger) and (ice-9 debugging) | |
3020 | ||
3021 | See "Traps" and "Interactive Debugging" in the manual, for information | |
3022 | on their replacements. | |
3023 | ||
3024 | ** Remove the GDS Emacs integration | |
3025 | ||
3026 | See "Using Guile in Emacs" in the manual, for info on how we think you | |
3027 | should use Guile with Emacs. | |
3028 | ||
b0abbaa7 AW |
3029 | ** Deprecated: `lazy-catch' |
3030 | ||
3031 | `lazy-catch' was a form that captured the stack at the point of a | |
3032 | `throw', but the dynamic state at the point of the `catch'. It was a bit | |
3033 | crazy. Please change to use `catch', possibly with a throw-handler, or | |
3034 | `with-throw-handler'. | |
3035 | ||
487bacf4 AW |
3036 | ** Deprecated: primitive properties |
3037 | ||
3038 | The `primitive-make-property', `primitive-property-set!', | |
3039 | `primitive-property-ref', and `primitive-property-del!' procedures were | |
3040 | crufty and only used to implement object properties, which has a new, | |
3041 | threadsafe implementation. Use object properties or weak hash tables | |
3042 | instead. | |
3043 | ||
18e90860 AW |
3044 | ** Deprecated `@bind' syntax |
3045 | ||
3046 | `@bind' was part of an older implementation of the Emacs Lisp language, | |
3047 | and is no longer used. | |
3048 | ||
51cb0cca AW |
3049 | ** Miscellaneous other deprecations |
3050 | ||
7cd99cba AW |
3051 | `cuserid' has been deprecated, as it only returns 8 bytes of a user's |
3052 | login. Use `(passwd:name (getpwuid (geteuid)))' instead. | |
3053 | ||
487bacf4 AW |
3054 | Additionally, the procedures `apply-to-args', `has-suffix?', `scheme-file-suffix' |
3055 | `get-option', `for-next-option', `display-usage-report', | |
3056 | `transform-usage-lambda', `collect', and `set-batch-mode?!' have all | |
3057 | been deprecated. | |
3058 | ||
7cd99cba AW |
3059 | ** Add support for unbound fluids |
3060 | ||
3061 | See `make-unbound-fluid', `fluid-unset!', and `fluid-bound?' in the | |
3062 | manual. | |
3063 | ||
3064 | ** Add `variable-unset!' | |
3065 | ||
3066 | See "Variables" in the manual, for more details. | |
51cb0cca | 3067 | |
87e00370 LC |
3068 | ** Last but not least, the `λ' macro can be used in lieu of `lambda' |
3069 | ||
96b73e84 | 3070 | * Changes to the C interface |
fa1804e9 | 3071 | |
7b96f3dd LC |
3072 | ** Guile now uses libgc, the Boehm-Demers-Weiser garbage collector |
3073 | ||
3074 | The semantics of `scm_gc_malloc ()' have been changed, in a | |
3075 | backward-compatible way. A new allocation routine, | |
3076 | `scm_gc_malloc_pointerless ()', was added. | |
3077 | ||
3078 | Libgc is a conservative GC, which we hope will make interaction with C | |
3079 | code easier and less error-prone. | |
3080 | ||
487bacf4 AW |
3081 | ** New procedures: `scm_to_stringn', `scm_from_stringn' |
3082 | ** New procedures: scm_{to,from}_{utf8,latin1}_symbol{n,} | |
3083 | ** New procedures: scm_{to,from}_{utf8,utf32,latin1}_string{n,} | |
3084 | ||
3085 | These new procedures convert to and from string representations in | |
3086 | particular encodings. | |
ef6b0e8d | 3087 | |
487bacf4 AW |
3088 | Users should continue to use locale encoding for user input, user |
3089 | output, or interacting with the C library. | |
ef6b0e8d | 3090 | |
487bacf4 | 3091 | Use the Latin-1 functions for ASCII, and for literals in source code. |
ef6b0e8d | 3092 | |
487bacf4 AW |
3093 | Use UTF-8 functions for interaction with modern libraries which deal in |
3094 | UTF-8, and UTF-32 for interaction with utf32-using libraries. | |
3095 | ||
3096 | Otherwise, use scm_to_stringn or scm_from_stringn with a specific | |
3097 | encoding. | |
ef6b0e8d | 3098 | |
4a457691 AW |
3099 | ** New type definitions for `scm_t_intptr' and friends. |
3100 | ||
3101 | `SCM_T_UINTPTR_MAX', `SCM_T_INTPTR_MIN', `SCM_T_INTPTR_MAX', | |
3102 | `SIZEOF_SCM_T_BITS', `scm_t_intptr' and `scm_t_uintptr' are now | |
3103 | available to C. Have fun! | |
3104 | ||
96b73e84 | 3105 | ** The GH interface (deprecated in version 1.6, 2001) was removed. |
fa1804e9 | 3106 | |
96b73e84 | 3107 | ** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF |
fa1804e9 | 3108 | |
96b73e84 AW |
3109 | This makes these internal functions technically not callable from |
3110 | application code. | |
fa1804e9 | 3111 | |
96b73e84 AW |
3112 | ** Functions for handling `scm_option' now no longer require an argument |
3113 | indicating length of the `scm_t_option' array. | |
fa1804e9 | 3114 | |
4a457691 AW |
3115 | ** Procedures-with-setters are now implemented using applicable structs |
3116 | ||
3117 | From a user's perspective this doesn't mean very much. But if, for some | |
3118 | odd reason, you used the SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE, or | |
3119 | SCM_SETTER macros, know that they're deprecated now. Also, scm_tc7_pws | |
3120 | is gone. | |
3121 | ||
3122 | ** Remove old evaluator closures | |
3123 | ||
3124 | There used to be ranges of typecodes allocated to interpreted data | |
3125 | structures, but that it no longer the case, given that interpreted | |
3126 | procedure are now just regular VM closures. As a result, there is a | |
3127 | newly free tc3, and a number of removed macros. See the ChangeLog for | |
3128 | details. | |
3129 | ||
cf8ec359 | 3130 | ** Primitive procedures are now VM trampoline procedures |
4a457691 AW |
3131 | |
3132 | It used to be that there were something like 12 different typecodes | |
3133 | allocated to primitive procedures, each with its own calling convention. | |
3134 | Now there is only one, the gsubr. This may affect user code if you were | |
3135 | defining a procedure using scm_c_make_subr rather scm_c_make_gsubr. The | |
3136 | solution is to switch to use scm_c_make_gsubr. This solution works well | |
b3da54d1 | 3137 | both with the old 1.8 and with the current 1.9 branch. |
4a457691 | 3138 | |
cf8ec359 AW |
3139 | Guile's old evaluator used to have special cases for applying "gsubrs", |
3140 | primitive procedures with specified numbers of required, optional, and | |
3141 | rest arguments. Now, however, Guile represents gsubrs as normal VM | |
3142 | procedures, with appropriate bytecode to parse out the correct number of | |
3143 | arguments, including optional and rest arguments, and then with a | |
3144 | special bytecode to apply the gsubr. | |
3145 | ||
3146 | This allows primitive procedures to appear on the VM stack, allowing | |
3147 | them to be accurately counted in profiles. Also they now have more | |
3148 | debugging information attached to them -- their number of arguments, for | |
3149 | example. In addition, the VM can completely inline the application | |
3150 | mechanics, allowing for faster primitive calls. | |
3151 | ||
3152 | However there are some changes on the C level. There is no more | |
3153 | `scm_tc7_gsubr' or `scm_tcs_subrs' typecode for primitive procedures, as | |
3154 | they are just VM procedures. Likewise the macros `SCM_GSUBR_TYPE', | |
3155 | `SCM_GSUBR_MAKTYPE', `SCM_GSUBR_REQ', `SCM_GSUBR_OPT', and | |
3156 | `SCM_GSUBR_REST' are gone, as are `SCM_SUBR_META_INFO', `SCM_SUBR_PROPS' | |
3157 | `SCM_SET_SUBR_GENERIC_LOC', and `SCM_SUBR_ARITY_TO_TYPE'. | |
3158 | ||
3159 | Perhaps more significantly, `scm_c_make_subr', | |
3160 | `scm_c_make_subr_with_generic', `scm_c_define_subr', and | |
3161 | `scm_c_define_subr_with_generic'. They all operated on subr typecodes, | |
3162 | and there are no more subr typecodes. Use the scm_c_make_gsubr family | |
3163 | instead. | |
3164 | ||
3165 | Normal users of gsubrs should not be affected, though, as the | |
3166 | scm_c_make_gsubr family still is the correct way to create primitive | |
3167 | procedures. | |
3168 | ||
3169 | ** Remove deprecated array C interfaces | |
3170 | ||
3171 | Removed the deprecated array functions `scm_i_arrayp', | |
3172 | `scm_i_array_ndim', `scm_i_array_mem', `scm_i_array_v', | |
3173 | `scm_i_array_base', `scm_i_array_dims', and the deprecated macros | |
3174 | `SCM_ARRAYP', `SCM_ARRAY_NDIM', `SCM_ARRAY_CONTP', `SCM_ARRAY_MEM', | |
3175 | `SCM_ARRAY_V', `SCM_ARRAY_BASE', and `SCM_ARRAY_DIMS'. | |
3176 | ||
3177 | ** Remove unused snarf macros | |
3178 | ||
3179 | `SCM_DEFINE1', `SCM_PRIMITIVE_GENERIC_1', `SCM_PROC1, and `SCM_GPROC1' | |
3180 | are no more. Use SCM_DEFINE or SCM_PRIMITIVE_GENERIC instead. | |
3181 | ||
cf8ec359 AW |
3182 | ** New functions: `scm_call_n', `scm_c_run_hookn' |
3183 | ||
3184 | `scm_call_n' applies to apply a function to an array of arguments. | |
3185 | `scm_c_run_hookn' runs a hook with an array of arguments. | |
3186 | ||
4a457691 AW |
3187 | ** Some SMOB types changed to have static typecodes |
3188 | ||
3189 | Fluids, dynamic states, and hash tables used to be SMOB objects, but now | |
3190 | they have statically allocated tc7 typecodes. | |
3191 | ||
3192 | ** Preparations for changing SMOB representation | |
3193 | ||
3194 | If things go right, we'll be changing the SMOB representation soon. To | |
3195 | that end, we did a lot of cleanups to calls to e.g. SCM_CELL_WORD_2(x) when | |
3196 | the code meant SCM_SMOB_DATA_2(x); user code will need similar changes | |
3197 | in the future. Code accessing SMOBs using SCM_CELL macros was never | |
3198 | correct, but until now things still worked. Users should be aware of | |
3199 | such changes. | |
fa1804e9 | 3200 | |
cf8ec359 AW |
3201 | ** Changed invocation mechanics of applicable SMOBs |
3202 | ||
3203 | Guile's old evaluator used to have special cases for applying SMOB | |
3204 | objects. Now, with the VM, when Guile sees a SMOB, it looks up a VM | |
3205 | trampoline procedure for it, and use the normal mechanics to apply the | |
3206 | trampoline. This simplifies procedure application in the normal, | |
3207 | non-SMOB case. | |
3208 | ||
3209 | The upshot is that the mechanics used to apply a SMOB are different from | |
3210 | 1.8. Descriptors no longer have `apply_0', `apply_1', `apply_2', and | |
3211 | `apply_3' functions, and the macros SCM_SMOB_APPLY_0 and friends are now | |
3212 | deprecated. Just use the scm_call_0 family of procedures. | |
3213 | ||
ef6b0e8d AW |
3214 | ** Removed support shlibs for SRFIs 1, 4, 13, 14, and 60 |
3215 | ||
3216 | Though these SRFI support libraries did expose API, they encoded a | |
3217 | strange version string into their library names. That version was never | |
3218 | programmatically exported, so there was no way people could use the | |
3219 | libs. | |
3220 | ||
3221 | This was a fortunate oversight, as it allows us to remove the need for | |
3222 | extra, needless shared libraries --- the C support code for SRFIs 4, 13, | |
3223 | and 14 was already in core --- and allow us to incrementally return the | |
3224 | SRFI implementation to Scheme. | |
3225 | ||
96b73e84 | 3226 | ** New C function: scm_module_public_interface |
a4f1c77d | 3227 | |
96b73e84 | 3228 | This procedure corresponds to Scheme's `module-public-interface'. |
24d6fae8 | 3229 | |
4a457691 AW |
3230 | ** Undeprecate `scm_the_root_module ()' |
3231 | ||
3232 | It's useful to be able to get the root module from C without doing a | |
3233 | full module lookup. | |
3234 | ||
e614d375 AW |
3235 | ** Inline vector allocation |
3236 | ||
3237 | Instead of having vectors point out into the heap for their data, their | |
3238 | data is now allocated inline to the vector object itself. The same is | |
3239 | true for bytevectors, by default, though there is an indirection | |
3240 | available which should allow for making a bytevector from an existing | |
3241 | memory region. | |
3242 | ||
4a457691 AW |
3243 | ** New struct constructors that don't involve making lists |
3244 | ||
3245 | `scm_c_make_struct' and `scm_c_make_structv' are new varargs and array | |
3246 | constructors, respectively, for structs. You might find them useful. | |
3247 | ||
3248 | ** Stack refactor | |
3249 | ||
3250 | In Guile 1.8, there were debugging frames on the C stack. Now there is | |
3251 | no more need to explicitly mark the stack in this way, because Guile has | |
3252 | a VM stack that it knows how to walk, which simplifies the C API | |
3253 | considerably. See the ChangeLog for details; the relevant interface is | |
3254 | in libguile/stacks.h. The Scheme API has not been changed significantly. | |
3255 | ||
e614d375 AW |
3256 | ** Removal of Guile's primitive object system. |
3257 | ||
3258 | There were a number of pieces in `objects.[ch]' that tried to be a | |
3259 | minimal object system, but were never documented, and were quickly | |
3260 | obseleted by GOOPS' merge into Guile proper. So `scm_make_class_object', | |
3261 | `scm_make_subclass_object', `scm_metaclass_standard', and like symbols | |
3262 | from objects.h are no more. In the very unlikely case in which these | |
3263 | were useful to you, we urge you to contact guile-devel. | |
3264 | ||
3265 | ** No future. | |
3266 | ||
3267 | Actually the future is still in the state that it was, is, and ever | |
3268 | shall be, Amen, except that `futures.c' and `futures.h' are no longer a | |
3269 | part of it. These files were experimental, never compiled, and would be | |
3270 | better implemented in Scheme anyway. In the future, that is. | |
3271 | ||
4a457691 AW |
3272 | ** Deprecate trampolines |
3273 | ||
3274 | There used to be C functions `scm_trampoline_0', `scm_trampoline_1', and | |
3275 | so on. The point was to do some precomputation on the type of the | |
3276 | procedure, then return a specialized "call" procedure. However this | |
3277 | optimization wasn't actually an optimization, so it is now deprecated. | |
3278 | Just use `scm_call_0', etc instead. | |
3279 | ||
18e90860 AW |
3280 | ** Deprecated `scm_badargsp' |
3281 | ||
3282 | This function is unused in Guile, but was part of its API. | |
3283 | ||
5bb408cc AW |
3284 | ** Better support for Lisp `nil'. |
3285 | ||
3286 | The bit representation of `nil' has been tweaked so that it is now very | |
3287 | efficient to check e.g. if a value is equal to Scheme's end-of-list or | |
3288 | Lisp's nil. Additionally there are a heap of new, specific predicates | |
b390b008 | 3289 | like scm_is_null_or_nil. |
5bb408cc | 3290 | |
139fa149 AW |
3291 | ** Better integration of Lisp `nil'. |
3292 | ||
3293 | `scm_is_boolean', `scm_is_false', and `scm_is_null' all return true now | |
3294 | for Lisp's `nil'. This shouldn't affect any Scheme code at this point, | |
3295 | but when we start to integrate more with Emacs, it is possible that we | |
3296 | break code that assumes that, for example, `(not x)' implies that `x' is | |
3297 | `eq?' to `#f'. This is not a common assumption. Refactoring affected | |
3298 | code to rely on properties instead of identities will improve code | |
3299 | correctness. See "Nil" in the manual, for more details. | |
3300 | ||
e614d375 AW |
3301 | ** Support for static allocation of strings, symbols, and subrs. |
3302 | ||
3303 | Calls to snarfing CPP macros like SCM_DEFINE macro will now allocate | |
3304 | much of their associated data as static variables, reducing Guile's | |
3305 | memory footprint. | |
3306 | ||
93617170 LC |
3307 | ** `scm_stat' has an additional argument, `exception_on_error' |
3308 | ** `scm_primitive_load_path' has an additional argument `exception_on_not_found' | |
24d6fae8 | 3309 | |
f1ce9199 LC |
3310 | ** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type |
3311 | ||
3312 | Previously they would use the `off_t' type, which is fragile since its | |
3313 | definition depends on the application's value for `_FILE_OFFSET_BITS'. | |
3314 | ||
ba4c43dc LC |
3315 | ** The `long_long' C type, deprecated in 1.8, has been removed |
3316 | ||
86d88a22 AW |
3317 | ** Removed deprecated uniform array procedures: scm_make_uve, |
3318 | scm_array_prototype, scm_list_to_uniform_array, | |
3319 | scm_dimensions_to_uniform_array, scm_make_ra, scm_shap2ra, scm_cvref, | |
3320 | scm_ra_set_contp, scm_aind, scm_raprin1 | |
3321 | ||
3322 | These functions have been deprecated since early 2005. | |
3323 | ||
a4f1c77d | 3324 | * Changes to the distribution |
6caac03c | 3325 | |
53befeb7 NJ |
3326 | ** Guile's license is now LGPLv3+ |
3327 | ||
3328 | In other words the GNU Lesser General Public License, version 3 or | |
3329 | later (at the discretion of each person that chooses to redistribute | |
3330 | part of Guile). | |
3331 | ||
51cb0cca AW |
3332 | ** AM_SILENT_RULES |
3333 | ||
3334 | Guile's build is visually quieter, due to the use of Automake 1.11's | |
3335 | AM_SILENT_RULES. Build as `make V=1' to see all of the output. | |
3336 | ||
56664c08 AW |
3337 | ** GOOPS documentation folded into Guile reference manual |
3338 | ||
3339 | GOOPS, Guile's object system, used to be documented in separate manuals. | |
3340 | This content is now included in Guile's manual directly. | |
3341 | ||
96b73e84 | 3342 | ** `guile-config' will be deprecated in favor of `pkg-config' |
8a9faebc | 3343 | |
96b73e84 | 3344 | `guile-config' has been rewritten to get its information from |
93617170 | 3345 | `pkg-config', so this should be a transparent change. Note however that |
96b73e84 AW |
3346 | guile.m4 has yet to be modified to call pkg-config instead of |
3347 | guile-config. | |
2e77f720 | 3348 | |
54dd0ca5 LC |
3349 | ** Guile now provides `guile-2.0.pc' instead of `guile-1.8.pc' |
3350 | ||
3351 | Programs that use `pkg-config' to find Guile or one of its Autoconf | |
3352 | macros should now require `guile-2.0' instead of `guile-1.8'. | |
3353 | ||
96b73e84 | 3354 | ** New installation directory: $(pkglibdir)/1.9/ccache |
62560650 | 3355 | |
96b73e84 AW |
3356 | If $(libdir) is /usr/lib, for example, Guile will install its .go files |
3357 | to /usr/lib/guile/1.9/ccache. These files are architecture-specific. | |
89bc270d | 3358 | |
b0abbaa7 AW |
3359 | ** Parallel installability fixes |
3360 | ||
3361 | Guile now installs its header files to a effective-version-specific | |
3362 | directory, and includes the effective version (e.g. 2.0) in the library | |
3363 | name (e.g. libguile-2.0.so). | |
3364 | ||
3365 | This change should be transparent to users, who should detect Guile via | |
3366 | the guile.m4 macro, or the guile-2.0.pc pkg-config file. It will allow | |
3367 | parallel installs for multiple versions of Guile development | |
3368 | environments. | |
3369 | ||
b0217d17 AW |
3370 | ** Dynamically loadable extensions may be placed in a Guile-specific path |
3371 | ||
3372 | Before, Guile only searched the system library paths for extensions | |
3373 | (e.g. /usr/lib), which meant that the names of Guile extensions had to | |
3374 | be globally unique. Installing them to a Guile-specific extensions | |
66ad445d | 3375 | directory is cleaner. Use `pkg-config --variable=extensiondir |
b0217d17 AW |
3376 | guile-2.0' to get the location of the extensions directory. |
3377 | ||
51cb0cca AW |
3378 | ** User Scheme code may be placed in a version-specific path |
3379 | ||
3380 | Before, there was only one way to install user Scheme code to a | |
3381 | version-specific Guile directory: install to Guile's own path, | |
3382 | e.g. /usr/share/guile/2.0. The site directory, | |
3383 | e.g. /usr/share/guile/site, was unversioned. This has been changed to | |
3384 | add a version-specific site directory, e.g. /usr/share/guile/site/2.0, | |
3385 | searched before the global site directory. | |
3386 | ||
7b96f3dd LC |
3387 | ** New dependency: libgc |
3388 | ||
3389 | See http://www.hpl.hp.com/personal/Hans_Boehm/gc/, for more information. | |
3390 | ||
3391 | ** New dependency: GNU libunistring | |
32e29e24 | 3392 | |
108e18b1 | 3393 | See http://www.gnu.org/software/libunistring/, for more information. Our |
7b96f3dd | 3394 | Unicode support uses routines from libunistring. |
32e29e24 | 3395 | |
dbd9532e LC |
3396 | ** New dependency: libffi |
3397 | ||
3398 | See http://sourceware.org/libffi/, for more information. | |
3399 | ||
a4f1c77d | 3400 | |
dc686d7b | 3401 | \f |
9957b1c7 LC |
3402 | Changes in 1.8.8 (since 1.8.7) |
3403 | ||
3404 | * Bugs fixed | |
3405 | ||
3406 | ** Fix possible buffer overruns when parsing numbers | |
c15d8e6a | 3407 | ** Avoid clash with system setjmp/longjmp on IA64 |
1ff4da65 | 3408 | ** Fix `wrong type arg' exceptions with IPv6 addresses |
9957b1c7 LC |
3409 | |
3410 | \f | |
dc686d7b NJ |
3411 | Changes in 1.8.7 (since 1.8.6) |
3412 | ||
922d417b JG |
3413 | * New modules (see the manual for details) |
3414 | ||
3415 | ** `(srfi srfi-98)', an interface to access environment variables | |
3416 | ||
dc686d7b NJ |
3417 | * Bugs fixed |
3418 | ||
f5851b89 | 3419 | ** Fix compilation with `--disable-deprecated' |
dc686d7b | 3420 | ** Fix %fast-slot-ref/set!, to avoid possible segmentation fault |
cbee5075 | 3421 | ** Fix MinGW build problem caused by HAVE_STRUCT_TIMESPEC confusion |
ab878b0f | 3422 | ** Fix build problem when scm_t_timespec is different from struct timespec |
95a040cd | 3423 | ** Fix build when compiled with -Wundef -Werror |
1bcf7993 | 3424 | ** More build fixes for `alphaev56-dec-osf5.1b' (Tru64) |
5374ec9c | 3425 | ** Build fixes for `powerpc-ibm-aix5.3.0.0' (AIX 5.3) |
5c006c3f LC |
3426 | ** With GCC, always compile with `-mieee' on `alpha*' and `sh*' |
3427 | ** Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130) | |
fc76c08d | 3428 | ** Fix parsing of SRFI-88/postfix keywords longer than 128 characters |
40f89215 | 3429 | ** Fix reading of complex numbers where both parts are inexact decimals |
d41668fa | 3430 | |
ad5f5ada NJ |
3431 | ** Allow @ macro to work with (ice-9 syncase) |
3432 | ||
3433 | Previously, use of the @ macro in a module whose code is being | |
3434 | transformed by (ice-9 syncase) would cause an "Invalid syntax" error. | |
3435 | Now it works as you would expect (giving the value of the specified | |
3436 | module binding). | |
3437 | ||
05588a1a LC |
3438 | ** Have `scm_take_locale_symbol ()' return an interned symbol (bug #25865) |
3439 | ||
d41668fa | 3440 | \f |
8c40b75d LC |
3441 | Changes in 1.8.6 (since 1.8.5) |
3442 | ||
071bb6a8 LC |
3443 | * New features (see the manual for details) |
3444 | ||
3445 | ** New convenience function `scm_c_symbol_length ()' | |
3446 | ||
091baf9e NJ |
3447 | ** Single stepping through code from Emacs |
3448 | ||
3449 | When you use GDS to evaluate Scheme code from Emacs, you can now use | |
3450 | `C-u' to indicate that you want to single step through that code. See | |
3451 | `Evaluating Scheme Code' in the manual for more details. | |
3452 | ||
9e4db0ef LC |
3453 | ** New "guile(1)" man page! |
3454 | ||
242ebeaf LC |
3455 | * Changes to the distribution |
3456 | ||
3457 | ** Automake's `AM_MAINTAINER_MODE' is no longer used | |
3458 | ||
3459 | Thus, the `--enable-maintainer-mode' configure option is no longer | |
3460 | available: Guile is now always configured in "maintainer mode". | |
3461 | ||
e0063477 LC |
3462 | ** `ChangeLog' files are no longer updated |
3463 | ||
3464 | Instead, changes are detailed in the version control system's logs. See | |
3465 | the top-level `ChangeLog' files for details. | |
3466 | ||
3467 | ||
8c40b75d LC |
3468 | * Bugs fixed |
3469 | ||
fd2b17b9 | 3470 | ** `symbol->string' now returns a read-only string, as per R5RS |
c6333102 | 3471 | ** Fix incorrect handling of the FLAGS argument of `fold-matches' |
589d9eb8 | 3472 | ** `guile-config link' now prints `-L$libdir' before `-lguile' |
4a1db3a9 | 3473 | ** Fix memory corruption involving GOOPS' `class-redefinition' |
191e7165 | 3474 | ** Fix possible deadlock in `mutex-lock' |
95c6523b | 3475 | ** Fix build issue on Tru64 and ia64-hp-hpux11.23 (`SCM_UNPACK' macro) |
4696a666 | 3476 | ** Fix build issue on mips, mipsel, powerpc and ia64 (stack direction) |
450be18d | 3477 | ** Fix build issue on hppa2.0w-hp-hpux11.11 (`dirent64' and `readdir64_r') |
88cefbc7 | 3478 | ** Fix build issue on i386-unknown-freebsd7.0 ("break strict-aliasing rules") |
76dae881 | 3479 | ** Fix misleading output from `(help rationalize)' |
5ea8e76e | 3480 | ** Fix build failure on Debian hppa architecture (bad stack growth detection) |
1dd79792 | 3481 | ** Fix `gcd' when called with a single, negative argument. |
d8b6e191 | 3482 | ** Fix `Stack overflow' errors seen when building on some platforms |
ccf1ca4a LC |
3483 | ** Fix bug when `scm_with_guile ()' was called several times from the |
3484 | same thread | |
76350432 LC |
3485 | ** The handler of SRFI-34 `with-exception-handler' is now invoked in the |
3486 | dynamic environment of the call to `raise' | |
cb823e63 | 3487 | ** Fix potential deadlock in `make-struct' |
691343ea | 3488 | ** Fix compilation problem with libltdl from Libtool 2.2.x |
3ae3166b | 3489 | ** Fix sloppy bound checking in `string-{ref,set!}' with the empty string |
6eadcdab | 3490 | |
8c40b75d | 3491 | \f |
5305df84 LC |
3492 | Changes in 1.8.5 (since 1.8.4) |
3493 | ||
4b824aae LC |
3494 | * Infrastructure changes |
3495 | ||
3496 | ** Guile repository switched from CVS to Git | |
3497 | ||
3498 | The new repository can be accessed using | |
3499 | "git-clone git://git.sv.gnu.org/guile.git", or can be browsed on-line at | |
3500 | http://git.sv.gnu.org/gitweb/?p=guile.git . See `README' for details. | |
3501 | ||
92826dd0 LC |
3502 | ** Add support for `pkg-config' |
3503 | ||
3504 | See "Autoconf Support" in the manual for details. | |
3505 | ||
189681f5 LC |
3506 | * New modules (see the manual for details) |
3507 | ||
3508 | ** `(srfi srfi-88)' | |
3509 | ||
ef4cbc08 LC |
3510 | * New features (see the manual for details) |
3511 | ||
3512 | ** New `postfix' read option, for SRFI-88 keyword syntax | |
f5c2af4b | 3513 | ** Some I/O primitives have been inlined, which improves I/O performance |
b20ef3a6 | 3514 | ** New object-based traps infrastructure |
ef4cbc08 | 3515 | |
b20ef3a6 NJ |
3516 | This is a GOOPS-based infrastructure that builds on Guile's low-level |
3517 | evaluator trap calls and facilitates the development of debugging | |
3518 | features like single-stepping, breakpoints, tracing and profiling. | |
3519 | See the `Traps' node of the manual for details. | |
3520 | ||
3521 | ** New support for working on Guile code from within Emacs | |
3522 | ||
3523 | Guile now incorporates the `GDS' library (previously distributed | |
3524 | separately) for working on Guile code from within Emacs. See the | |
3525 | `Using Guile In Emacs' node of the manual for details. | |
3526 | ||
5305df84 LC |
3527 | * Bugs fixed |
3528 | ||
e27d2495 LC |
3529 | ** `scm_add_slot ()' no longer segfaults (fixes bug #22369) |
3530 | ** Fixed `(ice-9 match)' for patterns like `((_ ...) ...)' | |
3531 | ||
3532 | Previously, expressions like `(match '((foo) (bar)) (((_ ...) ...) #t))' | |
3533 | would trigger an unbound variable error for `match:andmap'. | |
3534 | ||
62c5382b LC |
3535 | ** `(oop goops describe)' now properly provides the `describe' feature |
3536 | ** Fixed `args-fold' from `(srfi srfi-37)' | |
3537 | ||
3538 | Previously, parsing short option names of argument-less options would | |
3539 | lead to a stack overflow. | |
3540 | ||
816e3edf | 3541 | ** `(srfi srfi-35)' is now visible through `cond-expand' |
61b6542a | 3542 | ** Fixed type-checking for the second argument of `eval' |
0fb11ae4 | 3543 | ** Fixed type-checking for SRFI-1 `partition' |
f1c212b1 LC |
3544 | ** Fixed `struct-ref' and `struct-set!' on "light structs" |
3545 | ** Honor struct field access rights in GOOPS | |
be10cba8 | 3546 | ** Changed the storage strategy of source properties, which fixes a deadlock |
979eade6 | 3547 | ** Allow compilation of Guile-using programs in C99 mode with GCC 4.3 and later |
bfb64eb4 | 3548 | ** Fixed build issue for GNU/Linux on IA64 |
fa80e280 | 3549 | ** Fixed build issues on NetBSD 1.6 |
a2c25234 | 3550 | ** Fixed build issue on Solaris 2.10 x86_64 |
3f520967 | 3551 | ** Fixed build issue with DEC/Compaq/HP's compiler |
c2ad98ad LC |
3552 | ** Fixed `scm_from_complex_double' build issue on FreeBSD |
3553 | ** Fixed `alloca' build issue on FreeBSD 6 | |
a7286720 | 3554 | ** Removed use of non-portable makefile constructs |
535b3592 | 3555 | ** Fixed shadowing of libc's <random.h> on Tru64, which broke compilation |
eedcb08a | 3556 | ** Make sure all tests honor `$TMPDIR' |
5305df84 LC |
3557 | |
3558 | \f | |
d41668fa LC |
3559 | Changes in 1.8.4 (since 1.8.3) |
3560 | ||
3561 | * Bugs fixed | |
3562 | ||
3563 | ** CR (ASCII 0x0d) is (again) recognized as a token delimiter by the reader | |
6e14de7d NJ |
3564 | ** Fixed a segmentation fault which occurred when displaying the |
3565 | backtrace of a stack with a promise object (made by `delay') in it. | |
7d1fc872 | 3566 | ** Make `accept' leave guile mode while blocking |
693758d5 | 3567 | ** `scm_c_read ()' and `scm_c_write ()' now type-check their port argument |
378cc645 | 3568 | ** Fixed a build problem on AIX (use of func_data identifier) |
15bd90ea NJ |
3569 | ** Fixed a segmentation fault which occurred when hashx-ref or hashx-set! was |
3570 | called with an associator proc that returns neither a pair nor #f. | |
3ac8359a | 3571 | ** Secondary threads now always return a valid module for (current-module). |
d05bcb2e NJ |
3572 | ** Avoid MacOS build problems caused by incorrect combination of "64" |
3573 | system and library calls. | |
9a6fac59 | 3574 | ** `guile-snarf' now honors `$TMPDIR' |
25a640ca | 3575 | ** `guile-config compile' now reports CPPFLAGS used at compile-time |
7f74cf9a | 3576 | ** Fixed build with Sun Studio (Solaris 9) |
4a19ed04 NJ |
3577 | ** Fixed wrong-type-arg errors when creating zero length SRFI-4 |
3578 | uniform vectors on AIX. | |
86a597f8 | 3579 | ** Fixed a deadlock that occurs upon GC with multiple threads. |
4b26c03e | 3580 | ** Fixed compile problem with GCC on Solaris and AIX (use of _Complex_I) |
d4a00708 | 3581 | ** Fixed autotool-derived build problems on AIX 6.1. |
9a6fac59 | 3582 | ** Fixed NetBSD/alpha support |
b226295a | 3583 | ** Fixed MacOS build problem caused by use of rl_get_keymap(_name) |
7d1fc872 LC |
3584 | |
3585 | * New modules (see the manual for details) | |
3586 | ||
3587 | ** `(srfi srfi-69)' | |
d41668fa | 3588 | |
b226295a NJ |
3589 | * Documentation fixes and improvements |
3590 | ||
3591 | ** Removed premature breakpoint documentation | |
3592 | ||
3593 | The features described are not available in the series of 1.8.x | |
3594 | releases, so the documentation was misleading and has been removed. | |
3595 | ||
3596 | ** More about Guile's default *random-state* variable | |
3597 | ||
3598 | ** GOOPS: more about how to use `next-method' | |
3599 | ||
d3cf93bc NJ |
3600 | * Changes to the distribution |
3601 | ||
3602 | ** Corrected a few files that referred incorrectly to the old GPL + special exception licence | |
3603 | ||
3604 | In fact Guile since 1.8.0 has been licensed with the GNU Lesser | |
3605 | General Public License, and the few incorrect files have now been | |
3606 | fixed to agree with the rest of the Guile distribution. | |
3607 | ||
5e42b8e7 NJ |
3608 | ** Removed unnecessary extra copies of COPYING* |
3609 | ||
3610 | The distribution now contains a single COPYING.LESSER at its top level. | |
3611 | ||
a4f1c77d | 3612 | \f |
d4c38221 LC |
3613 | Changes in 1.8.3 (since 1.8.2) |
3614 | ||
3615 | * New modules (see the manual for details) | |
3616 | ||
f50ca8da | 3617 | ** `(srfi srfi-35)' |
d4c38221 LC |
3618 | ** `(srfi srfi-37)' |
3619 | ||
e08f3f7a LC |
3620 | * Bugs fixed |
3621 | ||
dc061a74 | 3622 | ** The `(ice-9 slib)' module now works as expected |
e08f3f7a | 3623 | ** Expressions like "(set! 'x #t)" no longer yield a crash |
d7c0c26d | 3624 | ** Warnings about duplicate bindings now go to stderr |
1ac5fb45 | 3625 | ** A memory leak in `make-socket-address' was fixed |
f43f3620 | 3626 | ** Alignment issues (e.g., on SPARC) in network routines were fixed |
29776e85 | 3627 | ** A threading issue that showed up at least on NetBSD was fixed |
66302618 | 3628 | ** Build problems on Solaris and IRIX fixed |
e08f3f7a | 3629 | |
1fdd8ffa LC |
3630 | * Implementation improvements |
3631 | ||
7ff6c169 | 3632 | ** The reader is now faster, which reduces startup time |
1fdd8ffa LC |
3633 | ** Procedures returned by `record-accessor' and `record-modifier' are faster |
3634 | ||
d4c38221 | 3635 | \f |
45c0ff10 KR |
3636 | Changes in 1.8.2 (since 1.8.1): |
3637 | ||
3638 | * New procedures (see the manual for details) | |
3639 | ||
3640 | ** set-program-arguments | |
b3aa4626 | 3641 | ** make-vtable |
45c0ff10 | 3642 | |
9320e933 LC |
3643 | * Incompatible changes |
3644 | ||
3645 | ** The body of a top-level `define' no longer sees the binding being created | |
3646 | ||
3647 | In a top-level `define', the binding being created is no longer visible | |
3648 | from the `define' body. This breaks code like | |
3649 | "(define foo (begin (set! foo 1) (+ foo 1)))", where `foo' is now | |
3650 | unbound in the body. However, such code was not R5RS-compliant anyway, | |
3651 | per Section 5.2.1. | |
3652 | ||
45c0ff10 KR |
3653 | * Bugs fixed |
3654 | ||
3655 | ** Fractions were not `equal?' if stored in unreduced form. | |
3656 | (A subtle problem, since printing a value reduced it, making it work.) | |
3657 | ** srfi-60 `copy-bit' failed on 64-bit systems | |
3658 | ** "guile --use-srfi" option at the REPL can replace core functions | |
3659 | (Programs run with that option were ok, but in the interactive REPL | |
3660 | the core bindings got priority, preventing SRFI replacements or | |
3661 | extensions.) | |
3662 | ** `regexp-exec' doesn't abort() on #\nul in the input or bad flags arg | |
df449722 | 3663 | ** `kill' on mingw throws an error for a PID other than oneself |
45c0ff10 KR |
3664 | ** Procedure names are attached to procedure-with-setters |
3665 | ** Array read syntax works with negative lower bound | |
3666 | ** `array-in-bounds?' fix if an array has different lower bounds on each index | |
3667 | ** `*' returns exact 0 for "(* inexact 0)" | |
3668 | This follows what it always did for "(* 0 inexact)". | |
c122500a | 3669 | ** SRFI-19: Value returned by `(current-time time-process)' was incorrect |
0867f7ba | 3670 | ** SRFI-19: `date->julian-day' did not account for timezone offset |
a1ef7406 | 3671 | ** `ttyname' no longer crashes when passed a non-tty argument |
27782696 | 3672 | ** `inet-ntop' no longer crashes on SPARC when passed an `AF_INET' address |
0867f7ba | 3673 | ** Small memory leaks have been fixed in `make-fluid' and `add-history' |
b1f57ea4 | 3674 | ** GOOPS: Fixed a bug in `method-more-specific?' |
45c0ff10 | 3675 | ** Build problems on Solaris fixed |
df449722 LC |
3676 | ** Build problems on HP-UX IA64 fixed |
3677 | ** Build problems on MinGW fixed | |
45c0ff10 KR |
3678 | |
3679 | \f | |
a4f1c77d KR |
3680 | Changes in 1.8.1 (since 1.8.0): |
3681 | ||
8ab3d8a0 | 3682 | * LFS functions are now used to access 64-bit files on 32-bit systems. |
a4f1c77d | 3683 | |
8ab3d8a0 | 3684 | * New procedures (see the manual for details) |
4f416616 | 3685 | |
8ab3d8a0 KR |
3686 | ** primitive-_exit - [Scheme] the-root-module |
3687 | ** scm_primitive__exit - [C] | |
3688 | ** make-completion-function - [Scheme] (ice-9 readline) | |
3689 | ** scm_c_locale_stringn_to_number - [C] | |
3690 | ** scm_srfi1_append_reverse [C] | |
3691 | ** scm_srfi1_append_reverse_x [C] | |
3692 | ** scm_log - [C] | |
3693 | ** scm_log10 - [C] | |
3694 | ** scm_exp - [C] | |
3695 | ** scm_sqrt - [C] | |
3696 | ||
3697 | * Bugs fixed | |
3698 | ||
3699 | ** Build problems have been fixed on MacOS, SunOS, and QNX. | |
af4f8612 | 3700 | |
b3aa4626 KR |
3701 | ** `strftime' fix sign of %z timezone offset. |
3702 | ||
534cd148 | 3703 | ** A one-dimensional array can now be 'equal?' to a vector. |
8ab3d8a0 | 3704 | |
ad97642e | 3705 | ** Structures, records, and SRFI-9 records can now be compared with `equal?'. |
af4f8612 | 3706 | |
8ab3d8a0 KR |
3707 | ** SRFI-14 standard char sets are recomputed upon a successful `setlocale'. |
3708 | ||
3709 | ** `record-accessor' and `record-modifier' now have strict type checks. | |
3710 | ||
3711 | Record accessor and modifier procedures now throw an error if the | |
3712 | record type of the record they're given is not the type expected. | |
3713 | (Previously accessors returned #f and modifiers silently did nothing). | |
3714 | ||
3715 | ** It is now OK to use both autoload and use-modules on a given module. | |
3716 | ||
3717 | ** `apply' checks the number of arguments more carefully on "0 or 1" funcs. | |
3718 | ||
3719 | Previously there was no checking on primatives like make-vector that | |
3720 | accept "one or two" arguments. Now there is. | |
3721 | ||
3722 | ** The srfi-1 assoc function now calls its equality predicate properly. | |
3723 | ||
3724 | Previously srfi-1 assoc would call the equality predicate with the key | |
3725 | last. According to the SRFI, the key should be first. | |
3726 | ||
3727 | ** A bug in n-par-for-each and n-for-each-par-map has been fixed. | |
3728 | ||
3729 | ** The array-set! procedure no longer segfaults when given a bit vector. | |
3730 | ||
3731 | ** Bugs in make-shared-array have been fixed. | |
3732 | ||
3733 | ** string<? and friends now follow char<? etc order on 8-bit chars. | |
3734 | ||
3735 | ** The format procedure now handles inf and nan values for ~f correctly. | |
3736 | ||
3737 | ** exact->inexact should no longer overflow when given certain large fractions. | |
3738 | ||
3739 | ** srfi-9 accessor and modifier procedures now have strict record type checks. | |
a4f1c77d | 3740 | |
8ab3d8a0 | 3741 | This matches the srfi-9 specification. |
a4f1c77d | 3742 | |
8ab3d8a0 | 3743 | ** (ice-9 ftw) procedures won't ignore different files with same inode number. |
a4f1c77d | 3744 | |
8ab3d8a0 KR |
3745 | Previously the (ice-9 ftw) procedures would ignore any file that had |
3746 | the same inode number as a file they had already seen, even if that | |
3747 | file was on a different device. | |
4f416616 KR |
3748 | |
3749 | \f | |
8ab3d8a0 | 3750 | Changes in 1.8.0 (changes since the 1.6.x series): |
ee0c7345 | 3751 | |
4e250ded MV |
3752 | * Changes to the distribution |
3753 | ||
eff2965e MV |
3754 | ** Guile is now licensed with the GNU Lesser General Public License. |
3755 | ||
77e51fd6 MV |
3756 | ** The manual is now licensed with the GNU Free Documentation License. |
3757 | ||
e2d0a649 RB |
3758 | ** Guile now requires GNU MP (http://swox.com/gmp). |
3759 | ||
3760 | Guile now uses the GNU MP library for arbitrary precision arithmetic. | |
e2d0a649 | 3761 | |
5ebbe4ef RB |
3762 | ** Guile now has separate private and public configuration headers. |
3763 | ||
b0d10ba6 MV |
3764 | That is, things like HAVE_STRING_H no longer leak from Guile's |
3765 | headers. | |
5ebbe4ef RB |
3766 | |
3767 | ** Guile now provides and uses an "effective" version number. | |
b2cbe8d8 RB |
3768 | |
3769 | Guile now provides scm_effective_version and effective-version | |
3770 | functions which return the "effective" version number. This is just | |
3771 | the normal full version string without the final micro-version number, | |
a4f1c77d | 3772 | so the current effective-version is "1.8". The effective version |
b2cbe8d8 RB |
3773 | should remain unchanged during a stable series, and should be used for |
3774 | items like the versioned share directory name | |
a4f1c77d | 3775 | i.e. /usr/share/guile/1.8. |
b2cbe8d8 RB |
3776 | |
3777 | Providing an unchanging version number during a stable release for | |
3778 | things like the versioned share directory can be particularly | |
3779 | important for Guile "add-on" packages, since it provides a directory | |
3780 | that they can install to that won't be changed out from under them | |
3781 | with each micro release during a stable series. | |
3782 | ||
8d54e73a | 3783 | ** Thread implementation has changed. |
f0b4d944 MV |
3784 | |
3785 | When you configure "--with-threads=null", you will get the usual | |
3786 | threading API (call-with-new-thread, make-mutex, etc), but you can't | |
429d88d4 MV |
3787 | actually create new threads. Also, "--with-threads=no" is now |
3788 | equivalent to "--with-threads=null". This means that the thread API | |
3789 | is always present, although you might not be able to create new | |
3790 | threads. | |
f0b4d944 | 3791 | |
8d54e73a MV |
3792 | When you configure "--with-threads=pthreads" or "--with-threads=yes", |
3793 | you will get threads that are implemented with the portable POSIX | |
3794 | threads. These threads can run concurrently (unlike the previous | |
3795 | "coop" thread implementation), but need to cooperate for things like | |
a558cc63 | 3796 | the GC. |
f0b4d944 | 3797 | |
8d54e73a MV |
3798 | The default is "pthreads", unless your platform doesn't have pthreads, |
3799 | in which case "null" threads are used. | |
2902a459 | 3800 | |
a6d75e53 MV |
3801 | See the manual for details, nodes "Initialization", "Multi-Threading", |
3802 | "Blocking", and others. | |
a558cc63 | 3803 | |
f74bdbd3 MV |
3804 | ** There is the new notion of 'discouraged' features. |
3805 | ||
3806 | This is a milder form of deprecation. | |
3807 | ||
3808 | Things that are discouraged should not be used in new code, but it is | |
3809 | OK to leave them in old code for now. When a discouraged feature is | |
3810 | used, no warning message is printed like there is for 'deprecated' | |
3811 | features. Also, things that are merely discouraged are nevertheless | |
3812 | implemented efficiently, while deprecated features can be very slow. | |
3813 | ||
3814 | You can omit discouraged features from libguile by configuring it with | |
3815 | the '--disable-discouraged' option. | |
3816 | ||
3817 | ** Deprecation warnings can be controlled at run-time. | |
3818 | ||
3819 | (debug-enable 'warn-deprecated) switches them on and (debug-disable | |
3820 | 'warn-deprecated) switches them off. | |
3821 | ||
0f24e75b | 3822 | ** Support for SRFI 61, extended cond syntax for multiple values has |
a81d0de1 MV |
3823 | been added. |
3824 | ||
3825 | This SRFI is always available. | |
3826 | ||
f7fb2f39 | 3827 | ** Support for require-extension, SRFI-55, has been added. |
9a5fc8c2 | 3828 | |
f7fb2f39 RB |
3829 | The SRFI-55 special form `require-extension' has been added. It is |
3830 | available at startup, and provides a portable way to load Scheme | |
3831 | extensions. SRFI-55 only requires support for one type of extension, | |
3832 | "srfi"; so a set of SRFIs may be loaded via (require-extension (srfi 1 | |
3833 | 13 14)). | |
3834 | ||
3835 | ** New module (srfi srfi-26) provides support for `cut' and `cute'. | |
3836 | ||
3837 | The (srfi srfi-26) module is an implementation of SRFI-26 which | |
3838 | provides the `cut' and `cute' syntax. These may be used to specialize | |
3839 | parameters without currying. | |
9a5fc8c2 | 3840 | |
f5d54eb7 RB |
3841 | ** New module (srfi srfi-31) |
3842 | ||
3843 | This is an implementation of SRFI-31 which provides a special form | |
3844 | `rec' for recursive evaluation. | |
3845 | ||
7b1574ed MV |
3846 | ** The modules (srfi srfi-13), (srfi srfi-14) and (srfi srfi-4) have |
3847 | been merged with the core, making their functionality always | |
3848 | available. | |
c5080b51 | 3849 | |
ce7c0293 MV |
3850 | The modules are still available, tho, and you could use them together |
3851 | with a renaming import, for example. | |
c5080b51 | 3852 | |
6191ccec | 3853 | ** Guile no longer includes its own version of libltdl. |
4e250ded | 3854 | |
6191ccec | 3855 | The official version is good enough now. |
4e250ded | 3856 | |
ae7ded56 MV |
3857 | ** The --enable-htmldoc option has been removed from 'configure'. |
3858 | ||
3859 | Support for translating the documentation into HTML is now always | |
3860 | provided. Use 'make html'. | |
3861 | ||
0f24e75b MV |
3862 | ** New module (ice-9 serialize): |
3863 | ||
3864 | (serialize FORM1 ...) and (parallelize FORM1 ...) are useful when you | |
3865 | don't trust the thread safety of most of your program, but where you | |
3866 | have some section(s) of code which you consider can run in parallel to | |
3867 | other sections. See ice-9/serialize.scm for more information. | |
3868 | ||
c34e5780 MV |
3869 | ** The configure option '--disable-arrays' has been removed. |
3870 | ||
3871 | Support for arrays and uniform numeric arrays is now always included | |
3872 | in Guile. | |
3873 | ||
328dc9a3 | 3874 | * Changes to the stand-alone interpreter |
f12ef3fd | 3875 | |
3ece39d6 MV |
3876 | ** New command line option `-L'. |
3877 | ||
3878 | This option adds a directory to the front of the load path. | |
3879 | ||
f12ef3fd MV |
3880 | ** New command line option `--no-debug'. |
3881 | ||
3882 | Specifying `--no-debug' on the command line will keep the debugging | |
3883 | evaluator turned off, even for interactive sessions. | |
3884 | ||
3885 | ** User-init file ~/.guile is now loaded with the debugging evaluator. | |
3886 | ||
3887 | Previously, the normal evaluator would have been used. Using the | |
3888 | debugging evaluator gives better error messages. | |
3889 | ||
aff7e166 MV |
3890 | ** The '-e' option now 'read's its argument. |
3891 | ||
3892 | This is to allow the new '(@ MODULE-NAME VARIABLE-NAME)' construct to | |
3893 | be used with '-e'. For example, you can now write a script like | |
3894 | ||
3895 | #! /bin/sh | |
3896 | exec guile -e '(@ (demo) main)' -s "$0" "$@" | |
3897 | !# | |
3898 | ||
3899 | (define-module (demo) | |
3900 | :export (main)) | |
3901 | ||
3902 | (define (main args) | |
3903 | (format #t "Demo: ~a~%" args)) | |
3904 | ||
3905 | ||
f12ef3fd MV |
3906 | * Changes to Scheme functions and syntax |
3907 | ||
930888e8 MV |
3908 | ** Guardians have changed back to their original semantics |
3909 | ||
3910 | Guardians now behave like described in the paper by Dybvig et al. In | |
3911 | particular, they no longer make guarantees about the order in which | |
3912 | they return objects, and they can no longer be greedy. | |
3913 | ||
3914 | They no longer drop cyclic data structures. | |
3915 | ||
3916 | The C function scm_make_guardian has been changed incompatibly and no | |
3917 | longer takes the 'greedy_p' argument. | |
3918 | ||
87bdbdbc MV |
3919 | ** New function hashx-remove! |
3920 | ||
3921 | This function completes the set of 'hashx' functions. | |
3922 | ||
a558cc63 MV |
3923 | ** The concept of dynamic roots has been factored into continuation |
3924 | barriers and dynamic states. | |
3925 | ||
3926 | Each thread has a current dynamic state that carries the values of the | |
3927 | fluids. You can create and copy dynamic states and use them as the | |
3928 | second argument for 'eval'. See "Fluids and Dynamic States" in the | |
3929 | manual. | |
3930 | ||
3931 | To restrict the influence that captured continuations can have on the | |
3932 | control flow, you can errect continuation barriers. See "Continuation | |
3933 | Barriers" in the manual. | |
3934 | ||
3935 | The function call-with-dynamic-root now essentially temporarily | |
3936 | installs a new dynamic state and errects a continuation barrier. | |
3937 | ||
a2b6a0e7 MV |
3938 | ** The default load path no longer includes "." at the end. |
3939 | ||
3940 | Automatically loading modules from the current directory should not | |
3941 | happen by default. If you want to allow it in a more controlled | |
3942 | manner, set the environment variable GUILE_LOAD_PATH or the Scheme | |
3943 | variable %load-path. | |
3944 | ||
7b1574ed MV |
3945 | ** The uniform vector and array support has been overhauled. |
3946 | ||
3947 | It now complies with SRFI-4 and the weird prototype based uniform | |
3948 | array creation has been deprecated. See the manual for more details. | |
3949 | ||
d233b123 MV |
3950 | Some non-compatible changes have been made: |
3951 | - characters can no longer be stored into byte arrays. | |
0f24e75b MV |
3952 | - strings and bit vectors are no longer considered to be uniform numeric |
3953 | vectors. | |
3167d5e4 MV |
3954 | - array-rank throws an error for non-arrays instead of returning zero. |
3955 | - array-ref does no longer accept non-arrays when no indices are given. | |
d233b123 MV |
3956 | |
3957 | There is the new notion of 'generalized vectors' and corresponding | |
3958 | procedures like 'generalized-vector-ref'. Generalized vectors include | |
c34e5780 | 3959 | strings, bitvectors, ordinary vectors, and uniform numeric vectors. |
d233b123 | 3960 | |
a558cc63 MV |
3961 | Arrays use generalized vectors as their storage, so that you still |
3962 | have arrays of characters, bits, etc. However, uniform-array-read! | |
3963 | and uniform-array-write can no longer read/write strings and | |
3964 | bitvectors. | |
bb9f50ae | 3965 | |
ce7c0293 MV |
3966 | ** There is now support for copy-on-write substrings, mutation-sharing |
3967 | substrings and read-only strings. | |
3ff9283d | 3968 | |
ce7c0293 MV |
3969 | Three new procedures are related to this: substring/shared, |
3970 | substring/copy, and substring/read-only. See the manual for more | |
3971 | information. | |
3972 | ||
6a1d27ea MV |
3973 | ** Backtraces will now highlight the value that caused the error. |
3974 | ||
3975 | By default, these values are enclosed in "{...}", such as in this | |
3976 | example: | |
3977 | ||
3978 | guile> (car 'a) | |
3979 | ||
3980 | Backtrace: | |
3981 | In current input: | |
3982 | 1: 0* [car {a}] | |
3983 | ||
3984 | <unnamed port>:1:1: In procedure car in expression (car (quote a)): | |
3985 | <unnamed port>:1:1: Wrong type (expecting pair): a | |
3986 | ABORT: (wrong-type-arg) | |
3987 | ||
3988 | The prefix and suffix used for highlighting can be set via the two new | |
3989 | printer options 'highlight-prefix' and 'highlight-suffix'. For | |
3990 | example, putting this into ~/.guile will output the bad value in bold | |
3991 | on an ANSI terminal: | |
3992 | ||
3993 | (print-set! highlight-prefix "\x1b[1m") | |
3994 | (print-set! highlight-suffix "\x1b[22m") | |
3995 | ||
3996 | ||
8dbafacd MV |
3997 | ** 'gettext' support for internationalization has been added. |
3998 | ||
3999 | See the manual for details. | |
4000 | ||
aff7e166 MV |
4001 | ** New syntax '@' and '@@': |
4002 | ||
4003 | You can now directly refer to variables exported from a module by | |
4004 | writing | |
4005 | ||
4006 | (@ MODULE-NAME VARIABLE-NAME) | |
4007 | ||
4008 | For example (@ (ice-9 pretty-print) pretty-print) will directly access | |
4009 | the pretty-print variable exported from the (ice-9 pretty-print) | |
4010 | module. You don't need to 'use' that module first. You can also use | |
b0d10ba6 | 4011 | '@' as a target of 'set!', as in (set! (@ mod var) val). |
aff7e166 MV |
4012 | |
4013 | The related syntax (@@ MODULE-NAME VARIABLE-NAME) works just like '@', | |
4014 | but it can also access variables that have not been exported. It is | |
4015 | intended only for kluges and temporary fixes and for debugging, not | |
4016 | for ordinary code. | |
4017 | ||
aef0bdb4 MV |
4018 | ** Keyword syntax has been made more disciplined. |
4019 | ||
4020 | Previously, the name of a keyword was read as a 'token' but printed as | |
4021 | a symbol. Now, it is read as a general Scheme datum which must be a | |
4022 | symbol. | |
4023 | ||
4024 | Previously: | |
4025 | ||
4026 | guile> #:12 | |
4027 | #:#{12}# | |
4028 | guile> #:#{12}# | |
4029 | #:#{\#{12}\#}# | |
4030 | guile> #:(a b c) | |
4031 | #:#{}# | |
4032 | ERROR: In expression (a b c): | |
4033 | Unbound variable: a | |
4034 | guile> #: foo | |
4035 | #:#{}# | |
4036 | ERROR: Unbound variable: foo | |
4037 | ||
4038 | Now: | |
4039 | ||
4040 | guile> #:12 | |
4041 | ERROR: Wrong type (expecting symbol): 12 | |
4042 | guile> #:#{12}# | |
4043 | #:#{12}# | |
4044 | guile> #:(a b c) | |
4045 | ERROR: Wrong type (expecting symbol): (a b c) | |
4046 | guile> #: foo | |
4047 | #:foo | |
4048 | ||
227eafdb MV |
4049 | ** The printing of symbols that might look like keywords can be |
4050 | controlled. | |
4051 | ||
4052 | The new printer option 'quote-keywordish-symbols' controls how symbols | |
4053 | are printed that have a colon as their first or last character. The | |
4054 | default now is to only quote a symbol with #{...}# when the read | |
4055 | option 'keywords' is not '#f'. Thus: | |
4056 | ||
4057 | guile> (define foo (string->symbol ":foo")) | |
4058 | guile> (read-set! keywords #f) | |
4059 | guile> foo | |
4060 | :foo | |
4061 | guile> (read-set! keywords 'prefix) | |
4062 | guile> foo | |
4063 | #{:foo}# | |
4064 | guile> (print-set! quote-keywordish-symbols #f) | |
4065 | guile> foo | |
4066 | :foo | |
4067 | ||
1363e3e7 KR |
4068 | ** 'while' now provides 'break' and 'continue' |
4069 | ||
4070 | break and continue were previously bound in a while loop, but not | |
4071 | documented, and continue didn't quite work properly. The undocumented | |
4072 | parameter to break which gave a return value for the while has been | |
4073 | dropped. | |
4074 | ||
570b5b14 MV |
4075 | ** 'call-with-current-continuation' is now also available under the name |
4076 | 'call/cc'. | |
4077 | ||
b0d10ba6 | 4078 | ** The module system now checks for duplicate bindings. |
7b07e5ef | 4079 | |
fe6ee052 MD |
4080 | The module system now can check for name conflicts among imported |
4081 | bindings. | |
f595ccfe | 4082 | |
b0d10ba6 | 4083 | The behavior can be controlled by specifying one or more 'duplicates' |
fe6ee052 MD |
4084 | handlers. For example, to make Guile return an error for every name |
4085 | collision, write: | |
7b07e5ef MD |
4086 | |
4087 | (define-module (foo) | |
4088 | :use-module (bar) | |
4089 | :use-module (baz) | |
fe6ee052 | 4090 | :duplicates check) |
f595ccfe | 4091 | |
fe6ee052 MD |
4092 | The new default behavior of the module system when a name collision |
4093 | has been detected is to | |
4094 | ||
4095 | 1. Give priority to bindings marked as a replacement. | |
6496a663 | 4096 | 2. Issue a warning (different warning if overriding core binding). |
fe6ee052 MD |
4097 | 3. Give priority to the last encountered binding (this corresponds to |
4098 | the old behavior). | |
4099 | ||
4100 | If you want the old behavior back without replacements or warnings you | |
4101 | can add the line: | |
f595ccfe | 4102 | |
70a9dc9c | 4103 | (default-duplicate-binding-handler 'last) |
7b07e5ef | 4104 | |
fe6ee052 | 4105 | to your .guile init file. |
7b07e5ef | 4106 | |
f595ccfe MD |
4107 | ** New define-module option: :replace |
4108 | ||
4109 | :replace works as :export, but, in addition, marks the binding as a | |
4110 | replacement. | |
4111 | ||
4112 | A typical example is `format' in (ice-9 format) which is a replacement | |
4113 | for the core binding `format'. | |
7b07e5ef | 4114 | |
70da0033 MD |
4115 | ** Adding prefixes to imported bindings in the module system |
4116 | ||
4117 | There is now a new :use-module option :prefix. It can be used to add | |
4118 | a prefix to all imported bindings. | |
4119 | ||
4120 | (define-module (foo) | |
4121 | :use-module ((bar) :prefix bar:)) | |
4122 | ||
4123 | will import all bindings exported from bar, but rename them by adding | |
4124 | the prefix `bar:'. | |
4125 | ||
b0d10ba6 MV |
4126 | ** Conflicting generic functions can be automatically merged. |
4127 | ||
4128 | When two imported bindings conflict and they are both generic | |
4129 | functions, the two functions can now be merged automatically. This is | |
4130 | activated with the 'duplicates' handler 'merge-generics'. | |
4131 | ||
b2cbe8d8 RB |
4132 | ** New function: effective-version |
4133 | ||
4134 | Returns the "effective" version number. This is just the normal full | |
4135 | version string without the final micro-version number. See "Changes | |
4136 | to the distribution" above. | |
4137 | ||
382053e9 | 4138 | ** New threading functions: parallel, letpar, par-map, and friends |
dbe30084 | 4139 | |
382053e9 KR |
4140 | These are convenient ways to run calculations in parallel in new |
4141 | threads. See "Parallel forms" in the manual for details. | |
359aab24 | 4142 | |
e2d820a1 MV |
4143 | ** New function 'try-mutex'. |
4144 | ||
4145 | This function will attempt to lock a mutex but will return immediately | |
0f24e75b | 4146 | instead of blocking and indicate failure. |
e2d820a1 MV |
4147 | |
4148 | ** Waiting on a condition variable can have a timeout. | |
4149 | ||
0f24e75b | 4150 | The function 'wait-condition-variable' now takes a third, optional |
e2d820a1 MV |
4151 | argument that specifies the point in time where the waiting should be |
4152 | aborted. | |
4153 | ||
4154 | ** New function 'broadcast-condition-variable'. | |
4155 | ||
5e405a60 MV |
4156 | ** New functions 'all-threads' and 'current-thread'. |
4157 | ||
4158 | ** Signals and system asyncs work better with threads. | |
4159 | ||
4160 | The function 'sigaction' now takes a fourth, optional, argument that | |
4161 | specifies the thread that the handler should run in. When the | |
4162 | argument is omitted, the handler will run in the thread that called | |
4163 | 'sigaction'. | |
4164 | ||
4165 | Likewise, 'system-async-mark' takes a second, optional, argument that | |
4166 | specifies the thread that the async should run in. When it is | |
4167 | omitted, the async will run in the thread that called | |
4168 | 'system-async-mark'. | |
4169 | ||
4170 | C code can use the new functions scm_sigaction_for_thread and | |
4171 | scm_system_async_mark_for_thread to pass the new thread argument. | |
4172 | ||
a558cc63 MV |
4173 | When a thread blocks on a mutex, a condition variable or is waiting |
4174 | for IO to be possible, it will still execute system asyncs. This can | |
4175 | be used to interrupt such a thread by making it execute a 'throw', for | |
4176 | example. | |
4177 | ||
5e405a60 MV |
4178 | ** The function 'system-async' is deprecated. |
4179 | ||
4180 | You can now pass any zero-argument procedure to 'system-async-mark'. | |
4181 | The function 'system-async' will just return its argument unchanged | |
4182 | now. | |
4183 | ||
acfa1f52 MV |
4184 | ** New functions 'call-with-blocked-asyncs' and |
4185 | 'call-with-unblocked-asyncs' | |
4186 | ||
4187 | The expression (call-with-blocked-asyncs PROC) will call PROC and will | |
4188 | block execution of system asyncs for the current thread by one level | |
4189 | while PROC runs. Likewise, call-with-unblocked-asyncs will call a | |
4190 | procedure and will unblock the execution of system asyncs by one | |
4191 | level for the current thread. | |
4192 | ||
4193 | Only system asyncs are affected by these functions. | |
4194 | ||
4195 | ** The functions 'mask-signals' and 'unmask-signals' are deprecated. | |
4196 | ||
4197 | Use 'call-with-blocked-asyncs' or 'call-with-unblocked-asyncs' | |
4198 | instead. Those functions are easier to use correctly and can be | |
4199 | nested. | |
4200 | ||
7b232758 MV |
4201 | ** New function 'unsetenv'. |
4202 | ||
f30482f3 MV |
4203 | ** New macro 'define-syntax-public'. |
4204 | ||
4205 | It works like 'define-syntax' and also exports the defined macro (but | |
4206 | only on top-level). | |
4207 | ||
1ee34062 MV |
4208 | ** There is support for Infinity and NaNs. |
4209 | ||
4210 | Following PLT Scheme, Guile can now work with infinite numbers, and | |
4211 | 'not-a-numbers'. | |
4212 | ||
4213 | There is new syntax for numbers: "+inf.0" (infinity), "-inf.0" | |
4214 | (negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as | |
4215 | "+nan.0"). These numbers are inexact and have no exact counterpart. | |
4216 | ||
4217 | Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the | |
4218 | sign of the dividend. The infinities are integers, and they answer #t | |
4219 | for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is | |
4220 | not '=' to itself, but '+nan.0' is 'eqv?' to itself. | |
4221 | ||
4222 | For example | |
4223 | ||
4224 | (/ 1 0.0) | |
4225 | => +inf.0 | |
4226 | ||
4227 | (/ 0 0.0) | |
4228 | => +nan.0 | |
4229 | ||
4230 | (/ 0) | |
4231 | ERROR: Numerical overflow | |
4232 | ||
7b232758 MV |
4233 | Two new predicates 'inf?' and 'nan?' can be used to test for the |
4234 | special values. | |
4235 | ||
ba1b077b MV |
4236 | ** Inexact zero can have a sign. |
4237 | ||
4238 | Guile can now distinguish between plus and minus inexact zero, if your | |
4239 | platform supports this, too. The two zeros are equal according to | |
4240 | '=', but not according to 'eqv?'. For example | |
4241 | ||
4242 | (- 0.0) | |
4243 | => -0.0 | |
4244 | ||
4245 | (= 0.0 (- 0.0)) | |
4246 | => #t | |
4247 | ||
4248 | (eqv? 0.0 (- 0.0)) | |
4249 | => #f | |
4250 | ||
bdf26b60 MV |
4251 | ** Guile now has exact rationals. |
4252 | ||
4253 | Guile can now represent fractions such as 1/3 exactly. Computing with | |
4254 | them is also done exactly, of course: | |
4255 | ||
4256 | (* 1/3 3/2) | |
4257 | => 1/2 | |
4258 | ||
4259 | ** 'floor', 'ceiling', 'round' and 'truncate' now return exact numbers | |
4260 | for exact arguments. | |
4261 | ||
4262 | For example: (floor 2) now returns an exact 2 where in the past it | |
4263 | returned an inexact 2.0. Likewise, (floor 5/4) returns an exact 1. | |
4264 | ||
4265 | ** inexact->exact no longer returns only integers. | |
4266 | ||
4267 | Without exact rationals, the closest exact number was always an | |
4268 | integer, but now inexact->exact returns the fraction that is exactly | |
4269 | equal to a floating point number. For example: | |
4270 | ||
4271 | (inexact->exact 1.234) | |
4272 | => 694680242521899/562949953421312 | |
4273 | ||
e299cee2 | 4274 | When you want the old behavior, use 'round' explicitly: |
bdf26b60 MV |
4275 | |
4276 | (inexact->exact (round 1.234)) | |
4277 | => 1 | |
4278 | ||
4279 | ** New function 'rationalize'. | |
4280 | ||
4281 | This function finds a simple fraction that is close to a given real | |
4282 | number. For example (and compare with inexact->exact above): | |
4283 | ||
fb16d26e | 4284 | (rationalize (inexact->exact 1.234) 1/2000) |
bdf26b60 MV |
4285 | => 58/47 |
4286 | ||
fb16d26e MV |
4287 | Note that, as required by R5RS, rationalize returns only then an exact |
4288 | result when both its arguments are exact. | |
4289 | ||
bdf26b60 MV |
4290 | ** 'odd?' and 'even?' work also for inexact integers. |
4291 | ||
4292 | Previously, (odd? 1.0) would signal an error since only exact integers | |
4293 | were recognized as integers. Now (odd? 1.0) returns #t, (odd? 2.0) | |
4294 | returns #f and (odd? 1.5) signals an error. | |
4295 | ||
b0d10ba6 | 4296 | ** Guile now has uninterned symbols. |
610922b2 | 4297 | |
b0d10ba6 | 4298 | The new function 'make-symbol' will return an uninterned symbol. This |
610922b2 MV |
4299 | is a symbol that is unique and is guaranteed to remain unique. |
4300 | However, uninterned symbols can not yet be read back in. | |
4301 | ||
4302 | Use the new function 'symbol-interned?' to check whether a symbol is | |
4303 | interned or not. | |
4304 | ||
0e6f7775 MV |
4305 | ** pretty-print has more options. |
4306 | ||
4307 | The function pretty-print from the (ice-9 pretty-print) module can now | |
4308 | also be invoked with keyword arguments that control things like | |
71f271b2 | 4309 | maximum output width. See the manual for details. |
0e6f7775 | 4310 | |
8c84b81e | 4311 | ** Variables have no longer a special behavior for `equal?'. |
ee0c7345 MV |
4312 | |
4313 | Previously, comparing two variables with `equal?' would recursivly | |
4314 | compare their values. This is no longer done. Variables are now only | |
4315 | `equal?' if they are `eq?'. | |
4316 | ||
4e21fa60 MV |
4317 | ** `(begin)' is now valid. |
4318 | ||
4319 | You can now use an empty `begin' form. It will yield #<unspecified> | |
4320 | when evaluated and simply be ignored in a definition context. | |
4321 | ||
3063e30a DH |
4322 | ** Deprecated: procedure->macro |
4323 | ||
b0d10ba6 MV |
4324 | Change your code to use 'define-macro' or r5rs macros. Also, be aware |
4325 | that macro expansion will not be done during evaluation, but prior to | |
4326 | evaluation. | |
3063e30a | 4327 | |
0a50eeaa NJ |
4328 | ** Soft ports now allow a `char-ready?' procedure |
4329 | ||
4330 | The vector argument to `make-soft-port' can now have a length of | |
4331 | either 5 or 6. (Previously the length had to be 5.) The optional 6th | |
4332 | element is interpreted as an `input-waiting' thunk -- i.e. a thunk | |
4333 | that returns the number of characters that can be read immediately | |
4334 | without the soft port blocking. | |
4335 | ||
63dd3413 DH |
4336 | ** Deprecated: undefine |
4337 | ||
4338 | There is no replacement for undefine. | |
4339 | ||
9abd541e NJ |
4340 | ** The functions make-keyword-from-dash-symbol and keyword-dash-symbol |
4341 | have been discouraged. | |
aef0bdb4 MV |
4342 | |
4343 | They are relics from a time where a keyword like #:foo was used | |
4344 | directly as a Tcl option "-foo" and thus keywords were internally | |
4345 | stored as a symbol with a starting dash. We now store a symbol | |
4346 | without the dash. | |
4347 | ||
4348 | Use symbol->keyword and keyword->symbol instead. | |
4349 | ||
9abd541e NJ |
4350 | ** The `cheap' debug option is now obsolete |
4351 | ||
4352 | Evaluator trap calls are now unconditionally "cheap" - in other words, | |
4353 | they pass a debug object to the trap handler rather than a full | |
4354 | continuation. The trap handler code can capture a full continuation | |
4355 | by using `call-with-current-continuation' in the usual way, if it so | |
4356 | desires. | |
4357 | ||
4358 | The `cheap' option is retained for now so as not to break existing | |
4359 | code which gets or sets it, but setting it now has no effect. It will | |
4360 | be removed in the next major Guile release. | |
4361 | ||
4362 | ** Evaluator trap calls now support `tweaking' | |
4363 | ||
4364 | `Tweaking' means that the trap handler code can modify the Scheme | |
4365 | expression that is about to be evaluated (in the case of an | |
4366 | enter-frame trap) or the value that is being returned (in the case of | |
4367 | an exit-frame trap). The trap handler code indicates that it wants to | |
4368 | do this by returning a pair whose car is the symbol 'instead and whose | |
4369 | cdr is the modified expression or return value. | |
36a9b236 | 4370 | |
b00418df DH |
4371 | * Changes to the C interface |
4372 | ||
87bdbdbc MV |
4373 | ** The functions scm_hash_fn_remove_x and scm_hashx_remove_x no longer |
4374 | take a 'delete' function argument. | |
4375 | ||
4376 | This argument makes no sense since the delete function is used to | |
4377 | remove a pair from an alist, and this must not be configurable. | |
4378 | ||
4379 | This is an incompatible change. | |
4380 | ||
1cf1bb95 MV |
4381 | ** The GH interface is now subject to the deprecation mechanism |
4382 | ||
4383 | The GH interface has been deprecated for quite some time but now it is | |
4384 | actually removed from Guile when it is configured with | |
4385 | --disable-deprecated. | |
4386 | ||
4387 | See the manual "Transitioning away from GH" for more information. | |
4388 | ||
f7f3964e MV |
4389 | ** A new family of functions for converting between C values and |
4390 | Scheme values has been added. | |
4391 | ||
4392 | These functions follow a common naming scheme and are designed to be | |
4393 | easier to use, thread-safe and more future-proof than the older | |
4394 | alternatives. | |
4395 | ||
4396 | - int scm_is_* (...) | |
4397 | ||
4398 | These are predicates that return a C boolean: 1 or 0. Instead of | |
4399 | SCM_NFALSEP, you can now use scm_is_true, for example. | |
4400 | ||
4401 | - <type> scm_to_<type> (SCM val, ...) | |
4402 | ||
4403 | These are functions that convert a Scheme value into an appropriate | |
4404 | C value. For example, you can use scm_to_int to safely convert from | |
4405 | a SCM to an int. | |
4406 | ||
a2b6a0e7 | 4407 | - SCM scm_from_<type> (<type> val, ...) |
f7f3964e MV |
4408 | |
4409 | These functions convert from a C type to a SCM value; for example, | |
4410 | scm_from_int for ints. | |
4411 | ||
4412 | There is a huge number of these functions, for numbers, strings, | |
4413 | symbols, vectors, etc. They are documented in the reference manual in | |
4414 | the API section together with the types that they apply to. | |
4415 | ||
96d8c217 MV |
4416 | ** New functions for dealing with complex numbers in C have been added. |
4417 | ||
4418 | The new functions are scm_c_make_rectangular, scm_c_make_polar, | |
4419 | scm_c_real_part, scm_c_imag_part, scm_c_magnitude and scm_c_angle. | |
4420 | They work like scm_make_rectangular etc but take or return doubles | |
4421 | directly. | |
4422 | ||
4423 | ** The function scm_make_complex has been discouraged. | |
4424 | ||
4425 | Use scm_c_make_rectangular instead. | |
4426 | ||
f7f3964e MV |
4427 | ** The INUM macros have been deprecated. |
4428 | ||
4429 | A lot of code uses these macros to do general integer conversions, | |
b0d10ba6 MV |
4430 | although the macros only work correctly with fixnums. Use the |
4431 | following alternatives. | |
f7f3964e MV |
4432 | |
4433 | SCM_INUMP -> scm_is_integer or similar | |
4434 | SCM_NINUMP -> !scm_is_integer or similar | |
4435 | SCM_MAKINUM -> scm_from_int or similar | |
4436 | SCM_INUM -> scm_to_int or similar | |
4437 | ||
b0d10ba6 | 4438 | SCM_VALIDATE_INUM_* -> Do not use these; scm_to_int, etc. will |
f7f3964e MV |
4439 | do the validating for you. |
4440 | ||
f9656a9f MV |
4441 | ** The scm_num2<type> and scm_<type>2num functions and scm_make_real |
4442 | have been discouraged. | |
f7f3964e MV |
4443 | |
4444 | Use the newer scm_to_<type> and scm_from_<type> functions instead for | |
4445 | new code. The functions have been discouraged since they don't fit | |
4446 | the naming scheme. | |
4447 | ||
4448 | ** The 'boolean' macros SCM_FALSEP etc have been discouraged. | |
4449 | ||
4450 | They have strange names, especially SCM_NFALSEP, and SCM_BOOLP | |
4451 | evaluates its argument twice. Use scm_is_true, etc. instead for new | |
4452 | code. | |
4453 | ||
4454 | ** The macro SCM_EQ_P has been discouraged. | |
4455 | ||
4456 | Use scm_is_eq for new code, which fits better into the naming | |
4457 | conventions. | |
d5b203a6 | 4458 | |
d5ac9b2a MV |
4459 | ** The macros SCM_CONSP, SCM_NCONSP, SCM_NULLP, and SCM_NNULLP have |
4460 | been discouraged. | |
4461 | ||
4462 | Use the function scm_is_pair or scm_is_null instead. | |
4463 | ||
409eb4e5 MV |
4464 | ** The functions scm_round and scm_truncate have been deprecated and |
4465 | are now available as scm_c_round and scm_c_truncate, respectively. | |
4466 | ||
4467 | These functions occupy the names that scm_round_number and | |
4468 | scm_truncate_number should have. | |
4469 | ||
3ff9283d MV |
4470 | ** The functions scm_c_string2str, scm_c_substring2str, and |
4471 | scm_c_symbol2str have been deprecated. | |
c41acab3 MV |
4472 | |
4473 | Use scm_to_locale_stringbuf or similar instead, maybe together with | |
4474 | scm_substring. | |
4475 | ||
3ff9283d MV |
4476 | ** New functions scm_c_make_string, scm_c_string_length, |
4477 | scm_c_string_ref, scm_c_string_set_x, scm_c_substring, | |
4478 | scm_c_substring_shared, scm_c_substring_copy. | |
4479 | ||
4480 | These are like scm_make_string, scm_length, etc. but are slightly | |
4481 | easier to use from C. | |
4482 | ||
4483 | ** The macros SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_LENGTH, | |
4484 | SCM_SYMBOL_CHARS, and SCM_SYMBOL_LENGTH have been deprecated. | |
4485 | ||
4486 | They export too many assumptions about the implementation of strings | |
4487 | and symbols that are no longer true in the presence of | |
b0d10ba6 MV |
4488 | mutation-sharing substrings and when Guile switches to some form of |
4489 | Unicode. | |
3ff9283d MV |
4490 | |
4491 | When working with strings, it is often best to use the normal string | |
4492 | functions provided by Guile, such as scm_c_string_ref, | |
b0d10ba6 MV |
4493 | scm_c_string_set_x, scm_string_append, etc. Be sure to look in the |
4494 | manual since many more such functions are now provided than | |
4495 | previously. | |
3ff9283d MV |
4496 | |
4497 | When you want to convert a SCM string to a C string, use the | |
4498 | scm_to_locale_string function or similar instead. For symbols, use | |
4499 | scm_symbol_to_string and then work with that string. Because of the | |
4500 | new string representation, scm_symbol_to_string does not need to copy | |
4501 | and is thus quite efficient. | |
4502 | ||
aef0bdb4 | 4503 | ** Some string, symbol and keyword functions have been discouraged. |
3ff9283d | 4504 | |
b0d10ba6 | 4505 | They don't fit into the uniform naming scheme and are not explicit |
3ff9283d MV |
4506 | about the character encoding. |
4507 | ||
4508 | Replace according to the following table: | |
4509 | ||
4510 | scm_allocate_string -> scm_c_make_string | |
4511 | scm_take_str -> scm_take_locale_stringn | |
4512 | scm_take0str -> scm_take_locale_string | |
4513 | scm_mem2string -> scm_from_locale_stringn | |
4514 | scm_str2string -> scm_from_locale_string | |
4515 | scm_makfrom0str -> scm_from_locale_string | |
4516 | scm_mem2symbol -> scm_from_locale_symboln | |
b0d10ba6 | 4517 | scm_mem2uninterned_symbol -> scm_from_locale_stringn + scm_make_symbol |
3ff9283d MV |
4518 | scm_str2symbol -> scm_from_locale_symbol |
4519 | ||
4520 | SCM_SYMBOL_HASH -> scm_hashq | |
4521 | SCM_SYMBOL_INTERNED_P -> scm_symbol_interned_p | |
4522 | ||
aef0bdb4 MV |
4523 | scm_c_make_keyword -> scm_from_locale_keyword |
4524 | ||
4525 | ** The functions scm_keyword_to_symbol and sym_symbol_to_keyword are | |
4526 | now also available to C code. | |
4527 | ||
4528 | ** SCM_KEYWORDP and SCM_KEYWORDSYM have been deprecated. | |
4529 | ||
4530 | Use scm_is_keyword and scm_keyword_to_symbol instead, but note that | |
4531 | the latter returns the true name of the keyword, not the 'dash name', | |
4532 | as SCM_KEYWORDSYM used to do. | |
4533 | ||
dc91d8de MV |
4534 | ** A new way to access arrays in a thread-safe and efficient way has |
4535 | been added. | |
4536 | ||
4537 | See the manual, node "Accessing Arrays From C". | |
4538 | ||
3167d5e4 MV |
4539 | ** The old uniform vector and bitvector implementations have been |
4540 | unceremoniously removed. | |
d4ea47c8 | 4541 | |
a558cc63 | 4542 | This implementation exposed the details of the tagging system of |
d4ea47c8 | 4543 | Guile. Use the new C API explained in the manual in node "Uniform |
c34e5780 | 4544 | Numeric Vectors" and "Bit Vectors", respectively. |
d4ea47c8 MV |
4545 | |
4546 | The following macros are gone: SCM_UVECTOR_BASE, SCM_SET_UVECTOR_BASE, | |
4547 | SCM_UVECTOR_MAXLENGTH, SCM_UVECTOR_LENGTH, SCM_MAKE_UVECTOR_TAG, | |
3167d5e4 MV |
4548 | SCM_SET_UVECTOR_LENGTH, SCM_BITVECTOR_P, SCM_BITVECTOR_BASE, |
4549 | SCM_SET_BITVECTOR_BASE, SCM_BITVECTOR_MAX_LENGTH, | |
4550 | SCM_BITVECTOR_LENGTH, SCM_MAKE_BITVECTOR_TAG, | |
0b63c1ee MV |
4551 | SCM_SET_BITVECTOR_LENGTH, SCM_BITVEC_REF, SCM_BITVEC_SET, |
4552 | SCM_BITVEC_CLR. | |
d4ea47c8 | 4553 | |
c34e5780 MV |
4554 | ** The macros dealing with vectors have been deprecated. |
4555 | ||
4556 | Use the new functions scm_is_vector, scm_vector_elements, | |
0b63c1ee MV |
4557 | scm_vector_writable_elements, etc, or scm_is_simple_vector, |
4558 | SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, etc instead. See the | |
4559 | manual for more details. | |
c34e5780 MV |
4560 | |
4561 | Deprecated are SCM_VECTORP, SCM_VELTS, SCM_VECTOR_MAX_LENGTH, | |
4562 | SCM_VECTOR_LENGTH, SCM_VECTOR_REF, SCM_VECTOR_SET, SCM_WRITABLE_VELTS. | |
4563 | ||
4564 | The following macros have been removed: SCM_VECTOR_BASE, | |
4565 | SCM_SET_VECTOR_BASE, SCM_MAKE_VECTOR_TAG, SCM_SET_VECTOR_LENGTH, | |
4566 | SCM_VELTS_AS_STACKITEMS, SCM_SETVELTS, SCM_GC_WRITABLE_VELTS. | |
4567 | ||
0c7a5cab | 4568 | ** Some C functions and macros related to arrays have been deprecated. |
dc91d8de MV |
4569 | |
4570 | Migrate according to the following table: | |
4571 | ||
e94d0be2 | 4572 | scm_make_uve -> scm_make_typed_array, scm_make_u8vector etc. |
dc91d8de MV |
4573 | scm_make_ra -> scm_make_array |
4574 | scm_shap2ra -> scm_make_array | |
4575 | scm_cvref -> scm_c_generalized_vector_ref | |
4576 | scm_ra_set_contp -> do not use | |
4577 | scm_aind -> scm_array_handle_pos | |
4578 | scm_raprin1 -> scm_display or scm_write | |
4579 | ||
0c7a5cab MV |
4580 | SCM_ARRAYP -> scm_is_array |
4581 | SCM_ARRAY_NDIM -> scm_c_array_rank | |
4582 | SCM_ARRAY_DIMS -> scm_array_handle_dims | |
4583 | SCM_ARRAY_CONTP -> do not use | |
4584 | SCM_ARRAY_MEM -> do not use | |
4585 | SCM_ARRAY_V -> scm_array_handle_elements or similar | |
4586 | SCM_ARRAY_BASE -> do not use | |
4587 | ||
c1e7caf7 MV |
4588 | ** SCM_CELL_WORD_LOC has been deprecated. |
4589 | ||
b0d10ba6 | 4590 | Use the new macro SCM_CELL_OBJECT_LOC instead, which returns a pointer |
c1e7caf7 MV |
4591 | to a SCM, as opposed to a pointer to a scm_t_bits. |
4592 | ||
4593 | This was done to allow the correct use of pointers into the Scheme | |
4594 | heap. Previously, the heap words were of type scm_t_bits and local | |
4595 | variables and function arguments were of type SCM, making it | |
4596 | non-standards-conformant to have a pointer that can point to both. | |
4597 | ||
3ff9283d | 4598 | ** New macros SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, etc. |
27968825 MV |
4599 | |
4600 | These macros should be used instead of SCM_CELL_WORD_2/3 to access the | |
4601 | second and third words of double smobs. Likewise for | |
4602 | SCM_SET_SMOB_DATA_2 and SCM_SET_SMOB_DATA_3. | |
4603 | ||
4604 | Also, there is SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS that should be | |
4605 | used to get and set the 16 exra bits in the zeroth word of a smob. | |
4606 | ||
4607 | And finally, there is SCM_SMOB_OBJECT and SCM_SMOB_SET_OBJECT for | |
4608 | accesing the first immediate word of a smob as a SCM value, and there | |
4609 | is SCM_SMOB_OBJECT_LOC for getting a pointer to the first immediate | |
b0d10ba6 | 4610 | smob word. Like wise for SCM_SMOB_OBJECT_2, etc. |
27968825 | 4611 | |
b0d10ba6 | 4612 | ** New way to deal with non-local exits and re-entries. |
9879d390 MV |
4613 | |
4614 | There is a new set of functions that essentially do what | |
fc6bb283 MV |
4615 | scm_internal_dynamic_wind does, but in a way that is more convenient |
4616 | for C code in some situations. Here is a quick example of how to | |
4617 | prevent a potential memory leak: | |
9879d390 MV |
4618 | |
4619 | void | |
4620 | foo () | |
4621 | { | |
4622 | char *mem; | |
4623 | ||
661ae7ab | 4624 | scm_dynwind_begin (0); |
9879d390 MV |
4625 | |
4626 | mem = scm_malloc (100); | |
661ae7ab | 4627 | scm_dynwind_unwind_handler (free, mem, SCM_F_WIND_EXPLICITLY); |
f1da8e4e MV |
4628 | |
4629 | /* MEM would leak if BAR throws an error. | |
661ae7ab | 4630 | SCM_DYNWIND_UNWIND_HANDLER frees it nevertheless. |
c41acab3 | 4631 | */ |
9879d390 | 4632 | |
9879d390 MV |
4633 | bar (); |
4634 | ||
661ae7ab | 4635 | scm_dynwind_end (); |
9879d390 | 4636 | |
e299cee2 | 4637 | /* Because of SCM_F_WIND_EXPLICITLY, MEM will be freed by |
661ae7ab | 4638 | SCM_DYNWIND_END as well. |
9879d390 MV |
4639 | */ |
4640 | } | |
4641 | ||
661ae7ab | 4642 | For full documentation, see the node "Dynamic Wind" in the manual. |
9879d390 | 4643 | |
661ae7ab | 4644 | ** New function scm_dynwind_free |
c41acab3 | 4645 | |
661ae7ab MV |
4646 | This function calls 'free' on a given pointer when a dynwind context |
4647 | is left. Thus the call to scm_dynwind_unwind_handler above could be | |
4648 | replaced with simply scm_dynwind_free (mem). | |
c41acab3 | 4649 | |
a6d75e53 MV |
4650 | ** New functions scm_c_call_with_blocked_asyncs and |
4651 | scm_c_call_with_unblocked_asyncs | |
4652 | ||
4653 | Like scm_call_with_blocked_asyncs etc. but for C functions. | |
4654 | ||
661ae7ab | 4655 | ** New functions scm_dynwind_block_asyncs and scm_dynwind_unblock_asyncs |
49c00ecc MV |
4656 | |
4657 | In addition to scm_c_call_with_blocked_asyncs you can now also use | |
661ae7ab MV |
4658 | scm_dynwind_block_asyncs in a 'dynwind context' (see above). Likewise for |
4659 | scm_c_call_with_unblocked_asyncs and scm_dynwind_unblock_asyncs. | |
49c00ecc | 4660 | |
a558cc63 MV |
4661 | ** The macros SCM_DEFER_INTS, SCM_ALLOW_INTS, SCM_REDEFER_INTS, |
4662 | SCM_REALLOW_INTS have been deprecated. | |
4663 | ||
4664 | They do no longer fulfill their original role of blocking signal | |
4665 | delivery. Depending on what you want to achieve, replace a pair of | |
661ae7ab MV |
4666 | SCM_DEFER_INTS and SCM_ALLOW_INTS with a dynwind context that locks a |
4667 | mutex, blocks asyncs, or both. See node "Critical Sections" in the | |
4668 | manual. | |
a6d75e53 MV |
4669 | |
4670 | ** The value 'scm_mask_ints' is no longer writable. | |
4671 | ||
4672 | Previously, you could set scm_mask_ints directly. This is no longer | |
4673 | possible. Use scm_c_call_with_blocked_asyncs and | |
4674 | scm_c_call_with_unblocked_asyncs instead. | |
a558cc63 | 4675 | |
49c00ecc MV |
4676 | ** New way to temporarily set the current input, output or error ports |
4677 | ||
661ae7ab | 4678 | C code can now use scm_dynwind_current_<foo>_port in a 'dynwind |
0f24e75b | 4679 | context' (see above). <foo> is one of "input", "output" or "error". |
49c00ecc | 4680 | |
fc6bb283 MV |
4681 | ** New way to temporarily set fluids |
4682 | ||
661ae7ab | 4683 | C code can now use scm_dynwind_fluid in a 'dynwind context' (see |
fc6bb283 MV |
4684 | above) to temporarily set the value of a fluid. |
4685 | ||
89fcf1b4 MV |
4686 | ** New types scm_t_intmax and scm_t_uintmax. |
4687 | ||
4688 | On platforms that have them, these types are identical to intmax_t and | |
4689 | uintmax_t, respectively. On other platforms, they are identical to | |
4690 | the largest integer types that Guile knows about. | |
4691 | ||
b0d10ba6 | 4692 | ** The functions scm_unmemocopy and scm_unmemoize have been removed. |
9fcf3cbb | 4693 | |
b0d10ba6 | 4694 | You should not have used them. |
9fcf3cbb | 4695 | |
5ebbe4ef RB |
4696 | ** Many public #defines with generic names have been made private. |
4697 | ||
4698 | #defines with generic names like HAVE_FOO or SIZEOF_FOO have been made | |
b0d10ba6 | 4699 | private or renamed with a more suitable public name. |
f03314f9 DH |
4700 | |
4701 | ** The macro SCM_TYP16S has been deprecated. | |
4702 | ||
b0d10ba6 | 4703 | This macro is not intended for public use. |
f03314f9 | 4704 | |
0d5e3480 DH |
4705 | ** The macro SCM_SLOPPY_INEXACTP has been deprecated. |
4706 | ||
b0d10ba6 | 4707 | Use scm_is_true (scm_inexact_p (...)) instead. |
0d5e3480 DH |
4708 | |
4709 | ** The macro SCM_SLOPPY_REALP has been deprecated. | |
4710 | ||
b0d10ba6 | 4711 | Use scm_is_real instead. |
0d5e3480 DH |
4712 | |
4713 | ** The macro SCM_SLOPPY_COMPLEXP has been deprecated. | |
4714 | ||
b0d10ba6 | 4715 | Use scm_is_complex instead. |
5ebbe4ef | 4716 | |
b0d10ba6 | 4717 | ** Some preprocessor defines have been deprecated. |
5ebbe4ef | 4718 | |
b0d10ba6 MV |
4719 | These defines indicated whether a certain feature was present in Guile |
4720 | or not. Going forward, assume that the features are always present. | |
5ebbe4ef | 4721 | |
b0d10ba6 MV |
4722 | The macros are: USE_THREADS, GUILE_ISELECT, READER_EXTENSIONS, |
4723 | DEBUG_EXTENSIONS, DYNAMIC_LINKING. | |
5ebbe4ef | 4724 | |
b0d10ba6 MV |
4725 | The following macros have been removed completely: MEMOIZE_LOCALS, |
4726 | SCM_RECKLESS, SCM_CAUTIOUS. | |
5ebbe4ef RB |
4727 | |
4728 | ** The preprocessor define STACK_DIRECTION has been deprecated. | |
4729 | ||
4730 | There should be no need to know about the stack direction for ordinary | |
b0d10ba6 | 4731 | programs. |
5ebbe4ef | 4732 | |
b2cbe8d8 RB |
4733 | ** New function: scm_effective_version |
4734 | ||
4735 | Returns the "effective" version number. This is just the normal full | |
4736 | version string without the final micro-version number. See "Changes | |
4737 | to the distribution" above. | |
4738 | ||
2902a459 MV |
4739 | ** The function scm_call_with_new_thread has a new prototype. |
4740 | ||
4741 | Instead of taking a list with the thunk and handler, these two | |
4742 | arguments are now passed directly: | |
4743 | ||
4744 | SCM scm_call_with_new_thread (SCM thunk, SCM handler); | |
4745 | ||
4746 | This is an incompatible change. | |
4747 | ||
ffd0ef3b MV |
4748 | ** New snarfer macro SCM_DEFINE_PUBLIC. |
4749 | ||
4750 | This is like SCM_DEFINE, but also calls scm_c_export for the defined | |
4751 | function in the init section. | |
4752 | ||
8734ce02 MV |
4753 | ** The snarfer macro SCM_SNARF_INIT is now officially supported. |
4754 | ||
39e8f371 HWN |
4755 | ** Garbage collector rewrite. |
4756 | ||
4757 | The garbage collector is cleaned up a lot, and now uses lazy | |
4758 | sweeping. This is reflected in the output of (gc-stats); since cells | |
4759 | are being freed when they are allocated, the cells-allocated field | |
4760 | stays roughly constant. | |
4761 | ||
4762 | For malloc related triggers, the behavior is changed. It uses the same | |
4763 | heuristic as the cell-triggered collections. It may be tuned with the | |
4764 | environment variables GUILE_MIN_YIELD_MALLOC. This is the percentage | |
4765 | for minimum yield of malloc related triggers. The default is 40. | |
4766 | GUILE_INIT_MALLOC_LIMIT sets the initial trigger for doing a GC. The | |
4767 | default is 200 kb. | |
4768 | ||
4769 | Debugging operations for the freelist have been deprecated, along with | |
4770 | the C variables that control garbage collection. The environment | |
4771 | variables GUILE_MAX_SEGMENT_SIZE, GUILE_INIT_SEGMENT_SIZE_2, | |
4772 | GUILE_INIT_SEGMENT_SIZE_1, and GUILE_MIN_YIELD_2 should be used. | |
4773 | ||
1367aa5e HWN |
4774 | For understanding the memory usage of a GUILE program, the routine |
4775 | gc-live-object-stats returns an alist containing the number of live | |
4776 | objects for every type. | |
4777 | ||
4778 | ||
5ec1d2c8 DH |
4779 | ** The function scm_definedp has been renamed to scm_defined_p |
4780 | ||
4781 | The name scm_definedp is deprecated. | |
4782 | ||
b0d10ba6 | 4783 | ** The struct scm_cell type has been renamed to scm_t_cell |
228a24ef DH |
4784 | |
4785 | This is in accordance to Guile's naming scheme for types. Note that | |
4786 | the name scm_cell is now used for a function that allocates and | |
4787 | initializes a new cell (see below). | |
4788 | ||
0906625f MV |
4789 | ** New functions for memory management |
4790 | ||
4791 | A new set of functions for memory management has been added since the | |
4792 | old way (scm_must_malloc, scm_must_free, etc) was error prone and | |
4793 | indeed, Guile itself contained some long standing bugs that could | |
4794 | cause aborts in long running programs. | |
4795 | ||
4796 | The new functions are more symmetrical and do not need cooperation | |
4797 | from smob free routines, among other improvements. | |
4798 | ||
eab1b259 HWN |
4799 | The new functions are scm_malloc, scm_realloc, scm_calloc, scm_strdup, |
4800 | scm_strndup, scm_gc_malloc, scm_gc_calloc, scm_gc_realloc, | |
4801 | scm_gc_free, scm_gc_register_collectable_memory, and | |
0906625f MV |
4802 | scm_gc_unregister_collectable_memory. Refer to the manual for more |
4803 | details and for upgrading instructions. | |
4804 | ||
4805 | The old functions for memory management have been deprecated. They | |
4806 | are: scm_must_malloc, scm_must_realloc, scm_must_free, | |
4807 | scm_must_strdup, scm_must_strndup, scm_done_malloc, scm_done_free. | |
4808 | ||
4aa104a4 MV |
4809 | ** Declarations of exported features are marked with SCM_API. |
4810 | ||
4811 | Every declaration of a feature that belongs to the exported Guile API | |
4812 | has been marked by adding the macro "SCM_API" to the start of the | |
4813 | declaration. This macro can expand into different things, the most | |
4814 | common of which is just "extern" for Unix platforms. On Win32, it can | |
4815 | be used to control which symbols are exported from a DLL. | |
4816 | ||
8f99e3f3 | 4817 | If you `#define SCM_IMPORT' before including <libguile.h>, SCM_API |
4aa104a4 MV |
4818 | will expand into "__declspec (dllimport) extern", which is needed for |
4819 | linking to the Guile DLL in Windows. | |
4820 | ||
b0d10ba6 | 4821 | There are also SCM_RL_IMPORT, SCM_SRFI1314_IMPORT, and |
8f99e3f3 | 4822 | SCM_SRFI4_IMPORT, for the corresponding libraries. |
4aa104a4 | 4823 | |
a9930d22 MV |
4824 | ** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated. |
4825 | ||
b0d10ba6 MV |
4826 | Use the new functions scm_cell and scm_double_cell instead. The old |
4827 | macros had problems because with them allocation and initialization | |
4828 | was separated and the GC could sometimes observe half initialized | |
4829 | cells. Only careful coding by the user of SCM_NEWCELL and | |
4830 | SCM_NEWCELL2 could make this safe and efficient. | |
a9930d22 | 4831 | |
5132eef0 DH |
4832 | ** CHECK_ENTRY, CHECK_APPLY and CHECK_EXIT have been deprecated. |
4833 | ||
4834 | Use the variables scm_check_entry_p, scm_check_apply_p and scm_check_exit_p | |
4835 | instead. | |
4836 | ||
bc76d628 DH |
4837 | ** SRCBRKP has been deprecated. |
4838 | ||
4839 | Use scm_c_source_property_breakpoint_p instead. | |
4840 | ||
3063e30a DH |
4841 | ** Deprecated: scm_makmacro |
4842 | ||
b0d10ba6 MV |
4843 | Change your code to use either scm_makmmacro or to define macros in |
4844 | Scheme, using 'define-macro'. | |
1e5f92ce | 4845 | |
1a61d41b MV |
4846 | ** New function scm_c_port_for_each. |
4847 | ||
4848 | This function is like scm_port_for_each but takes a pointer to a C | |
4849 | function as the callback instead of a SCM value. | |
4850 | ||
1f834c95 MV |
4851 | ** The names scm_internal_select, scm_thread_sleep, and |
4852 | scm_thread_usleep have been discouraged. | |
4853 | ||
4854 | Use scm_std_select, scm_std_sleep, scm_std_usleep instead. | |
4855 | ||
aa9200e5 MV |
4856 | ** The GC can no longer be blocked. |
4857 | ||
4858 | The global flags scm_gc_heap_lock and scm_block_gc have been removed. | |
4859 | The GC can now run (partially) concurrently with other code and thus | |
4860 | blocking it is not well defined. | |
4861 | ||
b0d10ba6 MV |
4862 | ** Many definitions have been removed that were previously deprecated. |
4863 | ||
4864 | scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify, | |
4865 | scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify, | |
4866 | scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2, | |
4867 | scm_tc16_allocated, SCM_SET_SYMBOL_HASH, SCM_IM_NIL_IFY, SCM_IM_T_IFY, | |
4868 | SCM_IM_0_COND, SCM_IM_0_IFY, SCM_IM_1_IFY, SCM_GC_SET_ALLOCATED, | |
4869 | scm_debug_newcell, scm_debug_newcell2, SCM_HUP_SIGNAL, SCM_INT_SIGNAL, | |
4870 | SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, SCM_ALRM_SIGNAL, | |
4871 | SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, SCM_ORD_SIG, | |
4872 | SCM_NUM_SIGS, scm_top_level_lookup_closure_var, | |
4873 | *top-level-lookup-closure*, scm_system_transformer, scm_eval_3, | |
4874 | scm_eval2, root_module_lookup_closure, SCM_SLOPPY_STRINGP, | |
4875 | SCM_RWSTRINGP, scm_read_only_string_p, scm_make_shared_substring, | |
4876 | scm_tc7_substring, sym_huh, SCM_VARVCELL, SCM_UDVARIABLEP, | |
4877 | SCM_DEFVARIABLEP, scm_mkbig, scm_big2inum, scm_adjbig, scm_normbig, | |
4878 | scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl, SCM_FIXNUM_BIT, | |
4879 | SCM_SETCHARS, SCM_SLOPPY_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, | |
4880 | SCM_LENGTH_MAX, SCM_SETLENGTH, SCM_ROSTRINGP, SCM_ROLENGTH, | |
4881 | SCM_ROCHARS, SCM_ROUCHARS, SCM_SUBSTRP, SCM_COERCE_SUBSTR, | |
4882 | scm_sym2vcell, scm_intern, scm_intern0, scm_sysintern, scm_sysintern0, | |
66c8ded2 | 4883 | scm_sysintern0_no_module_lookup, scm_init_symbols_deprecated, |
2109da78 | 4884 | scm_vector_set_length_x, scm_contregs, scm_debug_info, |
983e697d MV |
4885 | scm_debug_frame, SCM_DSIDEVAL, SCM_CONST_LONG, SCM_VCELL, |
4886 | SCM_GLOBAL_VCELL, SCM_VCELL_INIT, SCM_GLOBAL_VCELL_INIT, | |
4887 | SCM_HUGE_LENGTH, SCM_VALIDATE_STRINGORSUBSTR, SCM_VALIDATE_ROSTRING, | |
4888 | SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY, | |
4889 | SCM_VALIDATE_RWSTRING, DIGITS, scm_small_istr2int, scm_istr2int, | |
2109da78 MV |
4890 | scm_istr2flo, scm_istring2number, scm_istr2int, scm_istr2flo, |
4891 | scm_istring2number, scm_vtable_index_vcell, scm_si_vcell, SCM_ECONSP, | |
4892 | SCM_NECONSP, SCM_GLOC_VAR, SCM_GLOC_VAL, SCM_GLOC_SET_VAL, | |
c41acab3 MV |
4893 | SCM_GLOC_VAL_LOC, scm_make_gloc, scm_gloc_p, scm_tc16_variable, |
4894 | SCM_CHARS, SCM_LENGTH, SCM_SET_STRING_CHARS, SCM_SET_STRING_LENGTH. | |
b51bad08 | 4895 | |
09172f9c NJ |
4896 | * Changes to bundled modules |
4897 | ||
4898 | ** (ice-9 debug) | |
4899 | ||
4900 | Using the (ice-9 debug) module no longer automatically switches Guile | |
4901 | to use the debugging evaluator. If you want to switch to the | |
4902 | debugging evaluator (which is needed for backtrace information if you | |
4903 | hit an error), please add an explicit "(debug-enable 'debug)" to your | |
4904 | code just after the code to use (ice-9 debug). | |
4905 | ||
328dc9a3 | 4906 | \f |
c299f186 MD |
4907 | Changes since Guile 1.4: |
4908 | ||
4909 | * Changes to the distribution | |
4910 | ||
32d6f999 TTN |
4911 | ** A top-level TODO file is included. |
4912 | ||
311b6a3c | 4913 | ** Guile now uses a versioning scheme similar to that of the Linux kernel. |
c81ea65d RB |
4914 | |
4915 | Guile now always uses three numbers to represent the version, | |
4916 | i.e. "1.6.5". The first number, 1, is the major version number, the | |
4917 | second number, 6, is the minor version number, and the third number, | |
4918 | 5, is the micro version number. Changes in major version number | |
4919 | indicate major changes in Guile. | |
4920 | ||
4921 | Minor version numbers that are even denote stable releases, and odd | |
4922 | minor version numbers denote development versions (which may be | |
4923 | unstable). The micro version number indicates a minor sub-revision of | |
4924 | a given MAJOR.MINOR release. | |
4925 | ||
4926 | In keeping with the new scheme, (minor-version) and scm_minor_version | |
4927 | no longer return everything but the major version number. They now | |
4928 | just return the minor version number. Two new functions | |
4929 | (micro-version) and scm_micro_version have been added to report the | |
4930 | micro version number. | |
4931 | ||
4932 | In addition, ./GUILE-VERSION now defines GUILE_MICRO_VERSION. | |
4933 | ||
5c790b44 RB |
4934 | ** New preprocessor definitions are available for checking versions. |
4935 | ||
4936 | version.h now #defines SCM_MAJOR_VERSION, SCM_MINOR_VERSION, and | |
4937 | SCM_MICRO_VERSION to the appropriate integer values. | |
4938 | ||
311b6a3c MV |
4939 | ** Guile now actively warns about deprecated features. |
4940 | ||
4941 | The new configure option `--enable-deprecated=LEVEL' and the | |
4942 | environment variable GUILE_WARN_DEPRECATED control this mechanism. | |
4943 | See INSTALL and README for more information. | |
4944 | ||
0b073f0f RB |
4945 | ** Guile is much more likely to work on 64-bit architectures. |
4946 | ||
4947 | Guile now compiles and passes "make check" with only two UNRESOLVED GC | |
5e137c65 RB |
4948 | cases on Alpha and ia64 based machines now. Thanks to John Goerzen |
4949 | for the use of a test machine, and thanks to Stefan Jahn for ia64 | |
4950 | patches. | |
0b073f0f | 4951 | |
e658215a RB |
4952 | ** New functions: setitimer and getitimer. |
4953 | ||
4954 | These implement a fairly direct interface to the libc functions of the | |
4955 | same name. | |
4956 | ||
8630fdfc RB |
4957 | ** The #. reader extension is now disabled by default. |
4958 | ||
4959 | For safety reasons, #. evaluation is disabled by default. To | |
4960 | re-enable it, set the fluid read-eval? to #t. For example: | |
4961 | ||
67b7dd9e | 4962 | (fluid-set! read-eval? #t) |
8630fdfc RB |
4963 | |
4964 | but make sure you realize the potential security risks involved. With | |
4965 | read-eval? enabled, reading a data file from an untrusted source can | |
4966 | be dangerous. | |
4967 | ||
f2a75d81 | 4968 | ** New SRFI modules have been added: |
4df36934 | 4969 | |
dfdf5826 MG |
4970 | SRFI-0 `cond-expand' is now supported in Guile, without requiring |
4971 | using a module. | |
4972 | ||
e8bb0476 MG |
4973 | (srfi srfi-1) is a library containing many useful pair- and list-processing |
4974 | procedures. | |
4975 | ||
7adc2c58 | 4976 | (srfi srfi-2) exports and-let*. |
4df36934 | 4977 | |
b74a7ec8 MG |
4978 | (srfi srfi-4) implements homogeneous numeric vector datatypes. |
4979 | ||
7adc2c58 RB |
4980 | (srfi srfi-6) is a dummy module for now, since guile already provides |
4981 | all of the srfi-6 procedures by default: open-input-string, | |
4982 | open-output-string, get-output-string. | |
4df36934 | 4983 | |
7adc2c58 | 4984 | (srfi srfi-8) exports receive. |
4df36934 | 4985 | |
7adc2c58 | 4986 | (srfi srfi-9) exports define-record-type. |
4df36934 | 4987 | |
dfdf5826 MG |
4988 | (srfi srfi-10) exports define-reader-ctor and implements the reader |
4989 | extension #,(). | |
4990 | ||
7adc2c58 | 4991 | (srfi srfi-11) exports let-values and let*-values. |
4df36934 | 4992 | |
7adc2c58 | 4993 | (srfi srfi-13) implements the SRFI String Library. |
53e29a1e | 4994 | |
7adc2c58 | 4995 | (srfi srfi-14) implements the SRFI Character-Set Library. |
53e29a1e | 4996 | |
dfdf5826 MG |
4997 | (srfi srfi-17) implements setter and getter-with-setter and redefines |
4998 | some accessor procedures as procedures with getters. (such as car, | |
4999 | cdr, vector-ref etc.) | |
5000 | ||
5001 | (srfi srfi-19) implements the SRFI Time/Date Library. | |
2b60bc95 | 5002 | |
466bb4b3 TTN |
5003 | ** New scripts / "executable modules" |
5004 | ||
5005 | Subdirectory "scripts" contains Scheme modules that are packaged to | |
5006 | also be executable as scripts. At this time, these scripts are available: | |
5007 | ||
5008 | display-commentary | |
5009 | doc-snarf | |
5010 | generate-autoload | |
5011 | punify | |
58e5b910 | 5012 | read-scheme-source |
466bb4b3 TTN |
5013 | use2dot |
5014 | ||
5015 | See README there for more info. | |
5016 | ||
54c17ccb TTN |
5017 | These scripts can be invoked from the shell with the new program |
5018 | "guile-tools", which keeps track of installation directory for you. | |
5019 | For example: | |
5020 | ||
5021 | $ guile-tools display-commentary srfi/*.scm | |
5022 | ||
5023 | guile-tools is copied to the standard $bindir on "make install". | |
5024 | ||
0109c4bf MD |
5025 | ** New module (ice-9 stack-catch): |
5026 | ||
5027 | stack-catch is like catch, but saves the current state of the stack in | |
3c1d1301 RB |
5028 | the fluid the-last-stack. This fluid can be useful when using the |
5029 | debugger and when re-throwing an error. | |
0109c4bf | 5030 | |
fbf0c8c7 MV |
5031 | ** The module (ice-9 and-let*) has been renamed to (ice-9 and-let-star) |
5032 | ||
5033 | This has been done to prevent problems on lesser operating systems | |
5034 | that can't tolerate `*'s in file names. The exported macro continues | |
5035 | to be named `and-let*', of course. | |
5036 | ||
4f60cc33 | 5037 | On systems that support it, there is also a compatibility module named |
fbf0c8c7 | 5038 | (ice-9 and-let*). It will go away in the next release. |
6c0201ad | 5039 | |
9d774814 | 5040 | ** New modules (oop goops) etc.: |
14f1d9fe MD |
5041 | |
5042 | (oop goops) | |
5043 | (oop goops describe) | |
5044 | (oop goops save) | |
5045 | (oop goops active-slot) | |
5046 | (oop goops composite-slot) | |
5047 | ||
9d774814 | 5048 | The Guile Object Oriented Programming System (GOOPS) has been |
311b6a3c MV |
5049 | integrated into Guile. For further information, consult the GOOPS |
5050 | manual and tutorial in the `doc' directory. | |
14f1d9fe | 5051 | |
9d774814 GH |
5052 | ** New module (ice-9 rdelim). |
5053 | ||
5054 | This exports the following procedures which were previously defined | |
1c8cbd62 | 5055 | in the default environment: |
9d774814 | 5056 | |
1c8cbd62 GH |
5057 | read-line read-line! read-delimited read-delimited! %read-delimited! |
5058 | %read-line write-line | |
9d774814 | 5059 | |
1c8cbd62 GH |
5060 | For backwards compatibility the definitions are still imported into the |
5061 | default environment in this version of Guile. However you should add: | |
9d774814 GH |
5062 | |
5063 | (use-modules (ice-9 rdelim)) | |
5064 | ||
1c8cbd62 GH |
5065 | to any program which uses the definitions, since this may change in |
5066 | future. | |
9d774814 GH |
5067 | |
5068 | Alternatively, if guile-scsh is installed, the (scsh rdelim) module | |
5069 | can be used for similar functionality. | |
5070 | ||
7e267da1 GH |
5071 | ** New module (ice-9 rw) |
5072 | ||
5073 | This is a subset of the (scsh rw) module from guile-scsh. Currently | |
373f4948 | 5074 | it defines two procedures: |
7e267da1 | 5075 | |
311b6a3c | 5076 | *** New function: read-string!/partial str [port_or_fdes [start [end]]] |
7e267da1 | 5077 | |
4bcdfe46 GH |
5078 | Read characters from a port or file descriptor into a string STR. |
5079 | A port must have an underlying file descriptor -- a so-called | |
5080 | fport. This procedure is scsh-compatible and can efficiently read | |
311b6a3c | 5081 | large strings. |
7e267da1 | 5082 | |
4bcdfe46 GH |
5083 | *** New function: write-string/partial str [port_or_fdes [start [end]]] |
5084 | ||
5085 | Write characters from a string STR to a port or file descriptor. | |
5086 | A port must have an underlying file descriptor -- a so-called | |
5087 | fport. This procedure is mostly compatible and can efficiently | |
5088 | write large strings. | |
5089 | ||
e5005373 KN |
5090 | ** New module (ice-9 match) |
5091 | ||
311b6a3c MV |
5092 | This module includes Andrew K. Wright's pattern matcher. See |
5093 | ice-9/match.scm for brief description or | |
e5005373 | 5094 | |
311b6a3c | 5095 | http://www.star-lab.com/wright/code.html |
e5005373 | 5096 | |
311b6a3c | 5097 | for complete documentation. |
e5005373 | 5098 | |
4f60cc33 NJ |
5099 | ** New module (ice-9 buffered-input) |
5100 | ||
5101 | This module provides procedures to construct an input port from an | |
5102 | underlying source of input that reads and returns its input in chunks. | |
5103 | The underlying input source is a Scheme procedure, specified by the | |
5104 | caller, which the port invokes whenever it needs more input. | |
5105 | ||
5106 | This is useful when building an input port whose back end is Readline | |
5107 | or a UI element such as the GtkEntry widget. | |
5108 | ||
5109 | ** Documentation | |
5110 | ||
5111 | The reference and tutorial documentation that was previously | |
5112 | distributed separately, as `guile-doc', is now included in the core | |
5113 | Guile distribution. The documentation consists of the following | |
5114 | manuals. | |
5115 | ||
5116 | - The Guile Tutorial (guile-tut.texi) contains a tutorial introduction | |
5117 | to using Guile. | |
5118 | ||
5119 | - The Guile Reference Manual (guile.texi) contains (or is intended to | |
5120 | contain) reference documentation on all aspects of Guile. | |
5121 | ||
5122 | - The GOOPS Manual (goops.texi) contains both tutorial-style and | |
5123 | reference documentation for using GOOPS, Guile's Object Oriented | |
5124 | Programming System. | |
5125 | ||
c3e62877 NJ |
5126 | - The Revised^5 Report on the Algorithmic Language Scheme |
5127 | (r5rs.texi). | |
4f60cc33 NJ |
5128 | |
5129 | See the README file in the `doc' directory for more details. | |
5130 | ||
094a67bb MV |
5131 | ** There are a couple of examples in the examples/ directory now. |
5132 | ||
9d774814 GH |
5133 | * Changes to the stand-alone interpreter |
5134 | ||
e7e58018 MG |
5135 | ** New command line option `--use-srfi' |
5136 | ||
5137 | Using this option, SRFI modules can be loaded on startup and be | |
5138 | available right from the beginning. This makes programming portable | |
5139 | Scheme programs easier. | |
5140 | ||
5141 | The option `--use-srfi' expects a comma-separated list of numbers, | |
5142 | each representing a SRFI number to be loaded into the interpreter | |
5143 | before starting evaluating a script file or the REPL. Additionally, | |
5144 | the feature identifier for the loaded SRFIs is recognized by | |
5145 | `cond-expand' when using this option. | |
5146 | ||
5147 | Example: | |
5148 | $ guile --use-srfi=8,13 | |
5149 | guile> (receive (x z) (values 1 2) (+ 1 2)) | |
5150 | 3 | |
58e5b910 | 5151 | guile> (string-pad "bla" 20) |
e7e58018 MG |
5152 | " bla" |
5153 | ||
094a67bb MV |
5154 | ** Guile now always starts up in the `(guile-user)' module. |
5155 | ||
6e9382f1 | 5156 | Previously, scripts executed via the `-s' option would run in the |
094a67bb MV |
5157 | `(guile)' module and the repl would run in the `(guile-user)' module. |
5158 | Now every user action takes place in the `(guile-user)' module by | |
5159 | default. | |
e7e58018 | 5160 | |
c299f186 MD |
5161 | * Changes to Scheme functions and syntax |
5162 | ||
720e1c30 MV |
5163 | ** Character classifiers work for non-ASCII characters. |
5164 | ||
5165 | The predicates `char-alphabetic?', `char-numeric?', | |
5166 | `char-whitespace?', `char-lower?', `char-upper?' and `char-is-both?' | |
5167 | no longer check whether their arguments are ASCII characters. | |
5168 | Previously, a character would only be considered alphabetic when it | |
5169 | was also ASCII, for example. | |
5170 | ||
311b6a3c MV |
5171 | ** Previously deprecated Scheme functions have been removed: |
5172 | ||
5173 | tag - no replacement. | |
5174 | fseek - replaced by seek. | |
5175 | list* - replaced by cons*. | |
5176 | ||
5177 | ** It's now possible to create modules with controlled environments | |
5178 | ||
5179 | Example: | |
5180 | ||
5181 | (use-modules (ice-9 safe)) | |
5182 | (define m (make-safe-module)) | |
5183 | ;;; m will now be a module containing only a safe subset of R5RS | |
5184 | (eval '(+ 1 2) m) --> 3 | |
5185 | (eval 'load m) --> ERROR: Unbound variable: load | |
5186 | ||
5187 | ** Evaluation of "()", the empty list, is now an error. | |
8c2c9967 MV |
5188 | |
5189 | Previously, the expression "()" evaluated to the empty list. This has | |
5190 | been changed to signal a "missing expression" error. The correct way | |
5191 | to write the empty list as a literal constant is to use quote: "'()". | |
5192 | ||
311b6a3c MV |
5193 | ** New concept of `Guile Extensions'. |
5194 | ||
5195 | A Guile Extension is just a ordinary shared library that can be linked | |
5196 | at run-time. We found it advantageous to give this simple concept a | |
5197 | dedicated name to distinguish the issues related to shared libraries | |
5198 | from the issues related to the module system. | |
5199 | ||
5200 | *** New function: load-extension | |
5201 | ||
5202 | Executing (load-extension lib init) is mostly equivalent to | |
5203 | ||
5204 | (dynamic-call init (dynamic-link lib)) | |
5205 | ||
5206 | except when scm_register_extension has been called previously. | |
5207 | Whenever appropriate, you should use `load-extension' instead of | |
5208 | dynamic-link and dynamic-call. | |
5209 | ||
5210 | *** New C function: scm_c_register_extension | |
5211 | ||
5212 | This function registers a initialization function for use by | |
5213 | `load-extension'. Use it when you don't want specific extensions to | |
5214 | be loaded as shared libraries (for example on platforms that don't | |
5215 | support dynamic linking). | |
5216 | ||
8c2c9967 MV |
5217 | ** Auto-loading of compiled-code modules is deprecated. |
5218 | ||
5219 | Guile used to be able to automatically find and link a shared | |
c10ecc4c | 5220 | library to satisfy requests for a module. For example, the module |
8c2c9967 MV |
5221 | `(foo bar)' could be implemented by placing a shared library named |
5222 | "foo/libbar.so" (or with a different extension) in a directory on the | |
5223 | load path of Guile. | |
5224 | ||
311b6a3c MV |
5225 | This has been found to be too tricky, and is no longer supported. The |
5226 | shared libraries are now called "extensions". You should now write a | |
5227 | small Scheme file that calls `load-extension' to load the shared | |
e299cee2 | 5228 | library and initialize it explicitly. |
8c2c9967 MV |
5229 | |
5230 | The shared libraries themselves should be installed in the usual | |
5231 | places for shared libraries, with names like "libguile-foo-bar". | |
5232 | ||
5233 | For example, place this into a file "foo/bar.scm" | |
5234 | ||
5235 | (define-module (foo bar)) | |
5236 | ||
311b6a3c MV |
5237 | (load-extension "libguile-foo-bar" "foobar_init") |
5238 | ||
5239 | ** Backward incompatible change: eval EXP ENVIRONMENT-SPECIFIER | |
5240 | ||
5241 | `eval' is now R5RS, that is it takes two arguments. | |
5242 | The second argument is an environment specifier, i.e. either | |
5243 | ||
5244 | (scheme-report-environment 5) | |
5245 | (null-environment 5) | |
5246 | (interaction-environment) | |
5247 | ||
5248 | or | |
8c2c9967 | 5249 | |
311b6a3c | 5250 | any module. |
8c2c9967 | 5251 | |
6f76852b MV |
5252 | ** The module system has been made more disciplined. |
5253 | ||
311b6a3c MV |
5254 | The function `eval' will save and restore the current module around |
5255 | the evaluation of the specified expression. While this expression is | |
5256 | evaluated, `(current-module)' will now return the right module, which | |
5257 | is the module specified as the second argument to `eval'. | |
6f76852b | 5258 | |
311b6a3c | 5259 | A consequence of this change is that `eval' is not particularly |
6f76852b MV |
5260 | useful when you want allow the evaluated code to change what module is |
5261 | designated as the current module and have this change persist from one | |
5262 | call to `eval' to the next. The read-eval-print-loop is an example | |
5263 | where `eval' is now inadequate. To compensate, there is a new | |
5264 | function `primitive-eval' that does not take a module specifier and | |
5265 | that does not save/restore the current module. You should use this | |
5266 | function together with `set-current-module', `current-module', etc | |
5267 | when you want to have more control over the state that is carried from | |
5268 | one eval to the next. | |
5269 | ||
5270 | Additionally, it has been made sure that forms that are evaluated at | |
5271 | the top level are always evaluated with respect to the current module. | |
5272 | Previously, subforms of top-level forms such as `begin', `case', | |
5273 | etc. did not respect changes to the current module although these | |
5274 | subforms are at the top-level as well. | |
5275 | ||
311b6a3c | 5276 | To prevent strange behavior, the forms `define-module', |
6f76852b MV |
5277 | `use-modules', `use-syntax', and `export' have been restricted to only |
5278 | work on the top level. The forms `define-public' and | |
5279 | `defmacro-public' only export the new binding on the top level. They | |
5280 | behave just like `define' and `defmacro', respectively, when they are | |
5281 | used in a lexical environment. | |
5282 | ||
0a892a2c MV |
5283 | Also, `export' will no longer silently re-export bindings imported |
5284 | from a used module. It will emit a `deprecation' warning and will | |
5285 | cease to perform any re-export in the next version. If you actually | |
5286 | want to re-export bindings, use the new `re-export' in place of | |
5287 | `export'. The new `re-export' will not make copies of variables when | |
5288 | rexporting them, as `export' did wrongly. | |
5289 | ||
047dc3ae TTN |
5290 | ** Module system now allows selection and renaming of imported bindings |
5291 | ||
5292 | Previously, when using `use-modules' or the `#:use-module' clause in | |
5293 | the `define-module' form, all the bindings (association of symbols to | |
5294 | values) for imported modules were added to the "current module" on an | |
5295 | as-is basis. This has been changed to allow finer control through two | |
5296 | new facilities: selection and renaming. | |
5297 | ||
5298 | You can now select which of the imported module's bindings are to be | |
5299 | visible in the current module by using the `:select' clause. This | |
5300 | clause also can be used to rename individual bindings. For example: | |
5301 | ||
5302 | ;; import all bindings no questions asked | |
5303 | (use-modules (ice-9 common-list)) | |
5304 | ||
5305 | ;; import four bindings, renaming two of them; | |
5306 | ;; the current module sees: every some zonk-y zonk-n | |
5307 | (use-modules ((ice-9 common-list) | |
5308 | :select (every some | |
5309 | (remove-if . zonk-y) | |
5310 | (remove-if-not . zonk-n)))) | |
5311 | ||
5312 | You can also programmatically rename all selected bindings using the | |
5313 | `:renamer' clause, which specifies a proc that takes a symbol and | |
5314 | returns another symbol. Because it is common practice to use a prefix, | |
5315 | we now provide the convenience procedure `symbol-prefix-proc'. For | |
5316 | example: | |
5317 | ||
5318 | ;; import four bindings, renaming two of them specifically, | |
5319 | ;; and all four w/ prefix "CL:"; | |
5320 | ;; the current module sees: CL:every CL:some CL:zonk-y CL:zonk-n | |
5321 | (use-modules ((ice-9 common-list) | |
5322 | :select (every some | |
5323 | (remove-if . zonk-y) | |
5324 | (remove-if-not . zonk-n)) | |
5325 | :renamer (symbol-prefix-proc 'CL:))) | |
5326 | ||
5327 | ;; import four bindings, renaming two of them specifically, | |
5328 | ;; and all four by upcasing. | |
5329 | ;; the current module sees: EVERY SOME ZONK-Y ZONK-N | |
5330 | (define (upcase-symbol sym) | |
5331 | (string->symbol (string-upcase (symbol->string sym)))) | |
5332 | ||
5333 | (use-modules ((ice-9 common-list) | |
5334 | :select (every some | |
5335 | (remove-if . zonk-y) | |
5336 | (remove-if-not . zonk-n)) | |
5337 | :renamer upcase-symbol)) | |
5338 | ||
5339 | Note that programmatic renaming is done *after* individual renaming. | |
5340 | Also, the above examples show `use-modules', but the same facilities are | |
5341 | available for the `#:use-module' clause of `define-module'. | |
5342 | ||
5343 | See manual for more info. | |
5344 | ||
b7d69200 | 5345 | ** The semantics of guardians have changed. |
56495472 | 5346 | |
b7d69200 | 5347 | The changes are for the most part compatible. An important criterion |
6c0201ad | 5348 | was to keep the typical usage of guardians as simple as before, but to |
c0a5d888 | 5349 | make the semantics safer and (as a result) more useful. |
56495472 | 5350 | |
c0a5d888 | 5351 | *** All objects returned from guardians are now properly alive. |
56495472 | 5352 | |
c0a5d888 ML |
5353 | It is now guaranteed that any object referenced by an object returned |
5354 | from a guardian is alive. It's now impossible for a guardian to | |
5355 | return a "contained" object before its "containing" object. | |
56495472 ML |
5356 | |
5357 | One incompatible (but probably not very important) change resulting | |
5358 | from this is that it is no longer possible to guard objects that | |
5359 | indirectly reference themselves (i.e. are parts of cycles). If you do | |
5360 | so accidentally, you'll get a warning. | |
5361 | ||
c0a5d888 ML |
5362 | *** There are now two types of guardians: greedy and sharing. |
5363 | ||
5364 | If you call (make-guardian #t) or just (make-guardian), you'll get a | |
5365 | greedy guardian, and for (make-guardian #f) a sharing guardian. | |
5366 | ||
5367 | Greedy guardians are the default because they are more "defensive". | |
5368 | You can only greedily guard an object once. If you guard an object | |
5369 | more than once, once in a greedy guardian and the rest of times in | |
5370 | sharing guardians, then it is guaranteed that the object won't be | |
5371 | returned from sharing guardians as long as it is greedily guarded | |
5372 | and/or alive. | |
5373 | ||
5374 | Guardians returned by calls to `make-guardian' can now take one more | |
5375 | optional parameter, which says whether to throw an error in case an | |
5376 | attempt is made to greedily guard an object that is already greedily | |
5377 | guarded. The default is true, i.e. throw an error. If the parameter | |
5378 | is false, the guardian invocation returns #t if guarding was | |
5379 | successful and #f if it wasn't. | |
5380 | ||
5381 | Also, since greedy guarding is, in effect, a side-effecting operation | |
5382 | on objects, a new function is introduced: `destroy-guardian!'. | |
5383 | Invoking this function on a guardian renders it unoperative and, if | |
5384 | the guardian is greedy, clears the "greedily guarded" property of the | |
5385 | objects that were guarded by it, thus undoing the side effect. | |
5386 | ||
5387 | Note that all this hair is hardly very important, since guardian | |
5388 | objects are usually permanent. | |
5389 | ||
311b6a3c MV |
5390 | ** Continuations created by call-with-current-continuation now accept |
5391 | any number of arguments, as required by R5RS. | |
818febc0 | 5392 | |
c10ecc4c | 5393 | ** New function `issue-deprecation-warning' |
56426fdb | 5394 | |
311b6a3c | 5395 | This function is used to display the deprecation messages that are |
c10ecc4c | 5396 | controlled by GUILE_WARN_DEPRECATION as explained in the README. |
56426fdb KN |
5397 | |
5398 | (define (id x) | |
c10ecc4c MV |
5399 | (issue-deprecation-warning "`id' is deprecated. Use `identity' instead.") |
5400 | (identity x)) | |
56426fdb KN |
5401 | |
5402 | guile> (id 1) | |
5403 | ;; `id' is deprecated. Use `identity' instead. | |
5404 | 1 | |
5405 | guile> (id 1) | |
5406 | 1 | |
5407 | ||
c10ecc4c MV |
5408 | ** New syntax `begin-deprecated' |
5409 | ||
5410 | When deprecated features are included (as determined by the configure | |
5411 | option --enable-deprecated), `begin-deprecated' is identical to | |
5412 | `begin'. When deprecated features are excluded, it always evaluates | |
5413 | to `#f', ignoring the body forms. | |
5414 | ||
17f367e0 MV |
5415 | ** New function `make-object-property' |
5416 | ||
5417 | This function returns a new `procedure with setter' P that can be used | |
5418 | to attach a property to objects. When calling P as | |
5419 | ||
5420 | (set! (P obj) val) | |
5421 | ||
5422 | where `obj' is any kind of object, it attaches `val' to `obj' in such | |
5423 | a way that it can be retrieved by calling P as | |
5424 | ||
5425 | (P obj) | |
5426 | ||
5427 | This function will replace procedure properties, symbol properties and | |
5428 | source properties eventually. | |
5429 | ||
76ef92f3 MV |
5430 | ** Module (ice-9 optargs) now uses keywords instead of `#&'. |
5431 | ||
5432 | Instead of #&optional, #&key, etc you should now use #:optional, | |
5433 | #:key, etc. Since #:optional is a keyword, you can write it as just | |
5434 | :optional when (read-set! keywords 'prefix) is active. | |
5435 | ||
5436 | The old reader syntax `#&' is still supported, but deprecated. It | |
5437 | will be removed in the next release. | |
5438 | ||
c0997079 MD |
5439 | ** New define-module option: pure |
5440 | ||
5441 | Tells the module system not to include any bindings from the root | |
5442 | module. | |
5443 | ||
5444 | Example: | |
5445 | ||
5446 | (define-module (totally-empty-module) | |
5447 | :pure) | |
5448 | ||
5449 | ** New define-module option: export NAME1 ... | |
5450 | ||
5451 | Export names NAME1 ... | |
5452 | ||
5453 | This option is required if you want to be able to export bindings from | |
5454 | a module which doesn't import one of `define-public' or `export'. | |
5455 | ||
5456 | Example: | |
5457 | ||
311b6a3c MV |
5458 | (define-module (foo) |
5459 | :pure | |
5460 | :use-module (ice-9 r5rs) | |
5461 | :export (bar)) | |
69b5f65a | 5462 | |
311b6a3c | 5463 | ;;; Note that we're pure R5RS below this point! |
69b5f65a | 5464 | |
311b6a3c MV |
5465 | (define (bar) |
5466 | ...) | |
daa6ba18 | 5467 | |
1f3908c4 KN |
5468 | ** New function: object->string OBJ |
5469 | ||
5470 | Return a Scheme string obtained by printing a given object. | |
5471 | ||
eb5c0a2a GH |
5472 | ** New function: port? X |
5473 | ||
5474 | Returns a boolean indicating whether X is a port. Equivalent to | |
5475 | `(or (input-port? X) (output-port? X))'. | |
5476 | ||
efa40607 DH |
5477 | ** New function: file-port? |
5478 | ||
5479 | Determines whether a given object is a port that is related to a file. | |
5480 | ||
34b56ec4 GH |
5481 | ** New function: port-for-each proc |
5482 | ||
311b6a3c MV |
5483 | Apply PROC to each port in the Guile port table in turn. The return |
5484 | value is unspecified. More specifically, PROC is applied exactly once | |
5485 | to every port that exists in the system at the time PORT-FOR-EACH is | |
5486 | invoked. Changes to the port table while PORT-FOR-EACH is running | |
5487 | have no effect as far as PORT-FOR-EACH is concerned. | |
34b56ec4 GH |
5488 | |
5489 | ** New function: dup2 oldfd newfd | |
5490 | ||
5491 | A simple wrapper for the `dup2' system call. Copies the file | |
5492 | descriptor OLDFD to descriptor number NEWFD, replacing the | |
5493 | previous meaning of NEWFD. Both OLDFD and NEWFD must be integers. | |
5494 | Unlike for dup->fdes or primitive-move->fdes, no attempt is made | |
264e9cbc | 5495 | to move away ports which are using NEWFD. The return value is |
34b56ec4 GH |
5496 | unspecified. |
5497 | ||
5498 | ** New function: close-fdes fd | |
5499 | ||
5500 | A simple wrapper for the `close' system call. Close file | |
5501 | descriptor FD, which must be an integer. Unlike close (*note | |
5502 | close: Ports and File Descriptors.), the file descriptor will be | |
5503 | closed even if a port is using it. The return value is | |
5504 | unspecified. | |
5505 | ||
94e6d793 MG |
5506 | ** New function: crypt password salt |
5507 | ||
5508 | Encrypts `password' using the standard unix password encryption | |
5509 | algorithm. | |
5510 | ||
5511 | ** New function: chroot path | |
5512 | ||
5513 | Change the root directory of the running process to `path'. | |
5514 | ||
5515 | ** New functions: getlogin, cuserid | |
5516 | ||
5517 | Return the login name or the user name of the current effective user | |
5518 | id, respectively. | |
5519 | ||
5520 | ** New functions: getpriority which who, setpriority which who prio | |
5521 | ||
5522 | Get or set the priority of the running process. | |
5523 | ||
5524 | ** New function: getpass prompt | |
5525 | ||
5526 | Read a password from the terminal, first displaying `prompt' and | |
5527 | disabling echoing. | |
5528 | ||
5529 | ** New function: flock file operation | |
5530 | ||
5531 | Set/remove an advisory shared or exclusive lock on `file'. | |
5532 | ||
5533 | ** New functions: sethostname name, gethostname | |
5534 | ||
5535 | Set or get the hostname of the machine the current process is running | |
5536 | on. | |
5537 | ||
6d163216 | 5538 | ** New function: mkstemp! tmpl |
4f60cc33 | 5539 | |
6d163216 GH |
5540 | mkstemp creates a new unique file in the file system and returns a |
5541 | new buffered port open for reading and writing to the file. TMPL | |
5542 | is a string specifying where the file should be created: it must | |
5543 | end with `XXXXXX' and will be changed in place to return the name | |
5544 | of the temporary file. | |
5545 | ||
62e63ba9 MG |
5546 | ** New function: open-input-string string |
5547 | ||
5548 | Return an input string port which delivers the characters from | |
4f60cc33 | 5549 | `string'. This procedure, together with `open-output-string' and |
62e63ba9 MG |
5550 | `get-output-string' implements SRFI-6. |
5551 | ||
5552 | ** New function: open-output-string | |
5553 | ||
5554 | Return an output string port which collects all data written to it. | |
5555 | The data can then be retrieved by `get-output-string'. | |
5556 | ||
5557 | ** New function: get-output-string | |
5558 | ||
5559 | Return the contents of an output string port. | |
5560 | ||
56426fdb KN |
5561 | ** New function: identity |
5562 | ||
5563 | Return the argument. | |
5564 | ||
5bef627d GH |
5565 | ** socket, connect, accept etc., now have support for IPv6. IPv6 addresses |
5566 | are represented in Scheme as integers with normal host byte ordering. | |
5567 | ||
5568 | ** New function: inet-pton family address | |
5569 | ||
311b6a3c MV |
5570 | Convert a printable string network address into an integer. Note that |
5571 | unlike the C version of this function, the result is an integer with | |
5572 | normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'. | |
5573 | e.g., | |
5574 | ||
5575 | (inet-pton AF_INET "127.0.0.1") => 2130706433 | |
5576 | (inet-pton AF_INET6 "::1") => 1 | |
5bef627d GH |
5577 | |
5578 | ** New function: inet-ntop family address | |
5579 | ||
311b6a3c MV |
5580 | Convert an integer network address into a printable string. Note that |
5581 | unlike the C version of this function, the input is an integer with | |
5582 | normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'. | |
5583 | e.g., | |
5584 | ||
5585 | (inet-ntop AF_INET 2130706433) => "127.0.0.1" | |
5586 | (inet-ntop AF_INET6 (- (expt 2 128) 1)) => | |
5bef627d GH |
5587 | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff |
5588 | ||
56426fdb KN |
5589 | ** Deprecated: id |
5590 | ||
5591 | Use `identity' instead. | |
5592 | ||
5cd06d5e DH |
5593 | ** Deprecated: -1+ |
5594 | ||
5595 | Use `1-' instead. | |
5596 | ||
5597 | ** Deprecated: return-it | |
5598 | ||
311b6a3c | 5599 | Do without it. |
5cd06d5e DH |
5600 | |
5601 | ** Deprecated: string-character-length | |
5602 | ||
5603 | Use `string-length' instead. | |
5604 | ||
5605 | ** Deprecated: flags | |
5606 | ||
5607 | Use `logior' instead. | |
5608 | ||
4f60cc33 NJ |
5609 | ** Deprecated: close-all-ports-except. |
5610 | ||
5611 | This was intended for closing ports in a child process after a fork, | |
5612 | but it has the undesirable side effect of flushing buffers. | |
5613 | port-for-each is more flexible. | |
34b56ec4 GH |
5614 | |
5615 | ** The (ice-9 popen) module now attempts to set up file descriptors in | |
5616 | the child process from the current Scheme ports, instead of using the | |
5617 | current values of file descriptors 0, 1, and 2 in the parent process. | |
5618 | ||
b52e071b DH |
5619 | ** Removed function: builtin-weak-bindings |
5620 | ||
5621 | There is no such concept as a weak binding any more. | |
5622 | ||
9d774814 | 5623 | ** Removed constants: bignum-radix, scm-line-incrementors |
0f979f3f | 5624 | |
7d435120 MD |
5625 | ** define-method: New syntax mandatory. |
5626 | ||
5627 | The new method syntax is now mandatory: | |
5628 | ||
5629 | (define-method (NAME ARG-SPEC ...) BODY ...) | |
5630 | (define-method (NAME ARG-SPEC ... . REST-ARG) BODY ...) | |
5631 | ||
5632 | ARG-SPEC ::= ARG-NAME | (ARG-NAME TYPE) | |
5633 | REST-ARG ::= ARG-NAME | |
5634 | ||
5635 | If you have old code using the old syntax, import | |
5636 | (oop goops old-define-method) before (oop goops) as in: | |
5637 | ||
5638 | (use-modules (oop goops old-define-method) (oop goops)) | |
5639 | ||
f3f9dcbc MV |
5640 | ** Deprecated function: builtin-variable |
5641 | Removed function: builtin-bindings | |
5642 | ||
5643 | There is no longer a distinction between builtin or other variables. | |
5644 | Use module system operations for all variables. | |
5645 | ||
311b6a3c MV |
5646 | ** Lazy-catch handlers are no longer allowed to return. |
5647 | ||
5648 | That is, a call to `throw', `error', etc is now guaranteed to not | |
5649 | return. | |
5650 | ||
a583bf1e | 5651 | ** Bugfixes for (ice-9 getopt-long) |
8c84b81e | 5652 | |
a583bf1e TTN |
5653 | This module is now tested using test-suite/tests/getopt-long.test. |
5654 | The following bugs have been fixed: | |
5655 | ||
5656 | *** Parsing for options that are specified to have `optional' args now checks | |
5657 | if the next element is an option instead of unconditionally taking it as the | |
8c84b81e TTN |
5658 | option arg. |
5659 | ||
a583bf1e TTN |
5660 | *** An error is now thrown for `--opt=val' when the option description |
5661 | does not specify `(value #t)' or `(value optional)'. This condition used to | |
5662 | be accepted w/o error, contrary to the documentation. | |
5663 | ||
5664 | *** The error message for unrecognized options is now more informative. | |
5665 | It used to be "not a record", an artifact of the implementation. | |
5666 | ||
5667 | *** The error message for `--opt' terminating the arg list (no value), when | |
5668 | `(value #t)' is specified, is now more informative. It used to be "not enough | |
5669 | args". | |
5670 | ||
5671 | *** "Clumped" single-char args now preserve trailing string, use it as arg. | |
5672 | The expansion used to be like so: | |
5673 | ||
5674 | ("-abc5d" "--xyz") => ("-a" "-b" "-c" "--xyz") | |
5675 | ||
5676 | Note that the "5d" is dropped. Now it is like so: | |
5677 | ||
5678 | ("-abc5d" "--xyz") => ("-a" "-b" "-c" "5d" "--xyz") | |
5679 | ||
5680 | This enables single-char options to have adjoining arguments as long as their | |
5681 | constituent characters are not potential single-char options. | |
8c84b81e | 5682 | |
998bfc70 TTN |
5683 | ** (ice-9 session) procedure `arity' now works with (ice-9 optargs) `lambda*' |
5684 | ||
5685 | The `lambda*' and derivative forms in (ice-9 optargs) now set a procedure | |
5686 | property `arglist', which can be retrieved by `arity'. The result is that | |
5687 | `arity' can give more detailed information than before: | |
5688 | ||
5689 | Before: | |
5690 | ||
5691 | guile> (use-modules (ice-9 optargs)) | |
5692 | guile> (define* (foo #:optional a b c) a) | |
5693 | guile> (arity foo) | |
5694 | 0 or more arguments in `lambda*:G0'. | |
5695 | ||
5696 | After: | |
5697 | ||
5698 | guile> (arity foo) | |
5699 | 3 optional arguments: `a', `b' and `c'. | |
5700 | guile> (define* (bar a b #:key c d #:allow-other-keys) a) | |
5701 | guile> (arity bar) | |
5702 | 2 required arguments: `a' and `b', 2 keyword arguments: `c' | |
5703 | and `d', other keywords allowed. | |
5704 | guile> (define* (baz a b #:optional c #:rest r) a) | |
5705 | guile> (arity baz) | |
5706 | 2 required arguments: `a' and `b', 1 optional argument: `c', | |
5707 | the rest in `r'. | |
5708 | ||
311b6a3c MV |
5709 | * Changes to the C interface |
5710 | ||
c81c130e MV |
5711 | ** Types have been renamed from scm_*_t to scm_t_*. |
5712 | ||
5713 | This has been done for POSIX sake. It reserves identifiers ending | |
5714 | with "_t". What a concept. | |
5715 | ||
5716 | The old names are still available with status `deprecated'. | |
5717 | ||
5718 | ** scm_t_bits (former scm_bits_t) is now a unsigned type. | |
5719 | ||
6e9382f1 | 5720 | ** Deprecated features have been removed. |
e6c9e497 MV |
5721 | |
5722 | *** Macros removed | |
5723 | ||
5724 | SCM_INPORTP, SCM_OUTPORTP SCM_ICHRP, SCM_ICHR, SCM_MAKICHR | |
5725 | SCM_SETJMPBUF SCM_NSTRINGP SCM_NRWSTRINGP SCM_NVECTORP SCM_DOUBLE_CELLP | |
5726 | ||
5727 | *** C Functions removed | |
5728 | ||
5729 | scm_sysmissing scm_tag scm_tc16_flo scm_tc_flo | |
5730 | scm_fseek - replaced by scm_seek. | |
5731 | gc-thunk - replaced by after-gc-hook. | |
5732 | gh_int2scmb - replaced by gh_bool2scm. | |
5733 | scm_tc_dblr - replaced by scm_tc16_real. | |
5734 | scm_tc_dblc - replaced by scm_tc16_complex. | |
5735 | scm_list_star - replaced by scm_cons_star. | |
5736 | ||
36284627 DH |
5737 | ** Deprecated: scm_makfromstr |
5738 | ||
5739 | Use scm_mem2string instead. | |
5740 | ||
311b6a3c MV |
5741 | ** Deprecated: scm_make_shared_substring |
5742 | ||
5743 | Explicit shared substrings will disappear from Guile. | |
5744 | ||
5745 | Instead, "normal" strings will be implemented using sharing | |
5746 | internally, combined with a copy-on-write strategy. | |
5747 | ||
5748 | ** Deprecated: scm_read_only_string_p | |
5749 | ||
5750 | The concept of read-only strings will disappear in next release of | |
5751 | Guile. | |
5752 | ||
5753 | ** Deprecated: scm_sloppy_memq, scm_sloppy_memv, scm_sloppy_member | |
c299f186 | 5754 | |
311b6a3c | 5755 | Instead, use scm_c_memq or scm_memq, scm_memv, scm_member. |
c299f186 | 5756 | |
dd0e04ed KN |
5757 | ** New functions: scm_call_0, scm_call_1, scm_call_2, scm_call_3 |
5758 | ||
83dbedcc KR |
5759 | Call a procedure with the indicated number of arguments. See "Fly |
5760 | Evaluation" in the manual. | |
dd0e04ed KN |
5761 | |
5762 | ** New functions: scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3 | |
5763 | ||
83dbedcc KR |
5764 | Call a procedure with the indicated number of arguments and a list of |
5765 | further arguments. See "Fly Evaluation" in the manual. | |
dd0e04ed | 5766 | |
e235f2a6 KN |
5767 | ** New functions: scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5 |
5768 | ||
83dbedcc KR |
5769 | Create a list of the given number of elements. See "List |
5770 | Constructors" in the manual. | |
e235f2a6 KN |
5771 | |
5772 | ** Renamed function: scm_listify has been replaced by scm_list_n. | |
5773 | ||
5774 | ** Deprecated macros: SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, | |
5775 | SCM_LIST5, SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9. | |
5776 | ||
5777 | Use functions scm_list_N instead. | |
5778 | ||
6fe692e9 MD |
5779 | ** New function: scm_c_read (SCM port, void *buffer, scm_sizet size) |
5780 | ||
5781 | Used by an application to read arbitrary number of bytes from a port. | |
5782 | Same semantics as libc read, except that scm_c_read only returns less | |
5783 | than SIZE bytes if at end-of-file. | |
5784 | ||
5785 | Warning: Doesn't update port line and column counts! | |
5786 | ||
5787 | ** New function: scm_c_write (SCM port, const void *ptr, scm_sizet size) | |
5788 | ||
5789 | Used by an application to write arbitrary number of bytes to an SCM | |
5790 | port. Similar semantics as libc write. However, unlike libc | |
5791 | write, scm_c_write writes the requested number of bytes and has no | |
5792 | return value. | |
5793 | ||
5794 | Warning: Doesn't update port line and column counts! | |
5795 | ||
17f367e0 MV |
5796 | ** New function: scm_init_guile () |
5797 | ||
5798 | In contrast to scm_boot_guile, scm_init_guile will return normally | |
5799 | after initializing Guile. It is not available on all systems, tho. | |
5800 | ||
23ade5e7 DH |
5801 | ** New functions: scm_str2symbol, scm_mem2symbol |
5802 | ||
5803 | The function scm_str2symbol takes a const char* pointing to a zero-terminated | |
5804 | field of characters and creates a scheme symbol object from that C string. | |
5805 | The function scm_mem2symbol takes a const char* and a number of characters and | |
5806 | creates a symbol from the characters in that memory area. | |
5807 | ||
17f367e0 MV |
5808 | ** New functions: scm_primitive_make_property |
5809 | scm_primitive_property_ref | |
5810 | scm_primitive_property_set_x | |
5811 | scm_primitive_property_del_x | |
5812 | ||
5813 | These functions implement a new way to deal with object properties. | |
5814 | See libguile/properties.c for their documentation. | |
5815 | ||
9d47a1e6 ML |
5816 | ** New function: scm_done_free (long size) |
5817 | ||
5818 | This function is the inverse of scm_done_malloc. Use it to report the | |
5819 | amount of smob memory you free. The previous method, which involved | |
5820 | calling scm_done_malloc with negative argument, was somewhat | |
5821 | unintuitive (and is still available, of course). | |
5822 | ||
79a3dafe DH |
5823 | ** New function: scm_c_memq (SCM obj, SCM list) |
5824 | ||
5825 | This function provides a fast C level alternative for scm_memq for the case | |
5826 | that the list parameter is known to be a proper list. The function is a | |
5827 | replacement for scm_sloppy_memq, but is stricter in its requirements on its | |
5828 | list input parameter, since for anything else but a proper list the function's | |
5829 | behaviour is undefined - it may even crash or loop endlessly. Further, for | |
5830 | the case that the object is not found in the list, scm_c_memq returns #f which | |
5831 | is similar to scm_memq, but different from scm_sloppy_memq's behaviour. | |
5832 | ||
6c0201ad | 5833 | ** New functions: scm_remember_upto_here_1, scm_remember_upto_here_2, |
5d2b97cd DH |
5834 | scm_remember_upto_here |
5835 | ||
5836 | These functions replace the function scm_remember. | |
5837 | ||
5838 | ** Deprecated function: scm_remember | |
5839 | ||
5840 | Use one of the new functions scm_remember_upto_here_1, | |
5841 | scm_remember_upto_here_2 or scm_remember_upto_here instead. | |
5842 | ||
be54b15d DH |
5843 | ** New function: scm_allocate_string |
5844 | ||
5845 | This function replaces the function scm_makstr. | |
5846 | ||
5847 | ** Deprecated function: scm_makstr | |
5848 | ||
5849 | Use the new function scm_allocate_string instead. | |
5850 | ||
32d0d4b1 DH |
5851 | ** New global variable scm_gc_running_p introduced. |
5852 | ||
5853 | Use this variable to find out if garbage collection is being executed. Up to | |
5854 | now applications have used scm_gc_heap_lock to test if garbage collection was | |
5855 | running, which also works because of the fact that up to know only the garbage | |
5856 | collector has set this variable. But, this is an implementation detail that | |
5857 | may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use | |
5858 | of this variable is (and has been) not fully safe anyway. | |
5859 | ||
5b9eb8ae DH |
5860 | ** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH |
5861 | ||
5862 | Use these instead of SCM_LENGTH_MAX. | |
5863 | ||
6c0201ad | 5864 | ** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH, |
a6d9e5ab DH |
5865 | SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH, |
5866 | SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH. | |
5867 | ||
5868 | Use these instead of SCM_LENGTH. | |
5869 | ||
6c0201ad | 5870 | ** New macros: SCM_SET_CONTINUATION_LENGTH, SCM_SET_STRING_LENGTH, |
93778877 DH |
5871 | SCM_SET_SYMBOL_LENGTH, SCM_SET_VECTOR_LENGTH, SCM_SET_UVECTOR_LENGTH, |
5872 | SCM_SET_BITVECTOR_LENGTH | |
bc0eaf7b DH |
5873 | |
5874 | Use these instead of SCM_SETLENGTH | |
5875 | ||
6c0201ad | 5876 | ** New macros: SCM_STRING_CHARS, SCM_SYMBOL_CHARS, SCM_CCLO_BASE, |
a6d9e5ab DH |
5877 | SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM, |
5878 | SCM_ARRAY_MEM | |
5879 | ||
e51fe79c DH |
5880 | Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or |
5881 | SCM_VELTS. | |
a6d9e5ab | 5882 | |
6c0201ad | 5883 | ** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS, |
6a0476fd DH |
5884 | SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE, |
5885 | SCM_SET_VECTOR_BASE | |
5886 | ||
5887 | Use these instead of SCM_SETCHARS. | |
5888 | ||
a6d9e5ab DH |
5889 | ** New macro: SCM_BITVECTOR_P |
5890 | ||
5891 | ** New macro: SCM_STRING_COERCE_0TERMINATION_X | |
5892 | ||
5893 | Use instead of SCM_COERCE_SUBSTR. | |
5894 | ||
30ea841d DH |
5895 | ** New macros: SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN |
5896 | ||
5897 | For directory objects, use these instead of SCM_OPDIRP and SCM_OPN. | |
5898 | ||
6c0201ad TTN |
5899 | ** Deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL, |
5900 | SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, | |
5901 | SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, | |
d1ca2c64 | 5902 | SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SYMBOL_SLOTS, SCM_SLOTS, SCM_SLOPPY_STRINGP, |
a6d9e5ab DH |
5903 | SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS, |
5904 | SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY, | |
5905 | SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH, | |
b24b5e13 | 5906 | SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR, |
34f0f2b8 | 5907 | SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS, |
fd336365 | 5908 | SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP, |
30ea841d | 5909 | SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC, |
b3fcac34 DH |
5910 | SCM_OPDIRP, SCM_VALIDATE_OPDIR, SCM_WTA, RETURN_SCM_WTA, SCM_CONST_LONG, |
5911 | SCM_WNA, SCM_FUNC_NAME, SCM_VALIDATE_NUMBER_COPY, | |
61045190 | 5912 | SCM_VALIDATE_NUMBER_DEF_COPY, SCM_SLOPPY_CONSP, SCM_SLOPPY_NCONSP, |
e038c042 | 5913 | SCM_SETAND_CDR, SCM_SETOR_CDR, SCM_SETAND_CAR, SCM_SETOR_CAR |
b63a956d DH |
5914 | |
5915 | Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE. | |
5916 | Use scm_memory_error instead of SCM_NALLOC. | |
c1aef037 | 5917 | Use SCM_STRINGP instead of SCM_SLOPPY_STRINGP. |
d1ca2c64 DH |
5918 | Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_STRINGORSUBSTR. |
5919 | Use SCM_FREE_CELL_P instead of SCM_FREEP/SCM_NFREEP | |
a6d9e5ab | 5920 | Use a type specific accessor macro instead of SCM_CHARS/SCM_UCHARS. |
6c0201ad | 5921 | Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH. |
a6d9e5ab DH |
5922 | Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING. |
5923 | Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR. | |
b24b5e13 | 5924 | Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP. |
f0942910 DH |
5925 | Use SCM_STRINGP instead of SCM_RWSTRINGP. |
5926 | Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING. | |
34f0f2b8 DH |
5927 | Use SCM_STRING_CHARS instead of SCM_ROCHARS. |
5928 | Use SCM_STRING_UCHARS instead of SCM_ROUCHARS. | |
93778877 | 5929 | Use a type specific setter macro instead of SCM_SETLENGTH. |
6a0476fd | 5930 | Use a type specific setter macro instead of SCM_SETCHARS. |
5b9eb8ae | 5931 | Use a type specific length macro instead of SCM_LENGTH_MAX. |
fd336365 DH |
5932 | Use SCM_GCMARKP instead of SCM_GC8MARKP. |
5933 | Use SCM_SETGCMARK instead of SCM_SETGC8MARK. | |
5934 | Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK. | |
5935 | Use SCM_TYP16 instead of SCM_GCTYP16. | |
5936 | Use SCM_CDR instead of SCM_GCCDR. | |
30ea841d | 5937 | Use SCM_DIR_OPEN_P instead of SCM_OPDIRP. |
276dd677 DH |
5938 | Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of SCM_WTA. |
5939 | Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of RETURN_SCM_WTA. | |
8dea8611 | 5940 | Use SCM_VCELL_INIT instead of SCM_CONST_LONG. |
b3fcac34 | 5941 | Use SCM_WRONG_NUM_ARGS instead of SCM_WNA. |
ced99e92 DH |
5942 | Use SCM_CONSP instead of SCM_SLOPPY_CONSP. |
5943 | Use !SCM_CONSP instead of SCM_SLOPPY_NCONSP. | |
b63a956d | 5944 | |
f7620510 DH |
5945 | ** Removed function: scm_struct_init |
5946 | ||
93d40df2 DH |
5947 | ** Removed variable: scm_symhash_dim |
5948 | ||
818febc0 GH |
5949 | ** Renamed function: scm_make_cont has been replaced by |
5950 | scm_make_continuation, which has a different interface. | |
5951 | ||
cc4feeca DH |
5952 | ** Deprecated function: scm_call_catching_errors |
5953 | ||
5954 | Use scm_catch or scm_lazy_catch from throw.[ch] instead. | |
5955 | ||
28b06554 DH |
5956 | ** Deprecated function: scm_strhash |
5957 | ||
5958 | Use scm_string_hash instead. | |
5959 | ||
1b9be268 DH |
5960 | ** Deprecated function: scm_vector_set_length_x |
5961 | ||
5962 | Instead, create a fresh vector of the desired size and copy the contents. | |
5963 | ||
302f229e MD |
5964 | ** scm_gensym has changed prototype |
5965 | ||
5966 | scm_gensym now only takes one argument. | |
5967 | ||
1660782e DH |
5968 | ** Deprecated type tags: scm_tc7_ssymbol, scm_tc7_msymbol, scm_tcs_symbols, |
5969 | scm_tc7_lvector | |
28b06554 DH |
5970 | |
5971 | There is now only a single symbol type scm_tc7_symbol. | |
1660782e | 5972 | The tag scm_tc7_lvector was not used anyway. |
28b06554 | 5973 | |
2f6fb7c5 KN |
5974 | ** Deprecated function: scm_make_smob_type_mfpe, scm_set_smob_mfpe. |
5975 | ||
5976 | Use scm_make_smob_type and scm_set_smob_XXX instead. | |
5977 | ||
5978 | ** New function scm_set_smob_apply. | |
5979 | ||
5980 | This can be used to set an apply function to a smob type. | |
5981 | ||
1f3908c4 KN |
5982 | ** Deprecated function: scm_strprint_obj |
5983 | ||
5984 | Use scm_object_to_string instead. | |
5985 | ||
b3fcac34 DH |
5986 | ** Deprecated function: scm_wta |
5987 | ||
5988 | Use scm_wrong_type_arg, or another appropriate error signalling function | |
5989 | instead. | |
5990 | ||
f3f9dcbc MV |
5991 | ** Explicit support for obarrays has been deprecated. |
5992 | ||
5993 | Use `scm_str2symbol' and the generic hashtable functions instead. | |
5994 | ||
5995 | ** The concept of `vcells' has been deprecated. | |
5996 | ||
5997 | The data type `variable' is now used exclusively. `Vcells' have been | |
5998 | a low-level concept so you are likely not affected by this change. | |
5999 | ||
6000 | *** Deprecated functions: scm_sym2vcell, scm_sysintern, | |
6001 | scm_sysintern0, scm_symbol_value0, scm_intern, scm_intern0. | |
6002 | ||
6003 | Use scm_c_define or scm_c_lookup instead, as appropriate. | |
6004 | ||
6005 | *** New functions: scm_c_module_lookup, scm_c_lookup, | |
6006 | scm_c_module_define, scm_c_define, scm_module_lookup, scm_lookup, | |
6007 | scm_module_define, scm_define. | |
6008 | ||
6009 | These functions work with variables instead of with vcells. | |
6010 | ||
311b6a3c MV |
6011 | ** New functions for creating and defining `subr's and `gsubr's. |
6012 | ||
6013 | The new functions more clearly distinguish between creating a subr (or | |
6014 | gsubr) object and adding it to the current module. | |
6015 | ||
6016 | These new functions are available: scm_c_make_subr, scm_c_define_subr, | |
6017 | scm_c_make_subr_with_generic, scm_c_define_subr_with_generic, | |
6018 | scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic, | |
6019 | scm_c_define_gsubr_with_generic. | |
6020 | ||
6021 | ** Deprecated functions: scm_make_subr, scm_make_subr_opt, | |
6022 | scm_make_subr_with_generic, scm_make_gsubr, | |
6023 | scm_make_gsubr_with_generic. | |
6024 | ||
6025 | Use the new ones from above instead. | |
6026 | ||
6027 | ** C interface to the module system has changed. | |
6028 | ||
6029 | While we suggest that you avoid as many explicit module system | |
6030 | operations from C as possible for the time being, the C interface has | |
6031 | been made more similar to the high-level Scheme module system. | |
6032 | ||
6033 | *** New functions: scm_c_define_module, scm_c_use_module, | |
6034 | scm_c_export, scm_c_resolve_module. | |
6035 | ||
6036 | They mostly work like their Scheme namesakes. scm_c_define_module | |
6037 | takes a function that is called a context where the new module is | |
6038 | current. | |
6039 | ||
6040 | *** Deprecated functions: scm_the_root_module, scm_make_module, | |
6041 | scm_ensure_user_module, scm_load_scheme_module. | |
6042 | ||
6043 | Use the new functions instead. | |
6044 | ||
6045 | ** Renamed function: scm_internal_with_fluids becomes | |
6046 | scm_c_with_fluids. | |
6047 | ||
6048 | scm_internal_with_fluids is available as a deprecated function. | |
6049 | ||
6050 | ** New function: scm_c_with_fluid. | |
6051 | ||
6052 | Just like scm_c_with_fluids, but takes one fluid and one value instead | |
6053 | of lists of same. | |
6054 | ||
1be6b49c ML |
6055 | ** Deprecated typedefs: long_long, ulong_long. |
6056 | ||
6057 | They are of questionable utility and they pollute the global | |
6058 | namespace. | |
6059 | ||
1be6b49c ML |
6060 | ** Deprecated typedef: scm_sizet |
6061 | ||
6062 | It is of questionable utility now that Guile requires ANSI C, and is | |
6063 | oddly named. | |
6064 | ||
6065 | ** Deprecated typedefs: scm_port_rw_active, scm_port, | |
6066 | scm_ptob_descriptor, scm_debug_info, scm_debug_frame, scm_fport, | |
6067 | scm_option, scm_rstate, scm_rng, scm_array, scm_array_dim. | |
6068 | ||
6069 | Made more compliant with the naming policy by adding a _t at the end. | |
6070 | ||
6071 | ** Deprecated functions: scm_mkbig, scm_big2num, scm_adjbig, | |
6072 | scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl | |
6073 | ||
373f4948 | 6074 | With the exception of the mysterious scm_2ulong2big, they are still |
1be6b49c ML |
6075 | available under new names (scm_i_mkbig etc). These functions are not |
6076 | intended to be used in user code. You should avoid dealing with | |
6077 | bignums directly, and should deal with numbers in general (which can | |
6078 | be bignums). | |
6079 | ||
147c18a0 MD |
6080 | ** Change in behavior: scm_num2long, scm_num2ulong |
6081 | ||
6082 | The scm_num2[u]long functions don't any longer accept an inexact | |
6083 | argument. This change in behavior is motivated by concordance with | |
6084 | R5RS: It is more common that a primitive doesn't want to accept an | |
6085 | inexact for an exact. | |
6086 | ||
1be6b49c | 6087 | ** New functions: scm_short2num, scm_ushort2num, scm_int2num, |
f3f70257 ML |
6088 | scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short, |
6089 | scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff, | |
1be6b49c ML |
6090 | scm_num2size. |
6091 | ||
6092 | These are conversion functions between the various ANSI C integral | |
147c18a0 MD |
6093 | types and Scheme numbers. NOTE: The scm_num2xxx functions don't |
6094 | accept an inexact argument. | |
1be6b49c | 6095 | |
5437598b MD |
6096 | ** New functions: scm_float2num, scm_double2num, |
6097 | scm_num2float, scm_num2double. | |
6098 | ||
6099 | These are conversion functions between the two ANSI C float types and | |
6100 | Scheme numbers. | |
6101 | ||
1be6b49c | 6102 | ** New number validation macros: |
f3f70257 | 6103 | SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF] |
1be6b49c ML |
6104 | |
6105 | See above. | |
6106 | ||
fc62c86a ML |
6107 | ** New functions: scm_gc_protect_object, scm_gc_unprotect_object |
6108 | ||
6109 | These are just nicer-named old scm_protect_object and | |
6110 | scm_unprotect_object. | |
6111 | ||
6112 | ** Deprecated functions: scm_protect_object, scm_unprotect_object | |
6113 | ||
6114 | ** New functions: scm_gc_[un]register_root, scm_gc_[un]register_roots | |
6115 | ||
6116 | These functions can be used to register pointers to locations that | |
6117 | hold SCM values. | |
6118 | ||
5b2ad23b ML |
6119 | ** Deprecated function: scm_create_hook. |
6120 | ||
6121 | Its sins are: misleading name, non-modularity and lack of general | |
6122 | usefulness. | |
6123 | ||
c299f186 | 6124 | \f |
cc36e791 JB |
6125 | Changes since Guile 1.3.4: |
6126 | ||
80f27102 JB |
6127 | * Changes to the distribution |
6128 | ||
ce358662 JB |
6129 | ** Trees from nightly snapshots and CVS now require you to run autogen.sh. |
6130 | ||
6131 | We've changed the way we handle generated files in the Guile source | |
6132 | repository. As a result, the procedure for building trees obtained | |
6133 | from the nightly FTP snapshots or via CVS has changed: | |
6134 | - You must have appropriate versions of autoconf, automake, and | |
6135 | libtool installed on your system. See README for info on how to | |
6136 | obtain these programs. | |
6137 | - Before configuring the tree, you must first run the script | |
6138 | `autogen.sh' at the top of the source tree. | |
6139 | ||
6140 | The Guile repository used to contain not only source files, written by | |
6141 | humans, but also some generated files, like configure scripts and | |
6142 | Makefile.in files. Even though the contents of these files could be | |
6143 | derived mechanically from other files present, we thought it would | |
6144 | make the tree easier to build if we checked them into CVS. | |
6145 | ||
6146 | However, this approach means that minor differences between | |
6147 | developer's installed tools and habits affected the whole team. | |
6148 | So we have removed the generated files from the repository, and | |
6149 | added the autogen.sh script, which will reconstruct them | |
6150 | appropriately. | |
6151 | ||
6152 | ||
dc914156 GH |
6153 | ** configure now has experimental options to remove support for certain |
6154 | features: | |
52cfc69b | 6155 | |
dc914156 GH |
6156 | --disable-arrays omit array and uniform array support |
6157 | --disable-posix omit posix interfaces | |
6158 | --disable-networking omit networking interfaces | |
6159 | --disable-regex omit regular expression interfaces | |
52cfc69b GH |
6160 | |
6161 | These are likely to become separate modules some day. | |
6162 | ||
9764c29b | 6163 | ** New configure option --enable-debug-freelist |
e1b0d0ac | 6164 | |
38a15cfd GB |
6165 | This enables a debugging version of SCM_NEWCELL(), and also registers |
6166 | an extra primitive, the setter `gc-set-debug-check-freelist!'. | |
6167 | ||
6168 | Configure with the --enable-debug-freelist option to enable | |
6169 | the gc-set-debug-check-freelist! primitive, and then use: | |
6170 | ||
6171 | (gc-set-debug-check-freelist! #t) # turn on checking of the freelist | |
6172 | (gc-set-debug-check-freelist! #f) # turn off checking | |
6173 | ||
6174 | Checking of the freelist forces a traversal of the freelist and | |
6175 | a garbage collection before each allocation of a cell. This can | |
6176 | slow down the interpreter dramatically, so the setter should be used to | |
6177 | turn on this extra processing only when necessary. | |
e1b0d0ac | 6178 | |
9764c29b MD |
6179 | ** New configure option --enable-debug-malloc |
6180 | ||
6181 | Include code for debugging of calls to scm_must_malloc/realloc/free. | |
6182 | ||
6183 | Checks that | |
6184 | ||
6185 | 1. objects freed by scm_must_free has been mallocated by scm_must_malloc | |
6186 | 2. objects reallocated by scm_must_realloc has been allocated by | |
6187 | scm_must_malloc | |
6188 | 3. reallocated objects are reallocated with the same what string | |
6189 | ||
6190 | But, most importantly, it records the number of allocated objects of | |
6191 | each kind. This is useful when searching for memory leaks. | |
6192 | ||
6193 | A Guile compiled with this option provides the primitive | |
6194 | `malloc-stats' which returns an alist with pairs of kind and the | |
6195 | number of objects of that kind. | |
6196 | ||
e415cb06 MD |
6197 | ** All includes are now referenced relative to the root directory |
6198 | ||
6199 | Since some users have had problems with mixups between Guile and | |
6200 | system headers, we have decided to always refer to Guile headers via | |
6201 | their parent directories. This essentially creates a "private name | |
6202 | space" for Guile headers. This means that the compiler only is given | |
6203 | -I options for the root build and root source directory. | |
6204 | ||
341f78c9 MD |
6205 | ** Header files kw.h and genio.h have been removed. |
6206 | ||
6207 | ** The module (ice-9 getopt-gnu-style) has been removed. | |
6208 | ||
e8855f8d MD |
6209 | ** New module (ice-9 documentation) |
6210 | ||
6211 | Implements the interface to documentation strings associated with | |
6212 | objects. | |
6213 | ||
0c0ffe09 KN |
6214 | ** New module (ice-9 time) |
6215 | ||
6216 | Provides a macro `time', which displays execution time of a given form. | |
6217 | ||
cf7a5ee5 KN |
6218 | ** New module (ice-9 history) |
6219 | ||
6220 | Loading this module enables value history in the repl. | |
6221 | ||
0af43c4a | 6222 | * Changes to the stand-alone interpreter |
bd9e24b3 | 6223 | |
67ef2dca MD |
6224 | ** New command line option --debug |
6225 | ||
6226 | Start Guile with debugging evaluator and backtraces enabled. | |
6227 | ||
6228 | This is useful when debugging your .guile init file or scripts. | |
6229 | ||
aa4bb95d MD |
6230 | ** New help facility |
6231 | ||
341f78c9 MD |
6232 | Usage: (help NAME) gives documentation about objects named NAME (a symbol) |
6233 | (help REGEXP) ditto for objects with names matching REGEXP (a string) | |
58e5b910 | 6234 | (help 'NAME) gives documentation for NAME, even if it is not an object |
341f78c9 | 6235 | (help ,EXPR) gives documentation for object returned by EXPR |
6c0201ad | 6236 | (help (my module)) gives module commentary for `(my module)' |
341f78c9 MD |
6237 | (help) gives this text |
6238 | ||
6239 | `help' searches among bindings exported from loaded modules, while | |
6240 | `apropos' searches among bindings visible from the "current" module. | |
6241 | ||
6242 | Examples: (help help) | |
6243 | (help cons) | |
6244 | (help "output-string") | |
aa4bb95d | 6245 | |
e8855f8d MD |
6246 | ** `help' and `apropos' now prints full module names |
6247 | ||
0af43c4a | 6248 | ** Dynamic linking now uses libltdl from the libtool package. |
bd9e24b3 | 6249 | |
0af43c4a MD |
6250 | The old system dependent code for doing dynamic linking has been |
6251 | replaced with calls to the libltdl functions which do all the hairy | |
6252 | details for us. | |
bd9e24b3 | 6253 | |
0af43c4a MD |
6254 | The major improvement is that you can now directly pass libtool |
6255 | library names like "libfoo.la" to `dynamic-link' and `dynamic-link' | |
6256 | will be able to do the best shared library job you can get, via | |
6257 | libltdl. | |
bd9e24b3 | 6258 | |
0af43c4a MD |
6259 | The way dynamic libraries are found has changed and is not really |
6260 | portable across platforms, probably. It is therefore recommended to | |
6261 | use absolute filenames when possible. | |
6262 | ||
6263 | If you pass a filename without an extension to `dynamic-link', it will | |
6264 | try a few appropriate ones. Thus, the most platform ignorant way is | |
6265 | to specify a name like "libfoo", without any directories and | |
6266 | extensions. | |
0573ddae | 6267 | |
91163914 MD |
6268 | ** Guile COOP threads are now compatible with LinuxThreads |
6269 | ||
6270 | Previously, COOP threading wasn't possible in applications linked with | |
6271 | Linux POSIX threads due to their use of the stack pointer to find the | |
6272 | thread context. This has now been fixed with a workaround which uses | |
6273 | the pthreads to allocate the stack. | |
6274 | ||
6c0201ad | 6275 | ** New primitives: `pkgdata-dir', `site-dir', `library-dir' |
62b82274 | 6276 | |
9770d235 MD |
6277 | ** Positions of erring expression in scripts |
6278 | ||
6279 | With version 1.3.4, the location of the erring expression in Guile | |
6280 | scipts is no longer automatically reported. (This should have been | |
6281 | documented before the 1.3.4 release.) | |
6282 | ||
6283 | You can get this information by enabling recording of positions of | |
6284 | source expressions and running the debugging evaluator. Put this at | |
6285 | the top of your script (or in your "site" file): | |
6286 | ||
6287 | (read-enable 'positions) | |
6288 | (debug-enable 'debug) | |
6289 | ||
0573ddae MD |
6290 | ** Backtraces in scripts |
6291 | ||
6292 | It is now possible to get backtraces in scripts. | |
6293 | ||
6294 | Put | |
6295 | ||
6296 | (debug-enable 'debug 'backtrace) | |
6297 | ||
6298 | at the top of the script. | |
6299 | ||
6300 | (The first options enables the debugging evaluator. | |
6301 | The second enables backtraces.) | |
6302 | ||
e8855f8d MD |
6303 | ** Part of module system symbol lookup now implemented in C |
6304 | ||
6305 | The eval closure of most modules is now implemented in C. Since this | |
6306 | was one of the bottlenecks for loading speed, Guile now loads code | |
6307 | substantially faster than before. | |
6308 | ||
f25f761d GH |
6309 | ** Attempting to get the value of an unbound variable now produces |
6310 | an exception with a key of 'unbound-variable instead of 'misc-error. | |
6311 | ||
1a35eadc GH |
6312 | ** The initial default output port is now unbuffered if it's using a |
6313 | tty device. Previously in this situation it was line-buffered. | |
6314 | ||
820920e6 MD |
6315 | ** New hook: after-gc-hook |
6316 | ||
6317 | after-gc-hook takes over the role of gc-thunk. This hook is run at | |
6318 | the first SCM_TICK after a GC. (Thus, the code is run at the same | |
6319 | point during evaluation as signal handlers.) | |
6320 | ||
6321 | Note that this hook should be used only for diagnostic and debugging | |
6322 | purposes. It is not certain that it will continue to be well-defined | |
6323 | when this hook is run in the future. | |
6324 | ||
6325 | C programmers: Note the new C level hooks scm_before_gc_c_hook, | |
6326 | scm_before_sweep_c_hook, scm_after_gc_c_hook. | |
6327 | ||
b5074b23 MD |
6328 | ** Improvements to garbage collector |
6329 | ||
6330 | Guile 1.4 has a new policy for triggering heap allocation and | |
6331 | determining the sizes of heap segments. It fixes a number of problems | |
6332 | in the old GC. | |
6333 | ||
6334 | 1. The new policy can handle two separate pools of cells | |
6335 | (2-word/4-word) better. (The old policy would run wild, allocating | |
6336 | more and more memory for certain programs.) | |
6337 | ||
6338 | 2. The old code would sometimes allocate far too much heap so that the | |
6339 | Guile process became gigantic. The new code avoids this. | |
6340 | ||
6341 | 3. The old code would sometimes allocate too little so that few cells | |
6342 | were freed at GC so that, in turn, too much time was spent in GC. | |
6343 | ||
6344 | 4. The old code would often trigger heap allocation several times in a | |
6345 | row. (The new scheme predicts how large the segments needs to be | |
6346 | in order not to need further allocation.) | |
6347 | ||
e8855f8d MD |
6348 | All in all, the new GC policy will make larger applications more |
6349 | efficient. | |
6350 | ||
b5074b23 MD |
6351 | The new GC scheme also is prepared for POSIX threading. Threads can |
6352 | allocate private pools of cells ("clusters") with just a single | |
6353 | function call. Allocation of single cells from such a cluster can | |
6354 | then proceed without any need of inter-thread synchronization. | |
6355 | ||
6356 | ** New environment variables controlling GC parameters | |
6357 | ||
6358 | GUILE_MAX_SEGMENT_SIZE Maximal segment size | |
6359 | (default = 2097000) | |
6360 | ||
6361 | Allocation of 2-word cell heaps: | |
6362 | ||
6363 | GUILE_INIT_SEGMENT_SIZE_1 Size of initial heap segment in bytes | |
6364 | (default = 360000) | |
6365 | ||
6366 | GUILE_MIN_YIELD_1 Minimum number of freed cells at each | |
6367 | GC in percent of total heap size | |
6368 | (default = 40) | |
6369 | ||
6370 | Allocation of 4-word cell heaps | |
6371 | (used for real numbers and misc other objects): | |
6372 | ||
6373 | GUILE_INIT_SEGMENT_SIZE_2, GUILE_MIN_YIELD_2 | |
6374 | ||
6375 | (See entry "Way for application to customize GC parameters" under | |
6376 | section "Changes to the scm_ interface" below.) | |
6377 | ||
67ef2dca MD |
6378 | ** Guile now implements reals using 4-word cells |
6379 | ||
6380 | This speeds up computation with reals. (They were earlier allocated | |
6381 | with `malloc'.) There is still some room for optimizations, however. | |
6382 | ||
6383 | ** Some further steps toward POSIX thread support have been taken | |
6384 | ||
6385 | *** Guile's critical sections (SCM_DEFER/ALLOW_INTS) | |
6386 | don't have much effect any longer, and many of them will be removed in | |
6387 | next release. | |
6388 | ||
6389 | *** Signals | |
6390 | are only handled at the top of the evaluator loop, immediately after | |
6391 | I/O, and in scm_equalp. | |
6392 | ||
6393 | *** The GC can allocate thread private pools of pairs. | |
6394 | ||
0af43c4a MD |
6395 | * Changes to Scheme functions and syntax |
6396 | ||
a0128ebe | 6397 | ** close-input-port and close-output-port are now R5RS |
7c1e0b12 | 6398 | |
a0128ebe | 6399 | These procedures have been turned into primitives and have R5RS behaviour. |
7c1e0b12 | 6400 | |
0af43c4a MD |
6401 | ** New procedure: simple-format PORT MESSAGE ARG1 ... |
6402 | ||
6403 | (ice-9 boot) makes `format' an alias for `simple-format' until possibly | |
6404 | extended by the more sophisticated version in (ice-9 format) | |
6405 | ||
6406 | (simple-format port message . args) | |
6407 | Write MESSAGE to DESTINATION, defaulting to `current-output-port'. | |
6408 | MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed, | |
6409 | the escapes are replaced with corresponding members of ARGS: | |
6410 | ~A formats using `display' and ~S formats using `write'. | |
6411 | If DESTINATION is #t, then use the `current-output-port', | |
6412 | if DESTINATION is #f, then return a string containing the formatted text. | |
6413 | Does not add a trailing newline." | |
6414 | ||
6415 | ** string-ref: the second argument is no longer optional. | |
6416 | ||
6417 | ** string, list->string: no longer accept strings in their arguments, | |
6418 | only characters, for compatibility with R5RS. | |
6419 | ||
6420 | ** New procedure: port-closed? PORT | |
6421 | Returns #t if PORT is closed or #f if it is open. | |
6422 | ||
0a9e521f MD |
6423 | ** Deprecated: list* |
6424 | ||
6425 | The list* functionality is now provided by cons* (SRFI-1 compliant) | |
6426 | ||
b5074b23 MD |
6427 | ** New procedure: cons* ARG1 ARG2 ... ARGn |
6428 | ||
6429 | Like `list', but the last arg provides the tail of the constructed list, | |
6430 | returning (cons ARG1 (cons ARG2 (cons ... ARGn))). | |
6431 | ||
6432 | Requires at least one argument. If given one argument, that argument | |
6433 | is returned as result. | |
6434 | ||
6435 | This function is called `list*' in some other Schemes and in Common LISP. | |
6436 | ||
341f78c9 MD |
6437 | ** Removed deprecated: serial-map, serial-array-copy!, serial-array-map! |
6438 | ||
e8855f8d MD |
6439 | ** New procedure: object-documentation OBJECT |
6440 | ||
6441 | Returns the documentation string associated with OBJECT. The | |
6442 | procedure uses a caching mechanism so that subsequent lookups are | |
6443 | faster. | |
6444 | ||
6445 | Exported by (ice-9 documentation). | |
6446 | ||
6447 | ** module-name now returns full names of modules | |
6448 | ||
6449 | Previously, only the last part of the name was returned (`session' for | |
6450 | `(ice-9 session)'). Ex: `(ice-9 session)'. | |
6451 | ||
894a712b DH |
6452 | * Changes to the gh_ interface |
6453 | ||
6454 | ** Deprecated: gh_int2scmb | |
6455 | ||
6456 | Use gh_bool2scm instead. | |
6457 | ||
a2349a28 GH |
6458 | * Changes to the scm_ interface |
6459 | ||
810e1aec MD |
6460 | ** Guile primitives now carry docstrings! |
6461 | ||
6462 | Thanks to Greg Badros! | |
6463 | ||
0a9e521f | 6464 | ** Guile primitives are defined in a new way: SCM_DEFINE/SCM_DEFINE1/SCM_PROC |
0af43c4a | 6465 | |
0a9e521f MD |
6466 | Now Guile primitives are defined using the SCM_DEFINE/SCM_DEFINE1/SCM_PROC |
6467 | macros and must contain a docstring that is extracted into foo.doc using a new | |
0af43c4a MD |
6468 | guile-doc-snarf script (that uses guile-doc-snarf.awk). |
6469 | ||
0a9e521f MD |
6470 | However, a major overhaul of these macros is scheduled for the next release of |
6471 | guile. | |
6472 | ||
0af43c4a MD |
6473 | ** Guile primitives use a new technique for validation of arguments |
6474 | ||
6475 | SCM_VALIDATE_* macros are defined to ease the redundancy and improve | |
6476 | the readability of argument checking. | |
6477 | ||
6478 | ** All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents. | |
6479 | ||
894a712b | 6480 | ** New macros: SCM_PACK, SCM_UNPACK |
f8a72ca4 MD |
6481 | |
6482 | Compose/decompose an SCM value. | |
6483 | ||
894a712b DH |
6484 | The SCM type is now treated as an abstract data type and may be defined as a |
6485 | long, a void* or as a struct, depending on the architecture and compile time | |
6486 | options. This makes it easier to find several types of bugs, for example when | |
6487 | SCM values are treated as integers without conversion. Values of the SCM type | |
6488 | should be treated as "atomic" values. These macros are used when | |
f8a72ca4 MD |
6489 | composing/decomposing an SCM value, either because you want to access |
6490 | individual bits, or because you want to treat it as an integer value. | |
6491 | ||
6492 | E.g., in order to set bit 7 in an SCM value x, use the expression | |
6493 | ||
6494 | SCM_PACK (SCM_UNPACK (x) | 0x80) | |
6495 | ||
e11f8b42 DH |
6496 | ** The name property of hooks is deprecated. |
6497 | Thus, the use of SCM_HOOK_NAME and scm_make_hook_with_name is deprecated. | |
6498 | ||
6499 | You can emulate this feature by using object properties. | |
6500 | ||
6c0201ad | 6501 | ** Deprecated macros: SCM_INPORTP, SCM_OUTPORTP, SCM_CRDY, SCM_ICHRP, |
894a712b DH |
6502 | SCM_ICHR, SCM_MAKICHR, SCM_SETJMPBUF, SCM_NSTRINGP, SCM_NRWSTRINGP, |
6503 | SCM_NVECTORP | |
f8a72ca4 | 6504 | |
894a712b | 6505 | These macros will be removed in a future release of Guile. |
7c1e0b12 | 6506 | |
6c0201ad | 6507 | ** The following types, functions and macros from numbers.h are deprecated: |
0a9e521f MD |
6508 | scm_dblproc, SCM_UNEGFIXABLE, SCM_FLOBUFLEN, SCM_INEXP, SCM_CPLXP, SCM_REAL, |
6509 | SCM_IMAG, SCM_REALPART, scm_makdbl, SCM_SINGP, SCM_NUM2DBL, SCM_NO_BIGDIG | |
6510 | ||
a2349a28 GH |
6511 | ** Port internals: the rw_random variable in the scm_port structure |
6512 | must be set to non-zero in any random access port. In recent Guile | |
6513 | releases it was only set for bidirectional random-access ports. | |
6514 | ||
7dcb364d GH |
6515 | ** Port internals: the seek ptob procedure is now responsible for |
6516 | resetting the buffers if required. The change was made so that in the | |
6517 | special case of reading the current position (i.e., seek p 0 SEEK_CUR) | |
6518 | the fport and strport ptobs can avoid resetting the buffers, | |
6519 | in particular to avoid discarding unread chars. An existing port | |
6520 | type can be fixed by adding something like the following to the | |
6521 | beginning of the ptob seek procedure: | |
6522 | ||
6523 | if (pt->rw_active == SCM_PORT_READ) | |
6524 | scm_end_input (object); | |
6525 | else if (pt->rw_active == SCM_PORT_WRITE) | |
6526 | ptob->flush (object); | |
6527 | ||
6528 | although to actually avoid resetting the buffers and discard unread | |
6529 | chars requires further hacking that depends on the characteristics | |
6530 | of the ptob. | |
6531 | ||
894a712b DH |
6532 | ** Deprecated functions: scm_fseek, scm_tag |
6533 | ||
6534 | These functions are no longer used and will be removed in a future version. | |
6535 | ||
f25f761d GH |
6536 | ** The scm_sysmissing procedure is no longer used in libguile. |
6537 | Unless it turns out to be unexpectedly useful to somebody, it will be | |
6538 | removed in a future version. | |
6539 | ||
0af43c4a MD |
6540 | ** The format of error message strings has changed |
6541 | ||
6542 | The two C procedures: scm_display_error and scm_error, as well as the | |
6543 | primitive `scm-error', now use scm_simple_format to do their work. | |
6544 | This means that the message strings of all code must be updated to use | |
6545 | ~A where %s was used before, and ~S where %S was used before. | |
6546 | ||
6547 | During the period when there still are a lot of old Guiles out there, | |
6548 | you might want to support both old and new versions of Guile. | |
6549 | ||
6550 | There are basically two methods to achieve this. Both methods use | |
6551 | autoconf. Put | |
6552 | ||
6553 | AC_CHECK_FUNCS(scm_simple_format) | |
6554 | ||
6555 | in your configure.in. | |
6556 | ||
6557 | Method 1: Use the string concatenation features of ANSI C's | |
6558 | preprocessor. | |
6559 | ||
6560 | In C: | |
6561 | ||
6562 | #ifdef HAVE_SCM_SIMPLE_FORMAT | |
6563 | #define FMT_S "~S" | |
6564 | #else | |
6565 | #define FMT_S "%S" | |
6566 | #endif | |
6567 | ||
6568 | Then represent each of your error messages using a preprocessor macro: | |
6569 | ||
6570 | #define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!" | |
6571 | ||
6572 | In Scheme: | |
6573 | ||
6574 | (define fmt-s (if (defined? 'simple-format) "~S" "%S")) | |
6575 | (define make-message string-append) | |
6576 | ||
6577 | (define e-spider-error (make-message "There's a spider in your " fmt-s "!!!")) | |
6578 | ||
6579 | Method 2: Use the oldfmt function found in doc/oldfmt.c. | |
6580 | ||
6581 | In C: | |
6582 | ||
6583 | scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"), | |
6584 | ...); | |
6585 | ||
6586 | In Scheme: | |
6587 | ||
6588 | (scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!") | |
6589 | ...) | |
6590 | ||
6591 | ||
f3b5e185 MD |
6592 | ** Deprecated: coop_mutex_init, coop_condition_variable_init |
6593 | ||
6594 | Don't use the functions coop_mutex_init and | |
6595 | coop_condition_variable_init. They will change. | |
6596 | ||
6597 | Use scm_mutex_init and scm_cond_init instead. | |
6598 | ||
f3b5e185 MD |
6599 | ** New function: int scm_cond_timedwait (scm_cond_t *COND, scm_mutex_t *MUTEX, const struct timespec *ABSTIME) |
6600 | `scm_cond_timedwait' atomically unlocks MUTEX and waits on | |
6601 | COND, as `scm_cond_wait' does, but it also bounds the duration | |
6602 | of the wait. If COND has not been signaled before time ABSTIME, | |
6603 | the mutex MUTEX is re-acquired and `scm_cond_timedwait' | |
6604 | returns the error code `ETIMEDOUT'. | |
6605 | ||
6606 | The ABSTIME parameter specifies an absolute time, with the same | |
6607 | origin as `time' and `gettimeofday': an ABSTIME of 0 corresponds | |
6608 | to 00:00:00 GMT, January 1, 1970. | |
6609 | ||
6610 | ** New function: scm_cond_broadcast (scm_cond_t *COND) | |
6611 | `scm_cond_broadcast' restarts all the threads that are waiting | |
6612 | on the condition variable COND. Nothing happens if no threads are | |
6613 | waiting on COND. | |
6614 | ||
6615 | ** New function: scm_key_create (scm_key_t *KEY, void (*destr_function) (void *)) | |
6616 | `scm_key_create' allocates a new TSD key. The key is stored in | |
6617 | the location pointed to by KEY. There is no limit on the number | |
6618 | of keys allocated at a given time. The value initially associated | |
6619 | with the returned key is `NULL' in all currently executing threads. | |
6620 | ||
6621 | The DESTR_FUNCTION argument, if not `NULL', specifies a destructor | |
6622 | function associated with the key. When a thread terminates, | |
6623 | DESTR_FUNCTION is called on the value associated with the key in | |
6624 | that thread. The DESTR_FUNCTION is not called if a key is deleted | |
6625 | with `scm_key_delete' or a value is changed with | |
6626 | `scm_setspecific'. The order in which destructor functions are | |
6627 | called at thread termination time is unspecified. | |
6628 | ||
6629 | Destructors are not yet implemented. | |
6630 | ||
6631 | ** New function: scm_setspecific (scm_key_t KEY, const void *POINTER) | |
6632 | `scm_setspecific' changes the value associated with KEY in the | |
6633 | calling thread, storing the given POINTER instead. | |
6634 | ||
6635 | ** New function: scm_getspecific (scm_key_t KEY) | |
6636 | `scm_getspecific' returns the value currently associated with | |
6637 | KEY in the calling thread. | |
6638 | ||
6639 | ** New function: scm_key_delete (scm_key_t KEY) | |
6640 | `scm_key_delete' deallocates a TSD key. It does not check | |
6641 | whether non-`NULL' values are associated with that key in the | |
6642 | currently executing threads, nor call the destructor function | |
6643 | associated with the key. | |
6644 | ||
820920e6 MD |
6645 | ** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE) |
6646 | ||
6647 | Initialize a C level hook HOOK with associated HOOK_DATA and type | |
6648 | TYPE. (See scm_c_hook_run ().) | |
6649 | ||
6650 | ** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP) | |
6651 | ||
6652 | Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP | |
6653 | is true, add it last, otherwise first. The same FUNC can be added | |
6654 | multiple times if FUNC_DATA differ and vice versa. | |
6655 | ||
6656 | ** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA) | |
6657 | ||
6658 | Remove hook function FUNC with associated FUNC_DATA from HOOK. A | |
6659 | function is only removed if both FUNC and FUNC_DATA matches. | |
6660 | ||
6661 | ** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA) | |
6662 | ||
6663 | Run hook HOOK passing DATA to the hook functions. | |
6664 | ||
6665 | If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value | |
6666 | returned is undefined. | |
6667 | ||
6668 | If TYPE is SCM_C_HOOK_OR, hook functions are run until a function | |
6669 | returns a non-NULL value. This value is returned as the result of | |
6670 | scm_c_hook_run. If all functions return NULL, NULL is returned. | |
6671 | ||
6672 | If TYPE is SCM_C_HOOK_AND, hook functions are run until a function | |
6673 | returns a NULL value, and NULL is returned. If all functions returns | |
6674 | a non-NULL value, the last value is returned. | |
6675 | ||
6676 | ** New C level GC hooks | |
6677 | ||
6678 | Five new C level hooks has been added to the garbage collector. | |
6679 | ||
6680 | scm_before_gc_c_hook | |
6681 | scm_after_gc_c_hook | |
6682 | ||
6683 | are run before locking and after unlocking the heap. The system is | |
6684 | thus in a mode where evaluation can take place. (Except that | |
6685 | scm_before_gc_c_hook must not allocate new cells.) | |
6686 | ||
6687 | scm_before_mark_c_hook | |
6688 | scm_before_sweep_c_hook | |
6689 | scm_after_sweep_c_hook | |
6690 | ||
6691 | are run when the heap is locked. These are intended for extension of | |
6692 | the GC in a modular fashion. Examples are the weaks and guardians | |
6693 | modules. | |
6694 | ||
b5074b23 MD |
6695 | ** Way for application to customize GC parameters |
6696 | ||
6697 | The application can set up other default values for the GC heap | |
6698 | allocation parameters | |
6699 | ||
6700 | GUILE_INIT_HEAP_SIZE_1, GUILE_MIN_YIELD_1, | |
6701 | GUILE_INIT_HEAP_SIZE_2, GUILE_MIN_YIELD_2, | |
6702 | GUILE_MAX_SEGMENT_SIZE, | |
6703 | ||
6704 | by setting | |
6705 | ||
6706 | scm_default_init_heap_size_1, scm_default_min_yield_1, | |
6707 | scm_default_init_heap_size_2, scm_default_min_yield_2, | |
6708 | scm_default_max_segment_size | |
6709 | ||
6710 | respectively before callong scm_boot_guile. | |
6711 | ||
6712 | (See entry "New environment variables ..." in section | |
6713 | "Changes to the stand-alone interpreter" above.) | |
6714 | ||
9704841c MD |
6715 | ** scm_protect_object/scm_unprotect_object now nest |
6716 | ||
67ef2dca MD |
6717 | This means that you can call scm_protect_object multiple times on an |
6718 | object and count on the object being protected until | |
6719 | scm_unprotect_object has been call the same number of times. | |
6720 | ||
6721 | The functions also have better time complexity. | |
6722 | ||
6723 | Still, it is usually possible to structure the application in a way | |
6724 | that you don't need to use these functions. For example, if you use a | |
6725 | protected standard Guile list to keep track of live objects rather | |
6726 | than some custom data type, objects will die a natural death when they | |
6727 | are no longer needed. | |
6728 | ||
0a9e521f MD |
6729 | ** Deprecated type tags: scm_tc16_flo, scm_tc_flo, scm_tc_dblr, scm_tc_dblc |
6730 | ||
6731 | Guile does not provide the float representation for inexact real numbers any | |
6732 | more. Now, only doubles are used to represent inexact real numbers. Further, | |
6733 | the tag names scm_tc_dblr and scm_tc_dblc have been changed to scm_tc16_real | |
6734 | and scm_tc16_complex, respectively. | |
6735 | ||
341f78c9 MD |
6736 | ** Removed deprecated type scm_smobfuns |
6737 | ||
6738 | ** Removed deprecated function scm_newsmob | |
6739 | ||
b5074b23 MD |
6740 | ** Warning: scm_make_smob_type_mfpe might become deprecated in a future release |
6741 | ||
6742 | There is an ongoing discussion among the developers whether to | |
6743 | deprecate `scm_make_smob_type_mfpe' or not. Please use the current | |
6744 | standard interface (scm_make_smob_type, scm_set_smob_XXX) in new code | |
6745 | until this issue has been settled. | |
6746 | ||
341f78c9 MD |
6747 | ** Removed deprecated type tag scm_tc16_kw |
6748 | ||
2728d7f4 MD |
6749 | ** Added type tag scm_tc16_keyword |
6750 | ||
6751 | (This was introduced already in release 1.3.4 but was not documented | |
6752 | until now.) | |
6753 | ||
67ef2dca MD |
6754 | ** gdb_print now prints "*** Guile not initialized ***" until Guile initialized |
6755 | ||
f25f761d GH |
6756 | * Changes to system call interfaces: |
6757 | ||
28d77376 GH |
6758 | ** The "select" procedure now tests port buffers for the ability to |
6759 | provide input or accept output. Previously only the underlying file | |
6760 | descriptors were checked. | |
6761 | ||
bd9e24b3 GH |
6762 | ** New variable PIPE_BUF: the maximum number of bytes that can be |
6763 | atomically written to a pipe. | |
6764 | ||
f25f761d GH |
6765 | ** If a facility is not available on the system when Guile is |
6766 | compiled, the corresponding primitive procedure will not be defined. | |
6767 | Previously it would have been defined but would throw a system-error | |
6768 | exception if called. Exception handlers which catch this case may | |
6769 | need minor modification: an error will be thrown with key | |
6770 | 'unbound-variable instead of 'system-error. Alternatively it's | |
6771 | now possible to use `defined?' to check whether the facility is | |
6772 | available. | |
6773 | ||
38c1d3c4 | 6774 | ** Procedures which depend on the timezone should now give the correct |
6c0201ad | 6775 | result on systems which cache the TZ environment variable, even if TZ |
38c1d3c4 GH |
6776 | is changed without calling tzset. |
6777 | ||
5c11cc9d GH |
6778 | * Changes to the networking interfaces: |
6779 | ||
6780 | ** New functions: htons, ntohs, htonl, ntohl: for converting short and | |
6781 | long integers between network and host format. For now, it's not | |
6782 | particularly convenient to do this kind of thing, but consider: | |
6783 | ||
6784 | (define write-network-long | |
6785 | (lambda (value port) | |
6786 | (let ((v (make-uniform-vector 1 1 0))) | |
6787 | (uniform-vector-set! v 0 (htonl value)) | |
6788 | (uniform-vector-write v port)))) | |
6789 | ||
6790 | (define read-network-long | |
6791 | (lambda (port) | |
6792 | (let ((v (make-uniform-vector 1 1 0))) | |
6793 | (uniform-vector-read! v port) | |
6794 | (ntohl (uniform-vector-ref v 0))))) | |
6795 | ||
6796 | ** If inet-aton fails, it now throws an error with key 'misc-error | |
6797 | instead of 'system-error, since errno is not relevant. | |
6798 | ||
6799 | ** Certain gethostbyname/gethostbyaddr failures now throw errors with | |
6800 | specific keys instead of 'system-error. The latter is inappropriate | |
6801 | since errno will not have been set. The keys are: | |
afe5177e | 6802 | 'host-not-found, 'try-again, 'no-recovery and 'no-data. |
5c11cc9d GH |
6803 | |
6804 | ** sethostent, setnetent, setprotoent, setservent: now take an | |
6805 | optional argument STAYOPEN, which specifies whether the database | |
6806 | remains open after a database entry is accessed randomly (e.g., using | |
6807 | gethostbyname for the hosts database.) The default is #f. Previously | |
6808 | #t was always used. | |
6809 | ||
cc36e791 | 6810 | \f |
43fa9a05 JB |
6811 | Changes since Guile 1.3.2: |
6812 | ||
0fdcbcaa MD |
6813 | * Changes to the stand-alone interpreter |
6814 | ||
6815 | ** Debugger | |
6816 | ||
6817 | An initial version of the Guile debugger written by Chris Hanson has | |
6818 | been added. The debugger is still under development but is included | |
6819 | in the distribution anyway since it is already quite useful. | |
6820 | ||
6821 | Type | |
6822 | ||
6823 | (debug) | |
6824 | ||
6825 | after an error to enter the debugger. Type `help' inside the debugger | |
6826 | for a description of available commands. | |
6827 | ||
6828 | If you prefer to have stack frames numbered and printed in | |
6829 | anti-chronological order and prefer up in the stack to be down on the | |
6830 | screen as is the case in gdb, you can put | |
6831 | ||
6832 | (debug-enable 'backwards) | |
6833 | ||
6834 | in your .guile startup file. (However, this means that Guile can't | |
6835 | use indentation to indicate stack level.) | |
6836 | ||
6837 | The debugger is autoloaded into Guile at the first use. | |
6838 | ||
6839 | ** Further enhancements to backtraces | |
6840 | ||
6841 | There is a new debug option `width' which controls the maximum width | |
6842 | on the screen of printed stack frames. Fancy printing parameters | |
6843 | ("level" and "length" as in Common LISP) are adaptively adjusted for | |
6844 | each stack frame to give maximum information while still fitting | |
6845 | within the bounds. If the stack frame can't be made to fit by | |
6846 | adjusting parameters, it is simply cut off at the end. This is marked | |
6847 | with a `$'. | |
6848 | ||
6849 | ** Some modules are now only loaded when the repl is started | |
6850 | ||
6851 | The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9 | |
6852 | regex) are now loaded into (guile-user) only if the repl has been | |
6853 | started. The effect is that the startup time for scripts has been | |
6854 | reduced to 30% of what it was previously. | |
6855 | ||
6856 | Correctly written scripts load the modules they require at the top of | |
6857 | the file and should not be affected by this change. | |
6858 | ||
ece41168 MD |
6859 | ** Hooks are now represented as smobs |
6860 | ||
6822fe53 MD |
6861 | * Changes to Scheme functions and syntax |
6862 | ||
0ce204b0 MV |
6863 | ** Readline support has changed again. |
6864 | ||
6865 | The old (readline-activator) module is gone. Use (ice-9 readline) | |
6866 | instead, which now contains all readline functionality. So the code | |
6867 | to activate readline is now | |
6868 | ||
6869 | (use-modules (ice-9 readline)) | |
6870 | (activate-readline) | |
6871 | ||
6872 | This should work at any time, including from the guile prompt. | |
6873 | ||
5d195868 JB |
6874 | To avoid confusion about the terms of Guile's license, please only |
6875 | enable readline for your personal use; please don't make it the | |
6876 | default for others. Here is why we make this rather odd-sounding | |
6877 | request: | |
6878 | ||
6879 | Guile is normally licensed under a weakened form of the GNU General | |
6880 | Public License, which allows you to link code with Guile without | |
6881 | placing that code under the GPL. This exception is important to some | |
6882 | people. | |
6883 | ||
6884 | However, since readline is distributed under the GNU General Public | |
6885 | License, when you link Guile with readline, either statically or | |
6886 | dynamically, you effectively change Guile's license to the strict GPL. | |
6887 | Whenever you link any strictly GPL'd code into Guile, uses of Guile | |
6888 | which are normally permitted become forbidden. This is a rather | |
6889 | non-obvious consequence of the licensing terms. | |
6890 | ||
6891 | So, to make sure things remain clear, please let people choose for | |
6892 | themselves whether to link GPL'd libraries like readline with Guile. | |
6893 | ||
25b0654e JB |
6894 | ** regexp-substitute/global has changed slightly, but incompatibly. |
6895 | ||
6896 | If you include a function in the item list, the string of the match | |
6897 | object it receives is the same string passed to | |
6898 | regexp-substitute/global, not some suffix of that string. | |
6899 | Correspondingly, the match's positions are relative to the entire | |
6900 | string, not the suffix. | |
6901 | ||
6902 | If the regexp can match the empty string, the way matches are chosen | |
6903 | from the string has changed. regexp-substitute/global recognizes the | |
6904 | same set of matches that list-matches does; see below. | |
6905 | ||
6906 | ** New function: list-matches REGEXP STRING [FLAGS] | |
6907 | ||
6908 | Return a list of match objects, one for every non-overlapping, maximal | |
6909 | match of REGEXP in STRING. The matches appear in left-to-right order. | |
6910 | list-matches only reports matches of the empty string if there are no | |
6911 | other matches which begin on, end at, or include the empty match's | |
6912 | position. | |
6913 | ||
6914 | If present, FLAGS is passed as the FLAGS argument to regexp-exec. | |
6915 | ||
6916 | ** New function: fold-matches REGEXP STRING INIT PROC [FLAGS] | |
6917 | ||
6918 | For each match of REGEXP in STRING, apply PROC to the match object, | |
6919 | and the last value PROC returned, or INIT for the first call. Return | |
6920 | the last value returned by PROC. We apply PROC to the matches as they | |
6921 | appear from left to right. | |
6922 | ||
6923 | This function recognizes matches according to the same criteria as | |
6924 | list-matches. | |
6925 | ||
6926 | Thus, you could define list-matches like this: | |
6927 | ||
6928 | (define (list-matches regexp string . flags) | |
6929 | (reverse! (apply fold-matches regexp string '() cons flags))) | |
6930 | ||
6931 | If present, FLAGS is passed as the FLAGS argument to regexp-exec. | |
6932 | ||
bc848f7f MD |
6933 | ** Hooks |
6934 | ||
6935 | *** New function: hook? OBJ | |
6936 | ||
6937 | Return #t if OBJ is a hook, otherwise #f. | |
6938 | ||
ece41168 MD |
6939 | *** New function: make-hook-with-name NAME [ARITY] |
6940 | ||
6941 | Return a hook with name NAME and arity ARITY. The default value for | |
6942 | ARITY is 0. The only effect of NAME is that it will appear when the | |
6943 | hook object is printed to ease debugging. | |
6944 | ||
bc848f7f MD |
6945 | *** New function: hook-empty? HOOK |
6946 | ||
6947 | Return #t if HOOK doesn't contain any procedures, otherwise #f. | |
6948 | ||
6949 | *** New function: hook->list HOOK | |
6950 | ||
6951 | Return a list of the procedures that are called when run-hook is | |
6952 | applied to HOOK. | |
6953 | ||
b074884f JB |
6954 | ** `map' signals an error if its argument lists are not all the same length. |
6955 | ||
6956 | This is the behavior required by R5RS, so this change is really a bug | |
6957 | fix. But it seems to affect a lot of people's code, so we're | |
6958 | mentioning it here anyway. | |
6959 | ||
6822fe53 MD |
6960 | ** Print-state handling has been made more transparent |
6961 | ||
6962 | Under certain circumstances, ports are represented as a port with an | |
6963 | associated print state. Earlier, this pair was represented as a pair | |
6964 | (see "Some magic has been added to the printer" below). It is now | |
6965 | indistinguishable (almost; see `get-print-state') from a port on the | |
6966 | user level. | |
6967 | ||
6968 | *** New function: port-with-print-state OUTPUT-PORT PRINT-STATE | |
6969 | ||
6970 | Return a new port with the associated print state PRINT-STATE. | |
6971 | ||
6972 | *** New function: get-print-state OUTPUT-PORT | |
6973 | ||
6974 | Return the print state associated with this port if it exists, | |
6975 | otherwise return #f. | |
6976 | ||
340a8770 | 6977 | *** New function: directory-stream? OBJECT |
77242ff9 | 6978 | |
340a8770 | 6979 | Returns true iff OBJECT is a directory stream --- the sort of object |
77242ff9 GH |
6980 | returned by `opendir'. |
6981 | ||
0fdcbcaa MD |
6982 | ** New function: using-readline? |
6983 | ||
6984 | Return #t if readline is in use in the current repl. | |
6985 | ||
26405bc1 MD |
6986 | ** structs will be removed in 1.4 |
6987 | ||
6988 | Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile | |
6989 | and use GOOPS objects as the fundamental record type. | |
6990 | ||
49199eaa MD |
6991 | * Changes to the scm_ interface |
6992 | ||
26405bc1 MD |
6993 | ** structs will be removed in 1.4 |
6994 | ||
6995 | The entire current struct interface (struct.c, struct.h) will be | |
6996 | replaced in Guile 1.4. We will merge GOOPS into libguile and use | |
6997 | GOOPS objects as the fundamental record type. | |
6998 | ||
49199eaa MD |
6999 | ** The internal representation of subr's has changed |
7000 | ||
7001 | Instead of giving a hint to the subr name, the CAR field of the subr | |
7002 | now contains an index to a subr entry in scm_subr_table. | |
7003 | ||
7004 | *** New variable: scm_subr_table | |
7005 | ||
7006 | An array of subr entries. A subr entry contains the name, properties | |
7007 | and documentation associated with the subr. The properties and | |
7008 | documentation slots are not yet used. | |
7009 | ||
7010 | ** A new scheme for "forwarding" calls to a builtin to a generic function | |
7011 | ||
7012 | It is now possible to extend the functionality of some Guile | |
7013 | primitives by letting them defer a call to a GOOPS generic function on | |
240ed66f | 7014 | argument mismatch. This means that there is no loss of efficiency in |
daf516d6 | 7015 | normal evaluation. |
49199eaa MD |
7016 | |
7017 | Example: | |
7018 | ||
daf516d6 | 7019 | (use-modules (oop goops)) ; Must be GOOPS version 0.2. |
49199eaa MD |
7020 | (define-method + ((x <string>) (y <string>)) |
7021 | (string-append x y)) | |
7022 | ||
86a4d62e MD |
7023 | + will still be as efficient as usual in numerical calculations, but |
7024 | can also be used for concatenating strings. | |
49199eaa | 7025 | |
86a4d62e | 7026 | Who will be the first one to extend Guile's numerical tower to |
daf516d6 MD |
7027 | rationals? :) [OK, there a few other things to fix before this can |
7028 | be made in a clean way.] | |
49199eaa MD |
7029 | |
7030 | *** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1 | |
7031 | ||
7032 | New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC) | |
7033 | ||
7034 | New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC) | |
7035 | ||
d02cafe7 | 7036 | These do the same job as SCM_PROC and SCM_PROC1, but they also define |
49199eaa MD |
7037 | a variable GENERIC which can be used by the dispatch macros below. |
7038 | ||
7039 | [This is experimental code which may change soon.] | |
7040 | ||
7041 | *** New macros for forwarding control to a generic on arg type error | |
7042 | ||
7043 | New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR) | |
7044 | ||
7045 | New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR) | |
7046 | ||
7047 | These correspond to the scm_wta function call, and have the same | |
7048 | behaviour until the user has called the GOOPS primitive | |
7049 | `enable-primitive-generic!'. After that, these macros will apply the | |
7050 | generic function GENERIC to the argument(s) instead of calling | |
7051 | scm_wta. | |
7052 | ||
7053 | [This is experimental code which may change soon.] | |
7054 | ||
7055 | *** New macros for argument testing with generic dispatch | |
7056 | ||
7057 | New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR) | |
7058 | ||
7059 | New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR) | |
7060 | ||
7061 | These correspond to the SCM_ASSERT macro, but will defer control to | |
7062 | GENERIC on error after `enable-primitive-generic!' has been called. | |
7063 | ||
7064 | [This is experimental code which may change soon.] | |
7065 | ||
7066 | ** New function: SCM scm_eval_body (SCM body, SCM env) | |
7067 | ||
7068 | Evaluates the body of a special form. | |
7069 | ||
7070 | ** The internal representation of struct's has changed | |
7071 | ||
7072 | Previously, four slots were allocated for the procedure(s) of entities | |
7073 | and operators. The motivation for this representation had to do with | |
7074 | the structure of the evaluator, the wish to support tail-recursive | |
7075 | generic functions, and efficiency. Since the generic function | |
7076 | dispatch mechanism has changed, there is no longer a need for such an | |
7077 | expensive representation, and the representation has been simplified. | |
7078 | ||
7079 | This should not make any difference for most users. | |
7080 | ||
7081 | ** GOOPS support has been cleaned up. | |
7082 | ||
7083 | Some code has been moved from eval.c to objects.c and code in both of | |
7084 | these compilation units has been cleaned up and better structured. | |
7085 | ||
7086 | *** New functions for applying generic functions | |
7087 | ||
7088 | New function: SCM scm_apply_generic (GENERIC, ARGS) | |
7089 | New function: SCM scm_call_generic_0 (GENERIC) | |
7090 | New function: SCM scm_call_generic_1 (GENERIC, ARG1) | |
7091 | New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2) | |
7092 | New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3) | |
7093 | ||
ece41168 MD |
7094 | ** Deprecated function: scm_make_named_hook |
7095 | ||
7096 | It is now replaced by: | |
7097 | ||
7098 | ** New function: SCM scm_create_hook (const char *name, int arity) | |
7099 | ||
7100 | Creates a hook in the same way as make-hook above but also | |
7101 | binds a variable named NAME to it. | |
7102 | ||
7103 | This is the typical way of creating a hook from C code. | |
7104 | ||
7105 | Currently, the variable is created in the "current" module. | |
7106 | This might change when we get the new module system. | |
7107 | ||
7108 | [The behaviour is identical to scm_make_named_hook.] | |
7109 | ||
7110 | ||
43fa9a05 | 7111 | \f |
f3227c7a JB |
7112 | Changes since Guile 1.3: |
7113 | ||
6ca345f3 JB |
7114 | * Changes to mailing lists |
7115 | ||
7116 | ** Some of the Guile mailing lists have moved to sourceware.cygnus.com. | |
7117 | ||
7118 | See the README file to find current addresses for all the Guile | |
7119 | mailing lists. | |
7120 | ||
d77fb593 JB |
7121 | * Changes to the distribution |
7122 | ||
1d335863 JB |
7123 | ** Readline support is no longer included with Guile by default. |
7124 | ||
7125 | Based on the different license terms of Guile and Readline, we | |
7126 | concluded that Guile should not *by default* cause the linking of | |
7127 | Readline into an application program. Readline support is now offered | |
7128 | as a separate module, which is linked into an application only when | |
7129 | you explicitly specify it. | |
7130 | ||
7131 | Although Guile is GNU software, its distribution terms add a special | |
7132 | exception to the usual GNU General Public License (GPL). Guile's | |
7133 | license includes a clause that allows you to link Guile with non-free | |
7134 | programs. We add this exception so as not to put Guile at a | |
7135 | disadvantage vis-a-vis other extensibility packages that support other | |
7136 | languages. | |
7137 | ||
7138 | In contrast, the GNU Readline library is distributed under the GNU | |
7139 | General Public License pure and simple. This means that you may not | |
7140 | link Readline, even dynamically, into an application unless it is | |
7141 | distributed under a free software license that is compatible the GPL. | |
7142 | ||
7143 | Because of this difference in distribution terms, an application that | |
7144 | can use Guile may not be able to use Readline. Now users will be | |
7145 | explicitly offered two independent decisions about the use of these | |
7146 | two packages. | |
d77fb593 | 7147 | |
0e8a8468 MV |
7148 | You can activate the readline support by issuing |
7149 | ||
7150 | (use-modules (readline-activator)) | |
7151 | (activate-readline) | |
7152 | ||
7153 | from your ".guile" file, for example. | |
7154 | ||
e4eae9b1 MD |
7155 | * Changes to the stand-alone interpreter |
7156 | ||
67ad463a MD |
7157 | ** All builtins now print as primitives. |
7158 | Previously builtin procedures not belonging to the fundamental subr | |
7159 | types printed as #<compiled closure #<primitive-procedure gsubr-apply>>. | |
7160 | Now, they print as #<primitive-procedure NAME>. | |
7161 | ||
7162 | ** Backtraces slightly more intelligible. | |
7163 | gsubr-apply and macro transformer application frames no longer appear | |
7164 | in backtraces. | |
7165 | ||
69c6acbb JB |
7166 | * Changes to Scheme functions and syntax |
7167 | ||
2a52b429 MD |
7168 | ** Guile now correctly handles internal defines by rewriting them into |
7169 | their equivalent letrec. Previously, internal defines would | |
7170 | incrementally add to the innermost environment, without checking | |
7171 | whether the restrictions specified in RnRS were met. This lead to the | |
7172 | correct behaviour when these restriction actually were met, but didn't | |
7173 | catch all illegal uses. Such an illegal use could lead to crashes of | |
b3da54d1 | 7174 | the Guile interpreter or other unwanted results. An example of |
2a52b429 MD |
7175 | incorrect internal defines that made Guile behave erratically: |
7176 | ||
7177 | (let () | |
7178 | (define a 1) | |
7179 | (define (b) a) | |
7180 | (define c (1+ (b))) | |
7181 | (define d 3) | |
7182 | ||
7183 | (b)) | |
7184 | ||
7185 | => 2 | |
7186 | ||
7187 | The problem with this example is that the definition of `c' uses the | |
7188 | value of `b' directly. This confuses the meoization machine of Guile | |
7189 | so that the second call of `b' (this time in a larger environment that | |
7190 | also contains bindings for `c' and `d') refers to the binding of `c' | |
7191 | instead of `a'. You could also make Guile crash with a variation on | |
7192 | this theme: | |
7193 | ||
7194 | (define (foo flag) | |
7195 | (define a 1) | |
7196 | (define (b flag) (if flag a 1)) | |
7197 | (define c (1+ (b flag))) | |
7198 | (define d 3) | |
7199 | ||
7200 | (b #t)) | |
7201 | ||
7202 | (foo #f) | |
7203 | (foo #t) | |
7204 | ||
7205 | From now on, Guile will issue an `Unbound variable: b' error message | |
7206 | for both examples. | |
7207 | ||
36d3d540 MD |
7208 | ** Hooks |
7209 | ||
7210 | A hook contains a list of functions which should be called on | |
7211 | particular occasions in an existing program. Hooks are used for | |
7212 | customization. | |
7213 | ||
7214 | A window manager might have a hook before-window-map-hook. The window | |
7215 | manager uses the function run-hooks to call all functions stored in | |
7216 | before-window-map-hook each time a window is mapped. The user can | |
7217 | store functions in the hook using add-hook!. | |
7218 | ||
7219 | In Guile, hooks are first class objects. | |
7220 | ||
7221 | *** New function: make-hook [N_ARGS] | |
7222 | ||
7223 | Return a hook for hook functions which can take N_ARGS arguments. | |
7224 | The default value for N_ARGS is 0. | |
7225 | ||
ad91d6c3 MD |
7226 | (See also scm_make_named_hook below.) |
7227 | ||
36d3d540 MD |
7228 | *** New function: add-hook! HOOK PROC [APPEND_P] |
7229 | ||
7230 | Put PROC at the beginning of the list of functions stored in HOOK. | |
7231 | If APPEND_P is supplied, and non-false, put PROC at the end instead. | |
7232 | ||
7233 | PROC must be able to take the number of arguments specified when the | |
7234 | hook was created. | |
7235 | ||
7236 | If PROC already exists in HOOK, then remove it first. | |
7237 | ||
7238 | *** New function: remove-hook! HOOK PROC | |
7239 | ||
7240 | Remove PROC from the list of functions in HOOK. | |
7241 | ||
7242 | *** New function: reset-hook! HOOK | |
7243 | ||
7244 | Clear the list of hook functions stored in HOOK. | |
7245 | ||
7246 | *** New function: run-hook HOOK ARG1 ... | |
7247 | ||
7248 | Run all hook functions stored in HOOK with arguments ARG1 ... . | |
7249 | The number of arguments supplied must correspond to the number given | |
7250 | when the hook was created. | |
7251 | ||
56a19408 MV |
7252 | ** The function `dynamic-link' now takes optional keyword arguments. |
7253 | The only keyword argument that is currently defined is `:global | |
7254 | BOOL'. With it, you can control whether the shared library will be | |
7255 | linked in global mode or not. In global mode, the symbols from the | |
7256 | linked library can be used to resolve references from other | |
7257 | dynamically linked libraries. In non-global mode, the linked | |
7258 | library is essentially invisible and can only be accessed via | |
7259 | `dynamic-func', etc. The default is now to link in global mode. | |
7260 | Previously, the default has been non-global mode. | |
7261 | ||
7262 | The `#:global' keyword is only effective on platforms that support | |
7263 | the dlopen family of functions. | |
7264 | ||
ad226f25 | 7265 | ** New function `provided?' |
b7e13f65 JB |
7266 | |
7267 | - Function: provided? FEATURE | |
7268 | Return true iff FEATURE is supported by this installation of | |
7269 | Guile. FEATURE must be a symbol naming a feature; the global | |
7270 | variable `*features*' is a list of available features. | |
7271 | ||
ad226f25 JB |
7272 | ** Changes to the module (ice-9 expect): |
7273 | ||
7274 | *** The expect-strings macro now matches `$' in a regular expression | |
7275 | only at a line-break or end-of-file by default. Previously it would | |
ab711359 JB |
7276 | match the end of the string accumulated so far. The old behaviour |
7277 | can be obtained by setting the variable `expect-strings-exec-flags' | |
7278 | to 0. | |
ad226f25 JB |
7279 | |
7280 | *** The expect-strings macro now uses a variable `expect-strings-exec-flags' | |
7281 | for the regexp-exec flags. If `regexp/noteol' is included, then `$' | |
7282 | in a regular expression will still match before a line-break or | |
7283 | end-of-file. The default is `regexp/noteol'. | |
7284 | ||
6c0201ad | 7285 | *** The expect-strings macro now uses a variable |
ad226f25 JB |
7286 | `expect-strings-compile-flags' for the flags to be supplied to |
7287 | `make-regexp'. The default is `regexp/newline', which was previously | |
7288 | hard-coded. | |
7289 | ||
7290 | *** The expect macro now supplies two arguments to a match procedure: | |
ab711359 JB |
7291 | the current accumulated string and a flag to indicate whether |
7292 | end-of-file has been reached. Previously only the string was supplied. | |
7293 | If end-of-file is reached, the match procedure will be called an | |
7294 | additional time with the same accumulated string as the previous call | |
7295 | but with the flag set. | |
ad226f25 | 7296 | |
b7e13f65 JB |
7297 | ** New module (ice-9 format), implementing the Common Lisp `format' function. |
7298 | ||
7299 | This code, and the documentation for it that appears here, was | |
7300 | borrowed from SLIB, with minor adaptations for Guile. | |
7301 | ||
7302 | - Function: format DESTINATION FORMAT-STRING . ARGUMENTS | |
7303 | An almost complete implementation of Common LISP format description | |
7304 | according to the CL reference book `Common LISP' from Guy L. | |
7305 | Steele, Digital Press. Backward compatible to most of the | |
7306 | available Scheme format implementations. | |
7307 | ||
7308 | Returns `#t', `#f' or a string; has side effect of printing | |
7309 | according to FORMAT-STRING. If DESTINATION is `#t', the output is | |
7310 | to the current output port and `#t' is returned. If DESTINATION | |
7311 | is `#f', a formatted string is returned as the result of the call. | |
7312 | NEW: If DESTINATION is a string, DESTINATION is regarded as the | |
7313 | format string; FORMAT-STRING is then the first argument and the | |
7314 | output is returned as a string. If DESTINATION is a number, the | |
7315 | output is to the current error port if available by the | |
7316 | implementation. Otherwise DESTINATION must be an output port and | |
7317 | `#t' is returned. | |
7318 | ||
7319 | FORMAT-STRING must be a string. In case of a formatting error | |
7320 | format returns `#f' and prints a message on the current output or | |
7321 | error port. Characters are output as if the string were output by | |
7322 | the `display' function with the exception of those prefixed by a | |
7323 | tilde (~). For a detailed description of the FORMAT-STRING syntax | |
7324 | please consult a Common LISP format reference manual. For a test | |
7325 | suite to verify this format implementation load `formatst.scm'. | |
7326 | Please send bug reports to `lutzeb@cs.tu-berlin.de'. | |
7327 | ||
7328 | Note: `format' is not reentrant, i.e. only one `format'-call may | |
7329 | be executed at a time. | |
7330 | ||
7331 | ||
7332 | *** Format Specification (Format version 3.0) | |
7333 | ||
7334 | Please consult a Common LISP format reference manual for a detailed | |
7335 | description of the format string syntax. For a demonstration of the | |
7336 | implemented directives see `formatst.scm'. | |
7337 | ||
7338 | This implementation supports directive parameters and modifiers (`:' | |
7339 | and `@' characters). Multiple parameters must be separated by a comma | |
7340 | (`,'). Parameters can be numerical parameters (positive or negative), | |
7341 | character parameters (prefixed by a quote character (`''), variable | |
7342 | parameters (`v'), number of rest arguments parameter (`#'), empty and | |
7343 | default parameters. Directive characters are case independent. The | |
7344 | general form of a directive is: | |
7345 | ||
7346 | DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER | |
7347 | ||
7348 | DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ] | |
7349 | ||
7350 | *** Implemented CL Format Control Directives | |
7351 | ||
7352 | Documentation syntax: Uppercase characters represent the | |
7353 | corresponding control directive characters. Lowercase characters | |
7354 | represent control directive parameter descriptions. | |
7355 | ||
7356 | `~A' | |
7357 | Any (print as `display' does). | |
7358 | `~@A' | |
7359 | left pad. | |
7360 | ||
7361 | `~MINCOL,COLINC,MINPAD,PADCHARA' | |
7362 | full padding. | |
7363 | ||
7364 | `~S' | |
7365 | S-expression (print as `write' does). | |
7366 | `~@S' | |
7367 | left pad. | |
7368 | ||
7369 | `~MINCOL,COLINC,MINPAD,PADCHARS' | |
7370 | full padding. | |
7371 | ||
7372 | `~D' | |
7373 | Decimal. | |
7374 | `~@D' | |
7375 | print number sign always. | |
7376 | ||
7377 | `~:D' | |
7378 | print comma separated. | |
7379 | ||
7380 | `~MINCOL,PADCHAR,COMMACHARD' | |
7381 | padding. | |
7382 | ||
7383 | `~X' | |
7384 | Hexadecimal. | |
7385 | `~@X' | |
7386 | print number sign always. | |
7387 | ||
7388 | `~:X' | |
7389 | print comma separated. | |
7390 | ||
7391 | `~MINCOL,PADCHAR,COMMACHARX' | |
7392 | padding. | |
7393 | ||
7394 | `~O' | |
7395 | Octal. | |
7396 | `~@O' | |
7397 | print number sign always. | |
7398 | ||
7399 | `~:O' | |
7400 | print comma separated. | |
7401 | ||
7402 | `~MINCOL,PADCHAR,COMMACHARO' | |
7403 | padding. | |
7404 | ||
7405 | `~B' | |
7406 | Binary. | |
7407 | `~@B' | |
7408 | print number sign always. | |
7409 | ||
7410 | `~:B' | |
7411 | print comma separated. | |
7412 | ||
7413 | `~MINCOL,PADCHAR,COMMACHARB' | |
7414 | padding. | |
7415 | ||
7416 | `~NR' | |
7417 | Radix N. | |
7418 | `~N,MINCOL,PADCHAR,COMMACHARR' | |
7419 | padding. | |
7420 | ||
7421 | `~@R' | |
7422 | print a number as a Roman numeral. | |
7423 | ||
7424 | `~:@R' | |
7425 | print a number as an "old fashioned" Roman numeral. | |
7426 | ||
7427 | `~:R' | |
7428 | print a number as an ordinal English number. | |
7429 | ||
7430 | `~:@R' | |
7431 | print a number as a cardinal English number. | |
7432 | ||
7433 | `~P' | |
7434 | Plural. | |
7435 | `~@P' | |
7436 | prints `y' and `ies'. | |
7437 | ||
7438 | `~:P' | |
7439 | as `~P but jumps 1 argument backward.' | |
7440 | ||
7441 | `~:@P' | |
7442 | as `~@P but jumps 1 argument backward.' | |
7443 | ||
7444 | `~C' | |
7445 | Character. | |
7446 | `~@C' | |
7447 | prints a character as the reader can understand it (i.e. `#\' | |
7448 | prefixing). | |
7449 | ||
7450 | `~:C' | |
7451 | prints a character as emacs does (eg. `^C' for ASCII 03). | |
7452 | ||
7453 | `~F' | |
7454 | Fixed-format floating-point (prints a flonum like MMM.NNN). | |
7455 | `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF' | |
7456 | `~@F' | |
7457 | If the number is positive a plus sign is printed. | |
7458 | ||
7459 | `~E' | |
7460 | Exponential floating-point (prints a flonum like MMM.NNN`E'EE). | |
7461 | `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE' | |
7462 | `~@E' | |
7463 | If the number is positive a plus sign is printed. | |
7464 | ||
7465 | `~G' | |
7466 | General floating-point (prints a flonum either fixed or | |
7467 | exponential). | |
7468 | `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG' | |
7469 | `~@G' | |
7470 | If the number is positive a plus sign is printed. | |
7471 | ||
7472 | `~$' | |
7473 | Dollars floating-point (prints a flonum in fixed with signs | |
7474 | separated). | |
7475 | `~DIGITS,SCALE,WIDTH,PADCHAR$' | |
7476 | `~@$' | |
7477 | If the number is positive a plus sign is printed. | |
7478 | ||
7479 | `~:@$' | |
7480 | A sign is always printed and appears before the padding. | |
7481 | ||
7482 | `~:$' | |
7483 | The sign appears before the padding. | |
7484 | ||
7485 | `~%' | |
7486 | Newline. | |
7487 | `~N%' | |
7488 | print N newlines. | |
7489 | ||
7490 | `~&' | |
7491 | print newline if not at the beginning of the output line. | |
7492 | `~N&' | |
7493 | prints `~&' and then N-1 newlines. | |
7494 | ||
7495 | `~|' | |
7496 | Page Separator. | |
7497 | `~N|' | |
7498 | print N page separators. | |
7499 | ||
7500 | `~~' | |
7501 | Tilde. | |
7502 | `~N~' | |
7503 | print N tildes. | |
7504 | ||
7505 | `~'<newline> | |
7506 | Continuation Line. | |
7507 | `~:'<newline> | |
7508 | newline is ignored, white space left. | |
7509 | ||
7510 | `~@'<newline> | |
7511 | newline is left, white space ignored. | |
7512 | ||
7513 | `~T' | |
7514 | Tabulation. | |
7515 | `~@T' | |
7516 | relative tabulation. | |
7517 | ||
7518 | `~COLNUM,COLINCT' | |
7519 | full tabulation. | |
7520 | ||
7521 | `~?' | |
7522 | Indirection (expects indirect arguments as a list). | |
7523 | `~@?' | |
7524 | extracts indirect arguments from format arguments. | |
7525 | ||
7526 | `~(STR~)' | |
7527 | Case conversion (converts by `string-downcase'). | |
7528 | `~:(STR~)' | |
7529 | converts by `string-capitalize'. | |
7530 | ||
7531 | `~@(STR~)' | |
7532 | converts by `string-capitalize-first'. | |
7533 | ||
7534 | `~:@(STR~)' | |
7535 | converts by `string-upcase'. | |
7536 | ||
7537 | `~*' | |
7538 | Argument Jumping (jumps 1 argument forward). | |
7539 | `~N*' | |
7540 | jumps N arguments forward. | |
7541 | ||
7542 | `~:*' | |
7543 | jumps 1 argument backward. | |
7544 | ||
7545 | `~N:*' | |
7546 | jumps N arguments backward. | |
7547 | ||
7548 | `~@*' | |
7549 | jumps to the 0th argument. | |
7550 | ||
7551 | `~N@*' | |
7552 | jumps to the Nth argument (beginning from 0) | |
7553 | ||
7554 | `~[STR0~;STR1~;...~;STRN~]' | |
7555 | Conditional Expression (numerical clause conditional). | |
7556 | `~N[' | |
7557 | take argument from N. | |
7558 | ||
7559 | `~@[' | |
7560 | true test conditional. | |
7561 | ||
7562 | `~:[' | |
7563 | if-else-then conditional. | |
7564 | ||
7565 | `~;' | |
7566 | clause separator. | |
7567 | ||
7568 | `~:;' | |
7569 | default clause follows. | |
7570 | ||
7571 | `~{STR~}' | |
7572 | Iteration (args come from the next argument (a list)). | |
7573 | `~N{' | |
7574 | at most N iterations. | |
7575 | ||
7576 | `~:{' | |
7577 | args from next arg (a list of lists). | |
7578 | ||
7579 | `~@{' | |
7580 | args from the rest of arguments. | |
7581 | ||
7582 | `~:@{' | |
7583 | args from the rest args (lists). | |
7584 | ||
7585 | `~^' | |
7586 | Up and out. | |
7587 | `~N^' | |
7588 | aborts if N = 0 | |
7589 | ||
7590 | `~N,M^' | |
7591 | aborts if N = M | |
7592 | ||
7593 | `~N,M,K^' | |
7594 | aborts if N <= M <= K | |
7595 | ||
7596 | *** Not Implemented CL Format Control Directives | |
7597 | ||
7598 | `~:A' | |
7599 | print `#f' as an empty list (see below). | |
7600 | ||
7601 | `~:S' | |
7602 | print `#f' as an empty list (see below). | |
7603 | ||
7604 | `~<~>' | |
7605 | Justification. | |
7606 | ||
7607 | `~:^' | |
7608 | (sorry I don't understand its semantics completely) | |
7609 | ||
7610 | *** Extended, Replaced and Additional Control Directives | |
7611 | ||
7612 | `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD' | |
7613 | `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX' | |
7614 | `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO' | |
7615 | `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB' | |
7616 | `~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR' | |
7617 | COMMAWIDTH is the number of characters between two comma | |
7618 | characters. | |
7619 | ||
7620 | `~I' | |
7621 | print a R4RS complex number as `~F~@Fi' with passed parameters for | |
7622 | `~F'. | |
7623 | ||
7624 | `~Y' | |
7625 | Pretty print formatting of an argument for scheme code lists. | |
7626 | ||
7627 | `~K' | |
7628 | Same as `~?.' | |
7629 | ||
7630 | `~!' | |
7631 | Flushes the output if format DESTINATION is a port. | |
7632 | ||
7633 | `~_' | |
7634 | Print a `#\space' character | |
7635 | `~N_' | |
7636 | print N `#\space' characters. | |
7637 | ||
7638 | `~/' | |
7639 | Print a `#\tab' character | |
7640 | `~N/' | |
7641 | print N `#\tab' characters. | |
7642 | ||
7643 | `~NC' | |
7644 | Takes N as an integer representation for a character. No arguments | |
7645 | are consumed. N is converted to a character by `integer->char'. N | |
7646 | must be a positive decimal number. | |
7647 | ||
7648 | `~:S' | |
7649 | Print out readproof. Prints out internal objects represented as | |
7650 | `#<...>' as strings `"#<...>"' so that the format output can always | |
7651 | be processed by `read'. | |
7652 | ||
7653 | `~:A' | |
7654 | Print out readproof. Prints out internal objects represented as | |
7655 | `#<...>' as strings `"#<...>"' so that the format output can always | |
7656 | be processed by `read'. | |
7657 | ||
7658 | `~Q' | |
7659 | Prints information and a copyright notice on the format | |
7660 | implementation. | |
7661 | `~:Q' | |
7662 | prints format version. | |
7663 | ||
7664 | `~F, ~E, ~G, ~$' | |
7665 | may also print number strings, i.e. passing a number as a string | |
7666 | and format it accordingly. | |
7667 | ||
7668 | *** Configuration Variables | |
7669 | ||
7670 | The format module exports some configuration variables to suit the | |
7671 | systems and users needs. There should be no modification necessary for | |
7672 | the configuration that comes with Guile. Format detects automatically | |
7673 | if the running scheme system implements floating point numbers and | |
7674 | complex numbers. | |
7675 | ||
7676 | format:symbol-case-conv | |
7677 | Symbols are converted by `symbol->string' so the case type of the | |
7678 | printed symbols is implementation dependent. | |
7679 | `format:symbol-case-conv' is a one arg closure which is either | |
7680 | `#f' (no conversion), `string-upcase', `string-downcase' or | |
7681 | `string-capitalize'. (default `#f') | |
7682 | ||
7683 | format:iobj-case-conv | |
7684 | As FORMAT:SYMBOL-CASE-CONV but applies for the representation of | |
7685 | implementation internal objects. (default `#f') | |
7686 | ||
7687 | format:expch | |
7688 | The character prefixing the exponent value in `~E' printing. | |
7689 | (default `#\E') | |
7690 | ||
7691 | *** Compatibility With Other Format Implementations | |
7692 | ||
7693 | SLIB format 2.x: | |
7694 | See `format.doc'. | |
7695 | ||
7696 | SLIB format 1.4: | |
7697 | Downward compatible except for padding support and `~A', `~S', | |
7698 | `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style | |
7699 | `printf' padding support which is completely replaced by the CL | |
7700 | `format' padding style. | |
7701 | ||
7702 | MIT C-Scheme 7.1: | |
7703 | Downward compatible except for `~', which is not documented | |
7704 | (ignores all characters inside the format string up to a newline | |
7705 | character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%', | |
7706 | numerical and variable parameters and `:/@' modifiers in the CL | |
7707 | sense). | |
7708 | ||
7709 | Elk 1.5/2.0: | |
7710 | Downward compatible except for `~A' and `~S' which print in | |
7711 | uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no | |
7712 | directive parameters or modifiers)). | |
7713 | ||
7714 | Scheme->C 01nov91: | |
7715 | Downward compatible except for an optional destination parameter: | |
7716 | S2C accepts a format call without a destination which returns a | |
7717 | formatted string. This is equivalent to a #f destination in S2C. | |
7718 | (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive | |
7719 | parameters or modifiers)). | |
7720 | ||
7721 | ||
e7d37b0a | 7722 | ** Changes to string-handling functions. |
b7e13f65 | 7723 | |
e7d37b0a | 7724 | These functions were added to support the (ice-9 format) module, above. |
b7e13f65 | 7725 | |
e7d37b0a JB |
7726 | *** New function: string-upcase STRING |
7727 | *** New function: string-downcase STRING | |
b7e13f65 | 7728 | |
e7d37b0a JB |
7729 | These are non-destructive versions of the existing string-upcase! and |
7730 | string-downcase! functions. | |
b7e13f65 | 7731 | |
e7d37b0a JB |
7732 | *** New function: string-capitalize! STRING |
7733 | *** New function: string-capitalize STRING | |
7734 | ||
7735 | These functions convert the first letter of each word in the string to | |
7736 | upper case. Thus: | |
7737 | ||
7738 | (string-capitalize "howdy there") | |
7739 | => "Howdy There" | |
7740 | ||
7741 | As with the other functions, string-capitalize! modifies the string in | |
7742 | place, while string-capitalize returns a modified copy of its argument. | |
7743 | ||
7744 | *** New function: string-ci->symbol STRING | |
7745 | ||
7746 | Return a symbol whose name is STRING, but having the same case as if | |
7747 | the symbol had be read by `read'. | |
7748 | ||
7749 | Guile can be configured to be sensitive or insensitive to case | |
7750 | differences in Scheme identifiers. If Guile is case-insensitive, all | |
7751 | symbols are converted to lower case on input. The `string-ci->symbol' | |
7752 | function returns a symbol whose name in STRING, transformed as Guile | |
7753 | would if STRING were input. | |
7754 | ||
7755 | *** New function: substring-move! STRING1 START END STRING2 START | |
7756 | ||
7757 | Copy the substring of STRING1 from START (inclusive) to END | |
7758 | (exclusive) to STRING2 at START. STRING1 and STRING2 may be the same | |
7759 | string, and the source and destination areas may overlap; in all | |
7760 | cases, the function behaves as if all the characters were copied | |
7761 | simultanously. | |
7762 | ||
6c0201ad | 7763 | *** Extended functions: substring-move-left! substring-move-right! |
e7d37b0a JB |
7764 | |
7765 | These functions now correctly copy arbitrarily overlapping substrings; | |
7766 | they are both synonyms for substring-move!. | |
b7e13f65 | 7767 | |
b7e13f65 | 7768 | |
deaceb4e JB |
7769 | ** New module (ice-9 getopt-long), with the function `getopt-long'. |
7770 | ||
7771 | getopt-long is a function for parsing command-line arguments in a | |
7772 | manner consistent with other GNU programs. | |
7773 | ||
7774 | (getopt-long ARGS GRAMMAR) | |
7775 | Parse the arguments ARGS according to the argument list grammar GRAMMAR. | |
7776 | ||
7777 | ARGS should be a list of strings. Its first element should be the | |
7778 | name of the program; subsequent elements should be the arguments | |
7779 | that were passed to the program on the command line. The | |
7780 | `program-arguments' procedure returns a list of this form. | |
7781 | ||
7782 | GRAMMAR is a list of the form: | |
7783 | ((OPTION (PROPERTY VALUE) ...) ...) | |
7784 | ||
7785 | Each OPTION should be a symbol. `getopt-long' will accept a | |
7786 | command-line option named `--OPTION'. | |
7787 | Each option can have the following (PROPERTY VALUE) pairs: | |
7788 | ||
7789 | (single-char CHAR) --- Accept `-CHAR' as a single-character | |
7790 | equivalent to `--OPTION'. This is how to specify traditional | |
7791 | Unix-style flags. | |
7792 | (required? BOOL) --- If BOOL is true, the option is required. | |
7793 | getopt-long will raise an error if it is not found in ARGS. | |
7794 | (value BOOL) --- If BOOL is #t, the option accepts a value; if | |
7795 | it is #f, it does not; and if it is the symbol | |
7796 | `optional', the option may appear in ARGS with or | |
6c0201ad | 7797 | without a value. |
deaceb4e JB |
7798 | (predicate FUNC) --- If the option accepts a value (i.e. you |
7799 | specified `(value #t)' for this option), then getopt | |
7800 | will apply FUNC to the value, and throw an exception | |
7801 | if it returns #f. FUNC should be a procedure which | |
7802 | accepts a string and returns a boolean value; you may | |
7803 | need to use quasiquotes to get it into GRAMMAR. | |
7804 | ||
7805 | The (PROPERTY VALUE) pairs may occur in any order, but each | |
7806 | property may occur only once. By default, options do not have | |
7807 | single-character equivalents, are not required, and do not take | |
7808 | values. | |
7809 | ||
7810 | In ARGS, single-character options may be combined, in the usual | |
7811 | Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option | |
7812 | accepts values, then it must be the last option in the | |
7813 | combination; the value is the next argument. So, for example, using | |
7814 | the following grammar: | |
7815 | ((apples (single-char #\a)) | |
7816 | (blimps (single-char #\b) (value #t)) | |
7817 | (catalexis (single-char #\c) (value #t))) | |
7818 | the following argument lists would be acceptable: | |
7819 | ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values | |
7820 | for "blimps" and "catalexis") | |
7821 | ("-ab" "bang" "-c" "couth") (same) | |
7822 | ("-ac" "couth" "-b" "bang") (same) | |
7823 | ("-abc" "couth" "bang") (an error, since `-b' is not the | |
7824 | last option in its combination) | |
7825 | ||
7826 | If an option's value is optional, then `getopt-long' decides | |
7827 | whether it has a value by looking at what follows it in ARGS. If | |
7828 | the next element is a string, and it does not appear to be an | |
7829 | option itself, then that string is the option's value. | |
7830 | ||
7831 | The value of a long option can appear as the next element in ARGS, | |
7832 | or it can follow the option name, separated by an `=' character. | |
7833 | Thus, using the same grammar as above, the following argument lists | |
7834 | are equivalent: | |
7835 | ("--apples" "Braeburn" "--blimps" "Goodyear") | |
7836 | ("--apples=Braeburn" "--blimps" "Goodyear") | |
7837 | ("--blimps" "Goodyear" "--apples=Braeburn") | |
7838 | ||
7839 | If the option "--" appears in ARGS, argument parsing stops there; | |
7840 | subsequent arguments are returned as ordinary arguments, even if | |
7841 | they resemble options. So, in the argument list: | |
7842 | ("--apples" "Granny Smith" "--" "--blimp" "Goodyear") | |
7843 | `getopt-long' will recognize the `apples' option as having the | |
7844 | value "Granny Smith", but it will not recognize the `blimp' | |
7845 | option; it will return the strings "--blimp" and "Goodyear" as | |
7846 | ordinary argument strings. | |
7847 | ||
7848 | The `getopt-long' function returns the parsed argument list as an | |
7849 | assocation list, mapping option names --- the symbols from GRAMMAR | |
7850 | --- onto their values, or #t if the option does not accept a value. | |
7851 | Unused options do not appear in the alist. | |
7852 | ||
7853 | All arguments that are not the value of any option are returned | |
7854 | as a list, associated with the empty list. | |
7855 | ||
7856 | `getopt-long' throws an exception if: | |
7857 | - it finds an unrecognized option in ARGS | |
7858 | - a required option is omitted | |
7859 | - an option that requires an argument doesn't get one | |
7860 | - an option that doesn't accept an argument does get one (this can | |
7861 | only happen using the long option `--opt=value' syntax) | |
7862 | - an option predicate fails | |
7863 | ||
7864 | So, for example: | |
7865 | ||
7866 | (define grammar | |
7867 | `((lockfile-dir (required? #t) | |
7868 | (value #t) | |
7869 | (single-char #\k) | |
7870 | (predicate ,file-is-directory?)) | |
7871 | (verbose (required? #f) | |
7872 | (single-char #\v) | |
7873 | (value #f)) | |
7874 | (x-includes (single-char #\x)) | |
6c0201ad | 7875 | (rnet-server (single-char #\y) |
deaceb4e JB |
7876 | (predicate ,string?)))) |
7877 | ||
6c0201ad | 7878 | (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include" |
deaceb4e JB |
7879 | "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3") |
7880 | grammar) | |
7881 | => ((() "foo1" "-fred" "foo2" "foo3") | |
7882 | (rnet-server . "lamprod") | |
7883 | (x-includes . "/usr/include") | |
7884 | (lockfile-dir . "/tmp") | |
7885 | (verbose . #t)) | |
7886 | ||
7887 | ** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long). | |
7888 | ||
7889 | It will be removed in a few releases. | |
7890 | ||
08394899 MS |
7891 | ** New syntax: lambda* |
7892 | ** New syntax: define* | |
6c0201ad | 7893 | ** New syntax: define*-public |
08394899 MS |
7894 | ** New syntax: defmacro* |
7895 | ** New syntax: defmacro*-public | |
6c0201ad | 7896 | Guile now supports optional arguments. |
08394899 MS |
7897 | |
7898 | `lambda*', `define*', `define*-public', `defmacro*' and | |
7899 | `defmacro*-public' are identical to the non-* versions except that | |
7900 | they use an extended type of parameter list that has the following BNF | |
7901 | syntax (parentheses are literal, square brackets indicate grouping, | |
7902 | and `*', `+' and `?' have the usual meaning): | |
7903 | ||
7904 | ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]? | |
6c0201ad | 7905 | [#&key [ext-var-decl]+ [#&allow-other-keys]?]? |
08394899 MS |
7906 | [[#&rest identifier]|[. identifier]]? ) | [identifier] |
7907 | ||
6c0201ad | 7908 | ext-var-decl ::= identifier | ( identifier expression ) |
08394899 MS |
7909 | |
7910 | The semantics are best illustrated with the following documentation | |
7911 | and examples for `lambda*': | |
7912 | ||
7913 | lambda* args . body | |
7914 | lambda extended for optional and keyword arguments | |
6c0201ad | 7915 | |
08394899 MS |
7916 | lambda* creates a procedure that takes optional arguments. These |
7917 | are specified by putting them inside brackets at the end of the | |
7918 | paramater list, but before any dotted rest argument. For example, | |
7919 | (lambda* (a b #&optional c d . e) '()) | |
7920 | creates a procedure with fixed arguments a and b, optional arguments c | |
7921 | and d, and rest argument e. If the optional arguments are omitted | |
7922 | in a call, the variables for them are unbound in the procedure. This | |
7923 | can be checked with the bound? macro. | |
7924 | ||
7925 | lambda* can also take keyword arguments. For example, a procedure | |
7926 | defined like this: | |
7927 | (lambda* (#&key xyzzy larch) '()) | |
7928 | can be called with any of the argument lists (#:xyzzy 11) | |
7929 | (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments | |
7930 | are given as keywords are bound to values. | |
7931 | ||
7932 | Optional and keyword arguments can also be given default values | |
7933 | which they take on when they are not present in a call, by giving a | |
7934 | two-item list in place of an optional argument, for example in: | |
6c0201ad | 7935 | (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz)) |
08394899 MS |
7936 | foo is a fixed argument, bar is an optional argument with default |
7937 | value 42, and baz is a keyword argument with default value 73. | |
7938 | Default value expressions are not evaluated unless they are needed | |
6c0201ad | 7939 | and until the procedure is called. |
08394899 MS |
7940 | |
7941 | lambda* now supports two more special parameter list keywords. | |
7942 | ||
7943 | lambda*-defined procedures now throw an error by default if a | |
7944 | keyword other than one of those specified is found in the actual | |
7945 | passed arguments. However, specifying #&allow-other-keys | |
7946 | immediately after the kyword argument declarations restores the | |
7947 | previous behavior of ignoring unknown keywords. lambda* also now | |
7948 | guarantees that if the same keyword is passed more than once, the | |
7949 | last one passed is the one that takes effect. For example, | |
7950 | ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails))) | |
7951 | #:heads 37 #:tails 42 #:heads 99) | |
7952 | would result in (99 47) being displayed. | |
7953 | ||
7954 | #&rest is also now provided as a synonym for the dotted syntax rest | |
7955 | argument. The argument lists (a . b) and (a #&rest b) are equivalent in | |
7956 | all respects to lambda*. This is provided for more similarity to DSSSL, | |
7957 | MIT-Scheme and Kawa among others, as well as for refugees from other | |
7958 | Lisp dialects. | |
7959 | ||
7960 | Further documentation may be found in the optargs.scm file itself. | |
7961 | ||
7962 | The optional argument module also exports the macros `let-optional', | |
7963 | `let-optional*', `let-keywords', `let-keywords*' and `bound?'. These | |
7964 | are not documented here because they may be removed in the future, but | |
7965 | full documentation is still available in optargs.scm. | |
7966 | ||
2e132553 JB |
7967 | ** New syntax: and-let* |
7968 | Guile now supports the `and-let*' form, described in the draft SRFI-2. | |
7969 | ||
7970 | Syntax: (land* (<clause> ...) <body> ...) | |
7971 | Each <clause> should have one of the following forms: | |
7972 | (<variable> <expression>) | |
7973 | (<expression>) | |
7974 | <bound-variable> | |
7975 | Each <variable> or <bound-variable> should be an identifier. Each | |
7976 | <expression> should be a valid expression. The <body> should be a | |
7977 | possibly empty sequence of expressions, like the <body> of a | |
7978 | lambda form. | |
7979 | ||
7980 | Semantics: A LAND* expression is evaluated by evaluating the | |
7981 | <expression> or <bound-variable> of each of the <clause>s from | |
7982 | left to right. The value of the first <expression> or | |
7983 | <bound-variable> that evaluates to a false value is returned; the | |
7984 | remaining <expression>s and <bound-variable>s are not evaluated. | |
7985 | The <body> forms are evaluated iff all the <expression>s and | |
7986 | <bound-variable>s evaluate to true values. | |
7987 | ||
7988 | The <expression>s and the <body> are evaluated in an environment | |
7989 | binding each <variable> of the preceding (<variable> <expression>) | |
7990 | clauses to the value of the <expression>. Later bindings | |
7991 | shadow earlier bindings. | |
7992 | ||
7993 | Guile's and-let* macro was contributed by Michael Livshin. | |
7994 | ||
36d3d540 MD |
7995 | ** New sorting functions |
7996 | ||
7997 | *** New function: sorted? SEQUENCE LESS? | |
ed8c8636 MD |
7998 | Returns `#t' when the sequence argument is in non-decreasing order |
7999 | according to LESS? (that is, there is no adjacent pair `... x y | |
8000 | ...' for which `(less? y x)'). | |
8001 | ||
8002 | Returns `#f' when the sequence contains at least one out-of-order | |
8003 | pair. It is an error if the sequence is neither a list nor a | |
8004 | vector. | |
8005 | ||
36d3d540 | 8006 | *** New function: merge LIST1 LIST2 LESS? |
ed8c8636 MD |
8007 | LIST1 and LIST2 are sorted lists. |
8008 | Returns the sorted list of all elements in LIST1 and LIST2. | |
8009 | ||
8010 | Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal" | |
8011 | in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2}, | |
8012 | and that a < b1 in LIST1. Then a < b1 < b2 in the result. | |
8013 | (Here "<" should read "comes before".) | |
8014 | ||
36d3d540 | 8015 | *** New procedure: merge! LIST1 LIST2 LESS? |
ed8c8636 MD |
8016 | Merges two lists, re-using the pairs of LIST1 and LIST2 to build |
8017 | the result. If the code is compiled, and LESS? constructs no new | |
8018 | pairs, no pairs at all will be allocated. The first pair of the | |
8019 | result will be either the first pair of LIST1 or the first pair of | |
8020 | LIST2. | |
8021 | ||
36d3d540 | 8022 | *** New function: sort SEQUENCE LESS? |
ed8c8636 MD |
8023 | Accepts either a list or a vector, and returns a new sequence |
8024 | which is sorted. The new sequence is the same type as the input. | |
8025 | Always `(sorted? (sort sequence less?) less?)'. The original | |
8026 | sequence is not altered in any way. The new sequence shares its | |
8027 | elements with the old one; no elements are copied. | |
8028 | ||
36d3d540 | 8029 | *** New procedure: sort! SEQUENCE LESS |
ed8c8636 MD |
8030 | Returns its sorted result in the original boxes. No new storage is |
8031 | allocated at all. Proper usage: (set! slist (sort! slist <)) | |
8032 | ||
36d3d540 | 8033 | *** New function: stable-sort SEQUENCE LESS? |
ed8c8636 MD |
8034 | Similar to `sort' but stable. That is, if "equal" elements are |
8035 | ordered a < b in the original sequence, they will have the same order | |
8036 | in the result. | |
8037 | ||
36d3d540 | 8038 | *** New function: stable-sort! SEQUENCE LESS? |
ed8c8636 MD |
8039 | Similar to `sort!' but stable. |
8040 | Uses temporary storage when sorting vectors. | |
8041 | ||
36d3d540 | 8042 | *** New functions: sort-list, sort-list! |
ed8c8636 MD |
8043 | Added for compatibility with scsh. |
8044 | ||
36d3d540 MD |
8045 | ** New built-in random number support |
8046 | ||
8047 | *** New function: random N [STATE] | |
3e8370c3 MD |
8048 | Accepts a positive integer or real N and returns a number of the |
8049 | same type between zero (inclusive) and N (exclusive). The values | |
8050 | returned have a uniform distribution. | |
8051 | ||
8052 | The optional argument STATE must be of the type produced by | |
416075f1 MD |
8053 | `copy-random-state' or `seed->random-state'. It defaults to the value |
8054 | of the variable `*random-state*'. This object is used to maintain the | |
8055 | state of the pseudo-random-number generator and is altered as a side | |
8056 | effect of the `random' operation. | |
3e8370c3 | 8057 | |
36d3d540 | 8058 | *** New variable: *random-state* |
3e8370c3 MD |
8059 | Holds a data structure that encodes the internal state of the |
8060 | random-number generator that `random' uses by default. The nature | |
8061 | of this data structure is implementation-dependent. It may be | |
8062 | printed out and successfully read back in, but may or may not | |
8063 | function correctly as a random-number state object in another | |
8064 | implementation. | |
8065 | ||
36d3d540 | 8066 | *** New function: copy-random-state [STATE] |
3e8370c3 MD |
8067 | Returns a new object of type suitable for use as the value of the |
8068 | variable `*random-state*' and as a second argument to `random'. | |
8069 | If argument STATE is given, a copy of it is returned. Otherwise a | |
8070 | copy of `*random-state*' is returned. | |
416075f1 | 8071 | |
36d3d540 | 8072 | *** New function: seed->random-state SEED |
416075f1 MD |
8073 | Returns a new object of type suitable for use as the value of the |
8074 | variable `*random-state*' and as a second argument to `random'. | |
8075 | SEED is a string or a number. A new state is generated and | |
8076 | initialized using SEED. | |
3e8370c3 | 8077 | |
36d3d540 | 8078 | *** New function: random:uniform [STATE] |
3e8370c3 MD |
8079 | Returns an uniformly distributed inexact real random number in the |
8080 | range between 0 and 1. | |
8081 | ||
36d3d540 | 8082 | *** New procedure: random:solid-sphere! VECT [STATE] |
3e8370c3 MD |
8083 | Fills VECT with inexact real random numbers the sum of whose |
8084 | squares is less than 1.0. Thinking of VECT as coordinates in | |
8085 | space of dimension N = `(vector-length VECT)', the coordinates are | |
8086 | uniformly distributed within the unit N-shere. The sum of the | |
8087 | squares of the numbers is returned. VECT can be either a vector | |
8088 | or a uniform vector of doubles. | |
8089 | ||
36d3d540 | 8090 | *** New procedure: random:hollow-sphere! VECT [STATE] |
3e8370c3 MD |
8091 | Fills VECT with inexact real random numbers the sum of whose squares |
8092 | is equal to 1.0. Thinking of VECT as coordinates in space of | |
8093 | dimension n = `(vector-length VECT)', the coordinates are uniformly | |
8094 | distributed over the surface of the unit n-shere. VECT can be either | |
8095 | a vector or a uniform vector of doubles. | |
8096 | ||
36d3d540 | 8097 | *** New function: random:normal [STATE] |
3e8370c3 MD |
8098 | Returns an inexact real in a normal distribution with mean 0 and |
8099 | standard deviation 1. For a normal distribution with mean M and | |
8100 | standard deviation D use `(+ M (* D (random:normal)))'. | |
8101 | ||
36d3d540 | 8102 | *** New procedure: random:normal-vector! VECT [STATE] |
3e8370c3 MD |
8103 | Fills VECT with inexact real random numbers which are independent and |
8104 | standard normally distributed (i.e., with mean 0 and variance 1). | |
8105 | VECT can be either a vector or a uniform vector of doubles. | |
8106 | ||
36d3d540 | 8107 | *** New function: random:exp STATE |
3e8370c3 MD |
8108 | Returns an inexact real in an exponential distribution with mean 1. |
8109 | For an exponential distribution with mean U use (* U (random:exp)). | |
8110 | ||
69c6acbb JB |
8111 | ** The range of logand, logior, logxor, logtest, and logbit? have changed. |
8112 | ||
8113 | These functions now operate on numbers in the range of a C unsigned | |
8114 | long. | |
8115 | ||
8116 | These functions used to operate on numbers in the range of a C signed | |
8117 | long; however, this seems inappropriate, because Guile integers don't | |
8118 | overflow. | |
8119 | ||
ba4ee0d6 MD |
8120 | ** New function: make-guardian |
8121 | This is an implementation of guardians as described in | |
8122 | R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a | |
8123 | Generation-Based Garbage Collector" ACM SIGPLAN Conference on | |
8124 | Programming Language Design and Implementation, June 1993 | |
8125 | ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz | |
8126 | ||
88ceea5c MD |
8127 | ** New functions: delq1!, delv1!, delete1! |
8128 | These procedures behave similar to delq! and friends but delete only | |
8129 | one object if at all. | |
8130 | ||
55254a6a MD |
8131 | ** New function: unread-string STRING PORT |
8132 | Unread STRING to PORT, that is, push it back onto the port so that | |
8133 | next read operation will work on the pushed back characters. | |
8134 | ||
8135 | ** unread-char can now be called multiple times | |
8136 | If unread-char is called multiple times, the unread characters will be | |
8137 | read again in last-in first-out order. | |
8138 | ||
9e97c52d GH |
8139 | ** the procedures uniform-array-read! and uniform-array-write! now |
8140 | work on any kind of port, not just ports which are open on a file. | |
8141 | ||
b074884f | 8142 | ** Now 'l' in a port mode requests line buffering. |
9e97c52d | 8143 | |
69bc9ff3 GH |
8144 | ** The procedure truncate-file now works on string ports as well |
8145 | as file ports. If the size argument is omitted, the current | |
1b9c3dae | 8146 | file position is used. |
9e97c52d | 8147 | |
c94577b4 | 8148 | ** new procedure: seek PORT/FDES OFFSET WHENCE |
9e97c52d GH |
8149 | The arguments are the same as for the old fseek procedure, but it |
8150 | works on string ports as well as random-access file ports. | |
8151 | ||
8152 | ** the fseek procedure now works on string ports, since it has been | |
c94577b4 | 8153 | redefined using seek. |
9e97c52d GH |
8154 | |
8155 | ** the setvbuf procedure now uses a default size if mode is _IOFBF and | |
8156 | size is not supplied. | |
8157 | ||
8158 | ** the newline procedure no longer flushes the port if it's not | |
8159 | line-buffered: previously it did if it was the current output port. | |
8160 | ||
8161 | ** open-pipe and close-pipe are no longer primitive procedures, but | |
8162 | an emulation can be obtained using `(use-modules (ice-9 popen))'. | |
8163 | ||
8164 | ** the freopen procedure has been removed. | |
8165 | ||
8166 | ** new procedure: drain-input PORT | |
8167 | Drains PORT's read buffers (including any pushed-back characters) | |
8168 | and returns the contents as a single string. | |
8169 | ||
67ad463a | 8170 | ** New function: map-in-order PROC LIST1 LIST2 ... |
d41b3904 MD |
8171 | Version of `map' which guarantees that the procedure is applied to the |
8172 | lists in serial order. | |
8173 | ||
67ad463a MD |
8174 | ** Renamed `serial-array-copy!' and `serial-array-map!' to |
8175 | `array-copy-in-order!' and `array-map-in-order!'. The old names are | |
8176 | now obsolete and will go away in release 1.5. | |
8177 | ||
cf7132b3 | 8178 | ** New syntax: collect BODY1 ... |
d41b3904 MD |
8179 | Version of `begin' which returns a list of the results of the body |
8180 | forms instead of the result of the last body form. In contrast to | |
cf7132b3 | 8181 | `begin', `collect' allows an empty body. |
d41b3904 | 8182 | |
e4eae9b1 MD |
8183 | ** New functions: read-history FILENAME, write-history FILENAME |
8184 | Read/write command line history from/to file. Returns #t on success | |
8185 | and #f if an error occured. | |
8186 | ||
d21ffe26 JB |
8187 | ** `ls' and `lls' in module (ice-9 ls) now handle no arguments. |
8188 | ||
8189 | These procedures return a list of definitions available in the specified | |
8190 | argument, a relative module reference. In the case of no argument, | |
8191 | `(current-module)' is now consulted for definitions to return, instead | |
8192 | of simply returning #f, the former behavior. | |
8193 | ||
f8c9d497 JB |
8194 | ** The #/ syntax for lists is no longer supported. |
8195 | ||
8196 | Earlier versions of Scheme accepted this syntax, but printed a | |
8197 | warning. | |
8198 | ||
8199 | ** Guile no longer consults the SCHEME_LOAD_PATH environment variable. | |
8200 | ||
8201 | Instead, you should set GUILE_LOAD_PATH to tell Guile where to find | |
8202 | modules. | |
8203 | ||
3ffc7a36 MD |
8204 | * Changes to the gh_ interface |
8205 | ||
8206 | ** gh_scm2doubles | |
8207 | ||
8208 | Now takes a second argument which is the result array. If this | |
8209 | pointer is NULL, a new array is malloced (the old behaviour). | |
8210 | ||
8211 | ** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars, | |
8212 | gh_scm2shorts, gh_scm2longs, gh_scm2floats | |
8213 | ||
8214 | New functions. | |
8215 | ||
3e8370c3 MD |
8216 | * Changes to the scm_ interface |
8217 | ||
ad91d6c3 MD |
8218 | ** Function: scm_make_named_hook (char* name, int n_args) |
8219 | ||
8220 | Creates a hook in the same way as make-hook above but also | |
8221 | binds a variable named NAME to it. | |
8222 | ||
8223 | This is the typical way of creating a hook from C code. | |
8224 | ||
ece41168 MD |
8225 | Currently, the variable is created in the "current" module. This |
8226 | might change when we get the new module system. | |
ad91d6c3 | 8227 | |
16a5a9a4 MD |
8228 | ** The smob interface |
8229 | ||
8230 | The interface for creating smobs has changed. For documentation, see | |
8231 | data-rep.info (made from guile-core/doc/data-rep.texi). | |
8232 | ||
8233 | *** Deprecated function: SCM scm_newsmob (scm_smobfuns *) | |
8234 | ||
8235 | >>> This function will be removed in 1.3.4. <<< | |
8236 | ||
8237 | It is replaced by: | |
8238 | ||
8239 | *** Function: SCM scm_make_smob_type (const char *name, scm_sizet size) | |
8240 | This function adds a new smob type, named NAME, with instance size | |
8241 | SIZE to the system. The return value is a tag that is used in | |
8242 | creating instances of the type. If SIZE is 0, then no memory will | |
8243 | be allocated when instances of the smob are created, and nothing | |
8244 | will be freed by the default free function. | |
6c0201ad | 8245 | |
16a5a9a4 MD |
8246 | *** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM)) |
8247 | This function sets the smob marking procedure for the smob type | |
8248 | specified by the tag TC. TC is the tag returned by | |
8249 | `scm_make_smob_type'. | |
8250 | ||
8251 | *** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM)) | |
8252 | This function sets the smob freeing procedure for the smob type | |
8253 | specified by the tag TC. TC is the tag returned by | |
8254 | `scm_make_smob_type'. | |
8255 | ||
8256 | *** Function: void scm_set_smob_print (tc, print) | |
8257 | ||
8258 | - Function: void scm_set_smob_print (long tc, | |
8259 | scm_sizet (*print) (SCM, | |
8260 | SCM, | |
8261 | scm_print_state *)) | |
8262 | ||
8263 | This function sets the smob printing procedure for the smob type | |
8264 | specified by the tag TC. TC is the tag returned by | |
8265 | `scm_make_smob_type'. | |
8266 | ||
8267 | *** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM)) | |
8268 | This function sets the smob equality-testing predicate for the | |
8269 | smob type specified by the tag TC. TC is the tag returned by | |
8270 | `scm_make_smob_type'. | |
8271 | ||
8272 | *** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data) | |
8273 | Make VALUE contain a smob instance of the type with type code TC and | |
8274 | smob data DATA. VALUE must be previously declared as C type `SCM'. | |
8275 | ||
8276 | *** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data) | |
8277 | This macro expands to a block of code that creates a smob instance | |
8278 | of the type with type code TC and smob data DATA, and returns that | |
8279 | `SCM' value. It should be the last piece of code in a block. | |
8280 | ||
9e97c52d GH |
8281 | ** The interfaces for using I/O ports and implementing port types |
8282 | (ptobs) have changed significantly. The new interface is based on | |
8283 | shared access to buffers and a new set of ptob procedures. | |
8284 | ||
16a5a9a4 MD |
8285 | *** scm_newptob has been removed |
8286 | ||
8287 | It is replaced by: | |
8288 | ||
8289 | *** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush) | |
8290 | ||
8291 | - Function: SCM scm_make_port_type (char *type_name, | |
8292 | int (*fill_buffer) (SCM port), | |
8293 | void (*write_flush) (SCM port)); | |
8294 | ||
8295 | Similarly to the new smob interface, there is a set of function | |
8296 | setters by which the user can customize the behaviour of his port | |
544e9093 | 8297 | type. See ports.h (scm_set_port_XXX). |
16a5a9a4 | 8298 | |
9e97c52d GH |
8299 | ** scm_strport_to_string: New function: creates a new string from |
8300 | a string port's buffer. | |
8301 | ||
3e8370c3 MD |
8302 | ** Plug in interface for random number generators |
8303 | The variable `scm_the_rng' in random.c contains a value and three | |
8304 | function pointers which together define the current random number | |
8305 | generator being used by the Scheme level interface and the random | |
8306 | number library functions. | |
8307 | ||
8308 | The user is free to replace the default generator with the generator | |
8309 | of his own choice. | |
8310 | ||
8311 | *** Variable: size_t scm_the_rng.rstate_size | |
8312 | The size of the random state type used by the current RNG | |
8313 | measured in chars. | |
8314 | ||
8315 | *** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE) | |
8316 | Given the random STATE, return 32 random bits. | |
8317 | ||
8318 | *** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N) | |
8319 | Seed random state STATE using string S of length N. | |
8320 | ||
8321 | *** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE) | |
8322 | Given random state STATE, return a malloced copy. | |
8323 | ||
8324 | ** Default RNG | |
8325 | The default RNG is the MWC (Multiply With Carry) random number | |
8326 | generator described by George Marsaglia at the Department of | |
8327 | Statistics and Supercomputer Computations Research Institute, The | |
8328 | Florida State University (http://stat.fsu.edu/~geo). | |
8329 | ||
8330 | It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and | |
8331 | passes all tests in the DIEHARD test suite | |
8332 | (http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits | |
8333 | costs one multiply and one add on platforms which either supports long | |
8334 | longs (gcc does this on most systems) or have 64 bit longs. The cost | |
8335 | is four multiply on other systems but this can be optimized by writing | |
8336 | scm_i_uniform32 in assembler. | |
8337 | ||
8338 | These functions are provided through the scm_the_rng interface for use | |
8339 | by libguile and the application. | |
8340 | ||
8341 | *** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE) | |
8342 | Given the random STATE, return 32 random bits. | |
8343 | Don't use this function directly. Instead go through the plugin | |
8344 | interface (see "Plug in interface" above). | |
8345 | ||
8346 | *** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N) | |
8347 | Initialize STATE using SEED of length N. | |
8348 | ||
8349 | *** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE) | |
8350 | Return a malloc:ed copy of STATE. This function can easily be re-used | |
8351 | in the interfaces to other RNGs. | |
8352 | ||
8353 | ** Random number library functions | |
8354 | These functions use the current RNG through the scm_the_rng interface. | |
8355 | It might be a good idea to use these functions from your C code so | |
8356 | that only one random generator is used by all code in your program. | |
8357 | ||
259529f2 | 8358 | The default random state is stored in: |
3e8370c3 MD |
8359 | |
8360 | *** Variable: SCM scm_var_random_state | |
8361 | Contains the vcell of the Scheme variable "*random-state*" which is | |
8362 | used as default state by all random number functions in the Scheme | |
8363 | level interface. | |
8364 | ||
8365 | Example: | |
8366 | ||
259529f2 | 8367 | double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state))); |
3e8370c3 | 8368 | |
259529f2 MD |
8369 | *** Function: scm_rstate *scm_c_default_rstate (void) |
8370 | This is a convenience function which returns the value of | |
8371 | scm_var_random_state. An error message is generated if this value | |
8372 | isn't a random state. | |
8373 | ||
8374 | *** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH) | |
8375 | Make a new random state from the string SEED of length LENGTH. | |
8376 | ||
8377 | It is generally not a good idea to use multiple random states in a | |
8378 | program. While subsequent random numbers generated from one random | |
8379 | state are guaranteed to be reasonably independent, there is no such | |
8380 | guarantee for numbers generated from different random states. | |
8381 | ||
8382 | *** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE) | |
8383 | Return 32 random bits. | |
8384 | ||
8385 | *** Function: double scm_c_uniform01 (scm_rstate *STATE) | |
3e8370c3 MD |
8386 | Return a sample from the uniform(0,1) distribution. |
8387 | ||
259529f2 | 8388 | *** Function: double scm_c_normal01 (scm_rstate *STATE) |
3e8370c3 MD |
8389 | Return a sample from the normal(0,1) distribution. |
8390 | ||
259529f2 | 8391 | *** Function: double scm_c_exp1 (scm_rstate *STATE) |
3e8370c3 MD |
8392 | Return a sample from the exp(1) distribution. |
8393 | ||
259529f2 MD |
8394 | *** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M) |
8395 | Return a sample from the discrete uniform(0,M) distribution. | |
8396 | ||
8397 | *** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M) | |
3e8370c3 | 8398 | Return a sample from the discrete uniform(0,M) distribution. |
259529f2 | 8399 | M must be a bignum object. The returned value may be an INUM. |
3e8370c3 | 8400 | |
9e97c52d | 8401 | |
f3227c7a | 8402 | \f |
d23bbf3e | 8403 | Changes in Guile 1.3 (released Monday, October 19, 1998): |
c484bf7f JB |
8404 | |
8405 | * Changes to the distribution | |
8406 | ||
e2d6569c JB |
8407 | ** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH. |
8408 | To avoid conflicts, programs should name environment variables after | |
8409 | themselves, except when there's a common practice establishing some | |
8410 | other convention. | |
8411 | ||
8412 | For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH, | |
8413 | giving the former precedence, and printing a warning message if the | |
8414 | latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all. | |
8415 | ||
8416 | ** The header files related to multi-byte characters have been removed. | |
8417 | They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code | |
8418 | which referred to these explicitly will probably need to be rewritten, | |
8419 | since the support for the variant string types has been removed; see | |
8420 | below. | |
8421 | ||
8422 | ** The header files append.h and sequences.h have been removed. These | |
8423 | files implemented non-R4RS operations which would encourage | |
8424 | non-portable programming style and less easy-to-read code. | |
3a97e020 | 8425 | |
c484bf7f JB |
8426 | * Changes to the stand-alone interpreter |
8427 | ||
2e368582 | 8428 | ** New procedures have been added to implement a "batch mode": |
ec4ab4fd | 8429 | |
2e368582 | 8430 | *** Function: batch-mode? |
ec4ab4fd GH |
8431 | |
8432 | Returns a boolean indicating whether the interpreter is in batch | |
8433 | mode. | |
8434 | ||
2e368582 | 8435 | *** Function: set-batch-mode?! ARG |
ec4ab4fd GH |
8436 | |
8437 | If ARG is true, switches the interpreter to batch mode. The `#f' | |
8438 | case has not been implemented. | |
8439 | ||
2e368582 JB |
8440 | ** Guile now provides full command-line editing, when run interactively. |
8441 | To use this feature, you must have the readline library installed. | |
8442 | The Guile build process will notice it, and automatically include | |
8443 | support for it. | |
8444 | ||
8445 | The readline library is available via anonymous FTP from any GNU | |
8446 | mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu". | |
8447 | ||
a5d6d578 MD |
8448 | ** the-last-stack is now a fluid. |
8449 | ||
c484bf7f JB |
8450 | * Changes to the procedure for linking libguile with your programs |
8451 | ||
71f20534 | 8452 | ** You can now use the `guile-config' utility to build programs that use Guile. |
2e368582 | 8453 | |
2adfe1c0 | 8454 | Guile now includes a command-line utility called `guile-config', which |
71f20534 JB |
8455 | can provide information about how to compile and link programs that |
8456 | use Guile. | |
8457 | ||
8458 | *** `guile-config compile' prints any C compiler flags needed to use Guile. | |
8459 | You should include this command's output on the command line you use | |
8460 | to compile C or C++ code that #includes the Guile header files. It's | |
8461 | usually just a `-I' flag to help the compiler find the Guile headers. | |
8462 | ||
8463 | ||
8464 | *** `guile-config link' prints any linker flags necessary to link with Guile. | |
8aa5c148 | 8465 | |
71f20534 | 8466 | This command writes to its standard output a list of flags which you |
8aa5c148 JB |
8467 | must pass to the linker to link your code against the Guile library. |
8468 | The flags include '-lguile' itself, any other libraries the Guile | |
8469 | library depends upon, and any `-L' flags needed to help the linker | |
8470 | find those libraries. | |
2e368582 JB |
8471 | |
8472 | For example, here is a Makefile rule that builds a program named 'foo' | |
8473 | from the object files ${FOO_OBJECTS}, and links them against Guile: | |
8474 | ||
8475 | foo: ${FOO_OBJECTS} | |
2adfe1c0 | 8476 | ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo |
2e368582 | 8477 | |
e2d6569c JB |
8478 | Previous Guile releases recommended that you use autoconf to detect |
8479 | which of a predefined set of libraries were present on your system. | |
2adfe1c0 | 8480 | It is more robust to use `guile-config', since it records exactly which |
e2d6569c JB |
8481 | libraries the installed Guile library requires. |
8482 | ||
2adfe1c0 JB |
8483 | This was originally called `build-guile', but was renamed to |
8484 | `guile-config' before Guile 1.3 was released, to be consistent with | |
8485 | the analogous script for the GTK+ GUI toolkit, which is called | |
8486 | `gtk-config'. | |
8487 | ||
2e368582 | 8488 | |
8aa5c148 JB |
8489 | ** Use the GUILE_FLAGS macro in your configure.in file to find Guile. |
8490 | ||
8491 | If you are using the GNU autoconf package to configure your program, | |
8492 | you can use the GUILE_FLAGS autoconf macro to call `guile-config' | |
8493 | (described above) and gather the necessary values for use in your | |
8494 | Makefiles. | |
8495 | ||
8496 | The GUILE_FLAGS macro expands to configure script code which runs the | |
8497 | `guile-config' script, to find out where Guile's header files and | |
8498 | libraries are installed. It sets two variables, marked for | |
8499 | substitution, as by AC_SUBST. | |
8500 | ||
8501 | GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build | |
8502 | code that uses Guile header files. This is almost always just a | |
8503 | -I flag. | |
8504 | ||
8505 | GUILE_LDFLAGS --- flags to pass to the linker to link a | |
8506 | program against Guile. This includes `-lguile' for the Guile | |
8507 | library itself, any libraries that Guile itself requires (like | |
8508 | -lqthreads), and so on. It may also include a -L flag to tell the | |
8509 | compiler where to find the libraries. | |
8510 | ||
8511 | GUILE_FLAGS is defined in the file guile.m4, in the top-level | |
8512 | directory of the Guile distribution. You can copy it into your | |
8513 | package's aclocal.m4 file, and then use it in your configure.in file. | |
8514 | ||
8515 | If you are using the `aclocal' program, distributed with GNU automake, | |
8516 | to maintain your aclocal.m4 file, the Guile installation process | |
8517 | installs guile.m4 where aclocal will find it. All you need to do is | |
8518 | use GUILE_FLAGS in your configure.in file, and then run `aclocal'; | |
8519 | this will copy the definition of GUILE_FLAGS into your aclocal.m4 | |
8520 | file. | |
8521 | ||
8522 | ||
c484bf7f | 8523 | * Changes to Scheme functions and syntax |
7ad3c1e7 | 8524 | |
02755d59 | 8525 | ** Multi-byte strings have been removed, as have multi-byte and wide |
e2d6569c JB |
8526 | ports. We felt that these were the wrong approach to |
8527 | internationalization support. | |
02755d59 | 8528 | |
2e368582 JB |
8529 | ** New function: readline [PROMPT] |
8530 | Read a line from the terminal, and allow the user to edit it, | |
8531 | prompting with PROMPT. READLINE provides a large set of Emacs-like | |
8532 | editing commands, lets the user recall previously typed lines, and | |
8533 | works on almost every kind of terminal, including dumb terminals. | |
8534 | ||
8535 | READLINE assumes that the cursor is at the beginning of the line when | |
8536 | it is invoked. Thus, you can't print a prompt yourself, and then call | |
8537 | READLINE; you need to package up your prompt as a string, pass it to | |
8538 | the function, and let READLINE print the prompt itself. This is | |
8539 | because READLINE needs to know the prompt's screen width. | |
8540 | ||
8cd57bd0 JB |
8541 | For Guile to provide this function, you must have the readline |
8542 | library, version 2.1 or later, installed on your system. Readline is | |
8543 | available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from | |
8544 | any GNU mirror site. | |
2e368582 JB |
8545 | |
8546 | See also ADD-HISTORY function. | |
8547 | ||
8548 | ** New function: add-history STRING | |
8549 | Add STRING as the most recent line in the history used by the READLINE | |
8550 | command. READLINE does not add lines to the history itself; you must | |
8551 | call ADD-HISTORY to make previous input available to the user. | |
8552 | ||
8cd57bd0 JB |
8553 | ** The behavior of the read-line function has changed. |
8554 | ||
8555 | This function now uses standard C library functions to read the line, | |
8556 | for speed. This means that it doesn not respect the value of | |
8557 | scm-line-incrementors; it assumes that lines are delimited with | |
8558 | #\newline. | |
8559 | ||
8560 | (Note that this is read-line, the function that reads a line of text | |
8561 | from a port, not readline, the function that reads a line from a | |
8562 | terminal, providing full editing capabilities.) | |
8563 | ||
1a0106ef JB |
8564 | ** New module (ice-9 getopt-gnu-style): Parse command-line arguments. |
8565 | ||
8566 | This module provides some simple argument parsing. It exports one | |
8567 | function: | |
8568 | ||
8569 | Function: getopt-gnu-style ARG-LS | |
8570 | Parse a list of program arguments into an alist of option | |
8571 | descriptions. | |
8572 | ||
8573 | Each item in the list of program arguments is examined to see if | |
8574 | it meets the syntax of a GNU long-named option. An argument like | |
8575 | `--MUMBLE' produces an element of the form (MUMBLE . #t) in the | |
8576 | returned alist, where MUMBLE is a keyword object with the same | |
8577 | name as the argument. An argument like `--MUMBLE=FROB' produces | |
8578 | an element of the form (MUMBLE . FROB), where FROB is a string. | |
8579 | ||
8580 | As a special case, the returned alist also contains a pair whose | |
8581 | car is the symbol `rest'. The cdr of this pair is a list | |
8582 | containing all the items in the argument list that are not options | |
8583 | of the form mentioned above. | |
8584 | ||
8585 | The argument `--' is treated specially: all items in the argument | |
8586 | list appearing after such an argument are not examined, and are | |
8587 | returned in the special `rest' list. | |
8588 | ||
8589 | This function does not parse normal single-character switches. | |
8590 | You will need to parse them out of the `rest' list yourself. | |
8591 | ||
8cd57bd0 JB |
8592 | ** The read syntax for byte vectors and short vectors has changed. |
8593 | ||
8594 | Instead of #bytes(...), write #y(...). | |
8595 | ||
8596 | Instead of #short(...), write #h(...). | |
8597 | ||
8598 | This may seem nutty, but, like the other uniform vectors, byte vectors | |
8599 | and short vectors want to have the same print and read syntax (and, | |
8600 | more basic, want to have read syntax!). Changing the read syntax to | |
8601 | use multiple characters after the hash sign breaks with the | |
8602 | conventions used in R5RS and the conventions used for the other | |
8603 | uniform vectors. It also introduces complexity in the current reader, | |
8604 | both on the C and Scheme levels. (The Right solution is probably to | |
8605 | change the syntax and prototypes for uniform vectors entirely.) | |
8606 | ||
8607 | ||
8608 | ** The new module (ice-9 session) provides useful interactive functions. | |
8609 | ||
8610 | *** New procedure: (apropos REGEXP OPTION ...) | |
8611 | ||
8612 | Display a list of top-level variables whose names match REGEXP, and | |
8613 | the modules they are imported from. Each OPTION should be one of the | |
8614 | following symbols: | |
8615 | ||
8616 | value --- Show the value of each matching variable. | |
8617 | shadow --- Show bindings shadowed by subsequently imported modules. | |
8618 | full --- Same as both `shadow' and `value'. | |
8619 | ||
8620 | For example: | |
8621 | ||
8622 | guile> (apropos "trace" 'full) | |
8623 | debug: trace #<procedure trace args> | |
8624 | debug: untrace #<procedure untrace args> | |
8625 | the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>> | |
8626 | the-scm-module: before-backtrace-hook () | |
8627 | the-scm-module: backtrace #<primitive-procedure backtrace> | |
8628 | the-scm-module: after-backtrace-hook () | |
8629 | the-scm-module: has-shown-backtrace-hint? #f | |
6c0201ad | 8630 | guile> |
8cd57bd0 JB |
8631 | |
8632 | ** There are new functions and syntax for working with macros. | |
8633 | ||
8634 | Guile implements macros as a special object type. Any variable whose | |
8635 | top-level binding is a macro object acts as a macro. The macro object | |
8636 | specifies how the expression should be transformed before evaluation. | |
8637 | ||
8638 | *** Macro objects now print in a reasonable way, resembling procedures. | |
8639 | ||
8640 | *** New function: (macro? OBJ) | |
8641 | True iff OBJ is a macro object. | |
8642 | ||
8643 | *** New function: (primitive-macro? OBJ) | |
8644 | Like (macro? OBJ), but true only if OBJ is one of the Guile primitive | |
8645 | macro transformers, implemented in eval.c rather than Scheme code. | |
8646 | ||
dbdd0c16 JB |
8647 | Why do we have this function? |
8648 | - For symmetry with procedure? and primitive-procedure?, | |
8649 | - to allow custom print procedures to tell whether a macro is | |
8650 | primitive, and display it differently, and | |
8651 | - to allow compilers and user-written evaluators to distinguish | |
8652 | builtin special forms from user-defined ones, which could be | |
8653 | compiled. | |
8654 | ||
8cd57bd0 JB |
8655 | *** New function: (macro-type OBJ) |
8656 | Return a value indicating what kind of macro OBJ is. Possible return | |
8657 | values are: | |
8658 | ||
8659 | The symbol `syntax' --- a macro created by procedure->syntax. | |
8660 | The symbol `macro' --- a macro created by procedure->macro. | |
8661 | The symbol `macro!' --- a macro created by procedure->memoizing-macro. | |
6c0201ad | 8662 | The boolean #f --- if OBJ is not a macro object. |
8cd57bd0 JB |
8663 | |
8664 | *** New function: (macro-name MACRO) | |
8665 | Return the name of the macro object MACRO's procedure, as returned by | |
8666 | procedure-name. | |
8667 | ||
8668 | *** New function: (macro-transformer MACRO) | |
8669 | Return the transformer procedure for MACRO. | |
8670 | ||
8671 | *** New syntax: (use-syntax MODULE ... TRANSFORMER) | |
8672 | ||
8673 | Specify a new macro expander to use in the current module. Each | |
8674 | MODULE is a module name, with the same meaning as in the `use-modules' | |
8675 | form; each named module's exported bindings are added to the current | |
8676 | top-level environment. TRANSFORMER is an expression evaluated in the | |
8677 | resulting environment which must yield a procedure to use as the | |
8678 | module's eval transformer: every expression evaluated in this module | |
8679 | is passed to this function, and the result passed to the Guile | |
6c0201ad | 8680 | interpreter. |
8cd57bd0 JB |
8681 | |
8682 | *** macro-eval! is removed. Use local-eval instead. | |
29521173 | 8683 | |
8d9dcb3c MV |
8684 | ** Some magic has been added to the printer to better handle user |
8685 | written printing routines (like record printers, closure printers). | |
8686 | ||
8687 | The problem is that these user written routines must have access to | |
7fbd77df | 8688 | the current `print-state' to be able to handle fancy things like |
8d9dcb3c MV |
8689 | detection of circular references. These print-states have to be |
8690 | passed to the builtin printing routines (display, write, etc) to | |
8691 | properly continue the print chain. | |
8692 | ||
8693 | We didn't want to change all existing print code so that it | |
8cd57bd0 | 8694 | explicitly passes thru a print state in addition to a port. Instead, |
8d9dcb3c MV |
8695 | we extented the possible values that the builtin printing routines |
8696 | accept as a `port'. In addition to a normal port, they now also take | |
8697 | a pair of a normal port and a print-state. Printing will go to the | |
8698 | port and the print-state will be used to control the detection of | |
8699 | circular references, etc. If the builtin function does not care for a | |
8700 | print-state, it is simply ignored. | |
8701 | ||
8702 | User written callbacks are now called with such a pair as their | |
8703 | `port', but because every function now accepts this pair as a PORT | |
8704 | argument, you don't have to worry about that. In fact, it is probably | |
8705 | safest to not check for these pairs. | |
8706 | ||
8707 | However, it is sometimes necessary to continue a print chain on a | |
8708 | different port, for example to get a intermediate string | |
8709 | representation of the printed value, mangle that string somehow, and | |
8710 | then to finally print the mangled string. Use the new function | |
8711 | ||
8712 | inherit-print-state OLD-PORT NEW-PORT | |
8713 | ||
8714 | for this. It constructs a new `port' that prints to NEW-PORT but | |
8715 | inherits the print-state of OLD-PORT. | |
8716 | ||
ef1ea498 MD |
8717 | ** struct-vtable-offset renamed to vtable-offset-user |
8718 | ||
8719 | ** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer | |
8720 | ||
e478dffa MD |
8721 | ** There is now a third optional argument to make-vtable-vtable |
8722 | (and fourth to make-struct) when constructing new types (vtables). | |
8723 | This argument initializes field vtable-index-printer of the vtable. | |
ef1ea498 | 8724 | |
4851dc57 MV |
8725 | ** The detection of circular references has been extended to structs. |
8726 | That is, a structure that -- in the process of being printed -- prints | |
8727 | itself does not lead to infinite recursion. | |
8728 | ||
8729 | ** There is now some basic support for fluids. Please read | |
8730 | "libguile/fluid.h" to find out more. It is accessible from Scheme with | |
8731 | the following functions and macros: | |
8732 | ||
9c3fb66f MV |
8733 | Function: make-fluid |
8734 | ||
8735 | Create a new fluid object. Fluids are not special variables or | |
8736 | some other extension to the semantics of Scheme, but rather | |
8737 | ordinary Scheme objects. You can store them into variables (that | |
8738 | are still lexically scoped, of course) or into any other place you | |
8739 | like. Every fluid has a initial value of `#f'. | |
04c76b58 | 8740 | |
9c3fb66f | 8741 | Function: fluid? OBJ |
04c76b58 | 8742 | |
9c3fb66f | 8743 | Test whether OBJ is a fluid. |
04c76b58 | 8744 | |
9c3fb66f MV |
8745 | Function: fluid-ref FLUID |
8746 | Function: fluid-set! FLUID VAL | |
04c76b58 MV |
8747 | |
8748 | Access/modify the fluid FLUID. Modifications are only visible | |
8749 | within the current dynamic root (that includes threads). | |
8750 | ||
9c3fb66f MV |
8751 | Function: with-fluids* FLUIDS VALUES THUNK |
8752 | ||
8753 | FLUIDS is a list of fluids and VALUES a corresponding list of | |
8754 | values for these fluids. Before THUNK gets called the values are | |
6c0201ad | 8755 | installed in the fluids and the old values of the fluids are |
9c3fb66f MV |
8756 | saved in the VALUES list. When the flow of control leaves THUNK |
8757 | or reenters it, the values get swapped again. You might think of | |
8758 | this as a `safe-fluid-excursion'. Note that the VALUES list is | |
8759 | modified by `with-fluids*'. | |
8760 | ||
8761 | Macro: with-fluids ((FLUID VALUE) ...) FORM ... | |
8762 | ||
8763 | The same as `with-fluids*' but with a different syntax. It looks | |
8764 | just like `let', but both FLUID and VALUE are evaluated. Remember, | |
8765 | fluids are not special variables but ordinary objects. FLUID | |
8766 | should evaluate to a fluid. | |
04c76b58 | 8767 | |
e2d6569c | 8768 | ** Changes to system call interfaces: |
64d01d13 | 8769 | |
e2d6569c | 8770 | *** close-port, close-input-port and close-output-port now return a |
64d01d13 GH |
8771 | boolean instead of an `unspecified' object. #t means that the port |
8772 | was successfully closed, while #f means it was already closed. It is | |
8773 | also now possible for these procedures to raise an exception if an | |
8774 | error occurs (some errors from write can be delayed until close.) | |
8775 | ||
e2d6569c | 8776 | *** the first argument to chmod, fcntl, ftell and fseek can now be a |
6afcd3b2 GH |
8777 | file descriptor. |
8778 | ||
e2d6569c | 8779 | *** the third argument to fcntl is now optional. |
6afcd3b2 | 8780 | |
e2d6569c | 8781 | *** the first argument to chown can now be a file descriptor or a port. |
6afcd3b2 | 8782 | |
e2d6569c | 8783 | *** the argument to stat can now be a port. |
6afcd3b2 | 8784 | |
e2d6569c | 8785 | *** The following new procedures have been added (most use scsh |
64d01d13 GH |
8786 | interfaces): |
8787 | ||
e2d6569c | 8788 | *** procedure: close PORT/FD |
ec4ab4fd GH |
8789 | Similar to close-port (*note close-port: Closing Ports.), but also |
8790 | works on file descriptors. A side effect of closing a file | |
8791 | descriptor is that any ports using that file descriptor are moved | |
8792 | to a different file descriptor and have their revealed counts set | |
8793 | to zero. | |
8794 | ||
e2d6569c | 8795 | *** procedure: port->fdes PORT |
ec4ab4fd GH |
8796 | Returns the integer file descriptor underlying PORT. As a side |
8797 | effect the revealed count of PORT is incremented. | |
8798 | ||
e2d6569c | 8799 | *** procedure: fdes->ports FDES |
ec4ab4fd GH |
8800 | Returns a list of existing ports which have FDES as an underlying |
8801 | file descriptor, without changing their revealed counts. | |
8802 | ||
e2d6569c | 8803 | *** procedure: fdes->inport FDES |
ec4ab4fd GH |
8804 | Returns an existing input port which has FDES as its underlying |
8805 | file descriptor, if one exists, and increments its revealed count. | |
8806 | Otherwise, returns a new input port with a revealed count of 1. | |
8807 | ||
e2d6569c | 8808 | *** procedure: fdes->outport FDES |
ec4ab4fd GH |
8809 | Returns an existing output port which has FDES as its underlying |
8810 | file descriptor, if one exists, and increments its revealed count. | |
8811 | Otherwise, returns a new output port with a revealed count of 1. | |
8812 | ||
8813 | The next group of procedures perform a `dup2' system call, if NEWFD | |
8814 | (an integer) is supplied, otherwise a `dup'. The file descriptor to be | |
8815 | duplicated can be supplied as an integer or contained in a port. The | |
64d01d13 GH |
8816 | type of value returned varies depending on which procedure is used. |
8817 | ||
ec4ab4fd GH |
8818 | All procedures also have the side effect when performing `dup2' that |
8819 | any ports using NEWFD are moved to a different file descriptor and have | |
64d01d13 GH |
8820 | their revealed counts set to zero. |
8821 | ||
e2d6569c | 8822 | *** procedure: dup->fdes PORT/FD [NEWFD] |
ec4ab4fd | 8823 | Returns an integer file descriptor. |
64d01d13 | 8824 | |
e2d6569c | 8825 | *** procedure: dup->inport PORT/FD [NEWFD] |
ec4ab4fd | 8826 | Returns a new input port using the new file descriptor. |
64d01d13 | 8827 | |
e2d6569c | 8828 | *** procedure: dup->outport PORT/FD [NEWFD] |
ec4ab4fd | 8829 | Returns a new output port using the new file descriptor. |
64d01d13 | 8830 | |
e2d6569c | 8831 | *** procedure: dup PORT/FD [NEWFD] |
ec4ab4fd GH |
8832 | Returns a new port if PORT/FD is a port, with the same mode as the |
8833 | supplied port, otherwise returns an integer file descriptor. | |
64d01d13 | 8834 | |
e2d6569c | 8835 | *** procedure: dup->port PORT/FD MODE [NEWFD] |
ec4ab4fd GH |
8836 | Returns a new port using the new file descriptor. MODE supplies a |
8837 | mode string for the port (*note open-file: File Ports.). | |
64d01d13 | 8838 | |
e2d6569c | 8839 | *** procedure: setenv NAME VALUE |
ec4ab4fd GH |
8840 | Modifies the environment of the current process, which is also the |
8841 | default environment inherited by child processes. | |
64d01d13 | 8842 | |
ec4ab4fd GH |
8843 | If VALUE is `#f', then NAME is removed from the environment. |
8844 | Otherwise, the string NAME=VALUE is added to the environment, | |
8845 | replacing any existing string with name matching NAME. | |
64d01d13 | 8846 | |
ec4ab4fd | 8847 | The return value is unspecified. |
956055a9 | 8848 | |
e2d6569c | 8849 | *** procedure: truncate-file OBJ SIZE |
6afcd3b2 GH |
8850 | Truncates the file referred to by OBJ to at most SIZE bytes. OBJ |
8851 | can be a string containing a file name or an integer file | |
8852 | descriptor or port open for output on the file. The underlying | |
8853 | system calls are `truncate' and `ftruncate'. | |
8854 | ||
8855 | The return value is unspecified. | |
8856 | ||
e2d6569c | 8857 | *** procedure: setvbuf PORT MODE [SIZE] |
7a6f1ffa GH |
8858 | Set the buffering mode for PORT. MODE can be: |
8859 | `_IONBF' | |
8860 | non-buffered | |
8861 | ||
8862 | `_IOLBF' | |
8863 | line buffered | |
8864 | ||
8865 | `_IOFBF' | |
8866 | block buffered, using a newly allocated buffer of SIZE bytes. | |
8867 | However if SIZE is zero or unspecified, the port will be made | |
8868 | non-buffered. | |
8869 | ||
8870 | This procedure should not be used after I/O has been performed with | |
8871 | the port. | |
8872 | ||
8873 | Ports are usually block buffered by default, with a default buffer | |
8874 | size. Procedures e.g., *Note open-file: File Ports, which accept a | |
8875 | mode string allow `0' to be added to request an unbuffered port. | |
8876 | ||
e2d6569c | 8877 | *** procedure: fsync PORT/FD |
6afcd3b2 GH |
8878 | Copies any unwritten data for the specified output file descriptor |
8879 | to disk. If PORT/FD is a port, its buffer is flushed before the | |
8880 | underlying file descriptor is fsync'd. The return value is | |
8881 | unspecified. | |
8882 | ||
e2d6569c | 8883 | *** procedure: open-fdes PATH FLAGS [MODES] |
6afcd3b2 GH |
8884 | Similar to `open' but returns a file descriptor instead of a port. |
8885 | ||
e2d6569c | 8886 | *** procedure: execle PATH ENV [ARG] ... |
6afcd3b2 GH |
8887 | Similar to `execl', but the environment of the new process is |
8888 | specified by ENV, which must be a list of strings as returned by | |
8889 | the `environ' procedure. | |
8890 | ||
8891 | This procedure is currently implemented using the `execve' system | |
8892 | call, but we call it `execle' because of its Scheme calling | |
8893 | interface. | |
8894 | ||
e2d6569c | 8895 | *** procedure: strerror ERRNO |
ec4ab4fd GH |
8896 | Returns the Unix error message corresponding to ERRNO, an integer. |
8897 | ||
e2d6569c | 8898 | *** procedure: primitive-exit [STATUS] |
6afcd3b2 GH |
8899 | Terminate the current process without unwinding the Scheme stack. |
8900 | This is would typically be useful after a fork. The exit status | |
8901 | is STATUS if supplied, otherwise zero. | |
8902 | ||
e2d6569c | 8903 | *** procedure: times |
6afcd3b2 GH |
8904 | Returns an object with information about real and processor time. |
8905 | The following procedures accept such an object as an argument and | |
8906 | return a selected component: | |
8907 | ||
8908 | `tms:clock' | |
8909 | The current real time, expressed as time units relative to an | |
8910 | arbitrary base. | |
8911 | ||
8912 | `tms:utime' | |
8913 | The CPU time units used by the calling process. | |
8914 | ||
8915 | `tms:stime' | |
8916 | The CPU time units used by the system on behalf of the | |
8917 | calling process. | |
8918 | ||
8919 | `tms:cutime' | |
8920 | The CPU time units used by terminated child processes of the | |
8921 | calling process, whose status has been collected (e.g., using | |
8922 | `waitpid'). | |
8923 | ||
8924 | `tms:cstime' | |
8925 | Similarly, the CPU times units used by the system on behalf of | |
8926 | terminated child processes. | |
7ad3c1e7 | 8927 | |
e2d6569c JB |
8928 | ** Removed: list-length |
8929 | ** Removed: list-append, list-append! | |
8930 | ** Removed: list-reverse, list-reverse! | |
8931 | ||
8932 | ** array-map renamed to array-map! | |
8933 | ||
8934 | ** serial-array-map renamed to serial-array-map! | |
8935 | ||
660f41fa MD |
8936 | ** catch doesn't take #f as first argument any longer |
8937 | ||
8938 | Previously, it was possible to pass #f instead of a key to `catch'. | |
8939 | That would cause `catch' to pass a jump buffer object to the procedure | |
8940 | passed as second argument. The procedure could then use this jump | |
8941 | buffer objekt as an argument to throw. | |
8942 | ||
8943 | This mechanism has been removed since its utility doesn't motivate the | |
8944 | extra complexity it introduces. | |
8945 | ||
332d00f6 JB |
8946 | ** The `#/' notation for lists now provokes a warning message from Guile. |
8947 | This syntax will be removed from Guile in the near future. | |
8948 | ||
8949 | To disable the warning message, set the GUILE_HUSH environment | |
8950 | variable to any non-empty value. | |
8951 | ||
8cd57bd0 JB |
8952 | ** The newline character now prints as `#\newline', following the |
8953 | normal Scheme notation, not `#\nl'. | |
8954 | ||
c484bf7f JB |
8955 | * Changes to the gh_ interface |
8956 | ||
8986901b JB |
8957 | ** The gh_enter function now takes care of loading the Guile startup files. |
8958 | gh_enter works by calling scm_boot_guile; see the remarks below. | |
8959 | ||
5424b4f7 MD |
8960 | ** Function: void gh_write (SCM x) |
8961 | ||
8962 | Write the printed representation of the scheme object x to the current | |
8963 | output port. Corresponds to the scheme level `write'. | |
8964 | ||
3a97e020 MD |
8965 | ** gh_list_length renamed to gh_length. |
8966 | ||
8d6787b6 MG |
8967 | ** vector handling routines |
8968 | ||
8969 | Several major changes. In particular, gh_vector() now resembles | |
8970 | (vector ...) (with a caveat -- see manual), and gh_make_vector() now | |
956328d2 MG |
8971 | exists and behaves like (make-vector ...). gh_vset() and gh_vref() |
8972 | have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing | |
8d6787b6 MG |
8973 | vector-related gh_ functions have been implemented. |
8974 | ||
7fee59bd MG |
8975 | ** pair and list routines |
8976 | ||
8977 | Implemented several of the R4RS pair and list functions that were | |
8978 | missing. | |
8979 | ||
171422a9 MD |
8980 | ** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect |
8981 | ||
8982 | New function. Converts double arrays back and forth between Scheme | |
8983 | and C. | |
8984 | ||
c484bf7f JB |
8985 | * Changes to the scm_ interface |
8986 | ||
8986901b JB |
8987 | ** The function scm_boot_guile now takes care of loading the startup files. |
8988 | ||
8989 | Guile's primary initialization function, scm_boot_guile, now takes | |
8990 | care of loading `boot-9.scm', in the `ice-9' module, to initialize | |
8991 | Guile, define the module system, and put together some standard | |
8992 | bindings. It also loads `init.scm', which is intended to hold | |
8993 | site-specific initialization code. | |
8994 | ||
8995 | Since Guile cannot operate properly until boot-9.scm is loaded, there | |
8996 | is no reason to separate loading boot-9.scm from Guile's other | |
8997 | initialization processes. | |
8998 | ||
8999 | This job used to be done by scm_compile_shell_switches, which didn't | |
9000 | make much sense; in particular, it meant that people using Guile for | |
9001 | non-shell-like applications had to jump through hoops to get Guile | |
9002 | initialized properly. | |
9003 | ||
9004 | ** The function scm_compile_shell_switches no longer loads the startup files. | |
9005 | Now, Guile always loads the startup files, whenever it is initialized; | |
9006 | see the notes above for scm_boot_guile and scm_load_startup_files. | |
9007 | ||
9008 | ** Function: scm_load_startup_files | |
9009 | This new function takes care of loading Guile's initialization file | |
9010 | (`boot-9.scm'), and the site initialization file, `init.scm'. Since | |
9011 | this is always called by the Guile initialization process, it's | |
9012 | probably not too useful to call this yourself, but it's there anyway. | |
9013 | ||
87148d9e JB |
9014 | ** The semantics of smob marking have changed slightly. |
9015 | ||
9016 | The smob marking function (the `mark' member of the scm_smobfuns | |
9017 | structure) is no longer responsible for setting the mark bit on the | |
9018 | smob. The generic smob handling code in the garbage collector will | |
9019 | set this bit. The mark function need only ensure that any other | |
9020 | objects the smob refers to get marked. | |
9021 | ||
9022 | Note that this change means that the smob's GC8MARK bit is typically | |
9023 | already set upon entry to the mark function. Thus, marking functions | |
9024 | which look like this: | |
9025 | ||
9026 | { | |
9027 | if (SCM_GC8MARKP (ptr)) | |
9028 | return SCM_BOOL_F; | |
9029 | SCM_SETGC8MARK (ptr); | |
9030 | ... mark objects to which the smob refers ... | |
9031 | } | |
9032 | ||
9033 | are now incorrect, since they will return early, and fail to mark any | |
9034 | other objects the smob refers to. Some code in the Guile library used | |
9035 | to work this way. | |
9036 | ||
1cf84ea5 JB |
9037 | ** The semantics of the I/O port functions in scm_ptobfuns have changed. |
9038 | ||
9039 | If you have implemented your own I/O port type, by writing the | |
9040 | functions required by the scm_ptobfuns and then calling scm_newptob, | |
9041 | you will need to change your functions slightly. | |
9042 | ||
9043 | The functions in a scm_ptobfuns structure now expect the port itself | |
9044 | as their argument; they used to expect the `stream' member of the | |
9045 | port's scm_port_table structure. This allows functions in an | |
9046 | scm_ptobfuns structure to easily access the port's cell (and any flags | |
9047 | it its CAR), and the port's scm_port_table structure. | |
9048 | ||
9049 | Guile now passes the I/O port itself as the `port' argument in the | |
9050 | following scm_ptobfuns functions: | |
9051 | ||
9052 | int (*free) (SCM port); | |
9053 | int (*fputc) (int, SCM port); | |
9054 | int (*fputs) (char *, SCM port); | |
9055 | scm_sizet (*fwrite) SCM_P ((char *ptr, | |
9056 | scm_sizet size, | |
9057 | scm_sizet nitems, | |
9058 | SCM port)); | |
9059 | int (*fflush) (SCM port); | |
9060 | int (*fgetc) (SCM port); | |
9061 | int (*fclose) (SCM port); | |
9062 | ||
9063 | The interfaces to the `mark', `print', `equalp', and `fgets' methods | |
9064 | are unchanged. | |
9065 | ||
9066 | If you have existing code which defines its own port types, it is easy | |
9067 | to convert your code to the new interface; simply apply SCM_STREAM to | |
9068 | the port argument to yield the value you code used to expect. | |
9069 | ||
9070 | Note that since both the port and the stream have the same type in the | |
9071 | C code --- they are both SCM values --- the C compiler will not remind | |
9072 | you if you forget to update your scm_ptobfuns functions. | |
9073 | ||
9074 | ||
933a7411 MD |
9075 | ** Function: int scm_internal_select (int fds, |
9076 | SELECT_TYPE *rfds, | |
9077 | SELECT_TYPE *wfds, | |
9078 | SELECT_TYPE *efds, | |
9079 | struct timeval *timeout); | |
9080 | ||
9081 | This is a replacement for the `select' function provided by the OS. | |
9082 | It enables I/O blocking and sleeping to happen for one cooperative | |
9083 | thread without blocking other threads. It also avoids busy-loops in | |
9084 | these situations. It is intended that all I/O blocking and sleeping | |
9085 | will finally go through this function. Currently, this function is | |
9086 | only available on systems providing `gettimeofday' and `select'. | |
9087 | ||
5424b4f7 MD |
9088 | ** Function: SCM scm_internal_stack_catch (SCM tag, |
9089 | scm_catch_body_t body, | |
9090 | void *body_data, | |
9091 | scm_catch_handler_t handler, | |
9092 | void *handler_data) | |
9093 | ||
9094 | A new sibling to the other two C level `catch' functions | |
9095 | scm_internal_catch and scm_internal_lazy_catch. Use it if you want | |
9096 | the stack to be saved automatically into the variable `the-last-stack' | |
9097 | (scm_the_last_stack_var) on error. This is necessary if you want to | |
9098 | use advanced error reporting, such as calling scm_display_error and | |
9099 | scm_display_backtrace. (They both take a stack object as argument.) | |
9100 | ||
df366c26 MD |
9101 | ** Function: SCM scm_spawn_thread (scm_catch_body_t body, |
9102 | void *body_data, | |
9103 | scm_catch_handler_t handler, | |
9104 | void *handler_data) | |
9105 | ||
9106 | Spawns a new thread. It does a job similar to | |
9107 | scm_call_with_new_thread but takes arguments more suitable when | |
9108 | spawning threads from application C code. | |
9109 | ||
88482b31 MD |
9110 | ** The hook scm_error_callback has been removed. It was originally |
9111 | intended as a way for the user to install his own error handler. But | |
9112 | that method works badly since it intervenes between throw and catch, | |
9113 | thereby changing the semantics of expressions like (catch #t ...). | |
9114 | The correct way to do it is to use one of the C level catch functions | |
9115 | in throw.c: scm_internal_catch/lazy_catch/stack_catch. | |
9116 | ||
3a97e020 MD |
9117 | ** Removed functions: |
9118 | ||
9119 | scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x, | |
9120 | scm_list_reverse, scm_list_reverse_x | |
9121 | ||
9122 | ** New macros: SCM_LISTn where n is one of the integers 0-9. | |
9123 | ||
9124 | These can be used for pretty list creation from C. The idea is taken | |
9125 | from Erick Gallesio's STk. | |
9126 | ||
298aa6e3 MD |
9127 | ** scm_array_map renamed to scm_array_map_x |
9128 | ||
527da704 MD |
9129 | ** mbstrings are now removed |
9130 | ||
9131 | This means that the type codes scm_tc7_mb_string and | |
9132 | scm_tc7_mb_substring has been removed. | |
9133 | ||
8cd57bd0 JB |
9134 | ** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed. |
9135 | ||
9136 | Since we no longer support multi-byte strings, these I/O functions | |
9137 | have been simplified, and renamed. Here are their old names, and | |
9138 | their new names and arguments: | |
9139 | ||
9140 | scm_gen_putc -> void scm_putc (int c, SCM port); | |
9141 | scm_gen_puts -> void scm_puts (char *s, SCM port); | |
9142 | scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port); | |
9143 | scm_gen_getc -> void scm_getc (SCM port); | |
9144 | ||
9145 | ||
527da704 MD |
9146 | ** The macros SCM_TYP7D and SCM_TYP7SD has been removed. |
9147 | ||
9148 | ** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D | |
9149 | ||
9150 | SCM_TYP7S now masks away the bit which distinguishes substrings from | |
9151 | strings. | |
9152 | ||
660f41fa MD |
9153 | ** scm_catch_body_t: Backward incompatible change! |
9154 | ||
9155 | Body functions to scm_internal_catch and friends do not any longer | |
9156 | take a second argument. This is because it is no longer possible to | |
9157 | pass a #f arg to catch. | |
9158 | ||
a8e05009 JB |
9159 | ** Calls to scm_protect_object and scm_unprotect now nest properly. |
9160 | ||
9161 | The function scm_protect_object protects its argument from being freed | |
9162 | by the garbage collector. scm_unprotect_object removes that | |
9163 | protection. | |
9164 | ||
9165 | These functions now nest properly. That is, for every object O, there | |
9166 | is a counter which scm_protect_object(O) increments and | |
9167 | scm_unprotect_object(O) decrements, if the counter is greater than | |
9168 | zero. Every object's counter is zero when it is first created. If an | |
9169 | object's counter is greater than zero, the garbage collector will not | |
9170 | reclaim its storage. | |
9171 | ||
9172 | This allows you to use scm_protect_object in your code without | |
9173 | worrying that some other function you call will call | |
9174 | scm_unprotect_object, and allow it to be freed. Assuming that the | |
9175 | functions you call are well-behaved, and unprotect only those objects | |
9176 | they protect, you can follow the same rule and have confidence that | |
9177 | objects will be freed only at appropriate times. | |
9178 | ||
c484bf7f JB |
9179 | \f |
9180 | Changes in Guile 1.2 (released Tuesday, June 24 1997): | |
cf78e9e8 | 9181 | |
737c9113 JB |
9182 | * Changes to the distribution |
9183 | ||
832b09ed JB |
9184 | ** Nightly snapshots are now available from ftp.red-bean.com. |
9185 | The old server, ftp.cyclic.com, has been relinquished to its rightful | |
9186 | owner. | |
9187 | ||
9188 | Nightly snapshots of the Guile development sources are now available via | |
9189 | anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz. | |
9190 | ||
9191 | Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz | |
9192 | For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz | |
9193 | ||
0fcab5ed JB |
9194 | ** To run Guile without installing it, the procedure has changed a bit. |
9195 | ||
9196 | If you used a separate build directory to compile Guile, you'll need | |
9197 | to include the build directory in SCHEME_LOAD_PATH, as well as the | |
9198 | source directory. See the `INSTALL' file for examples. | |
9199 | ||
737c9113 JB |
9200 | * Changes to the procedure for linking libguile with your programs |
9201 | ||
94982a4e JB |
9202 | ** The standard Guile load path for Scheme code now includes |
9203 | $(datadir)/guile (usually /usr/local/share/guile). This means that | |
9204 | you can install your own Scheme files there, and Guile will find them. | |
9205 | (Previous versions of Guile only checked a directory whose name | |
9206 | contained the Guile version number, so you had to re-install or move | |
9207 | your Scheme sources each time you installed a fresh version of Guile.) | |
9208 | ||
9209 | The load path also includes $(datadir)/guile/site; we recommend | |
9210 | putting individual Scheme files there. If you want to install a | |
9211 | package with multiple source files, create a directory for them under | |
9212 | $(datadir)/guile. | |
9213 | ||
9214 | ** Guile 1.2 will now use the Rx regular expression library, if it is | |
9215 | installed on your system. When you are linking libguile into your own | |
9216 | programs, this means you will have to link against -lguile, -lqt (if | |
9217 | you configured Guile with thread support), and -lrx. | |
27590f82 JB |
9218 | |
9219 | If you are using autoconf to generate configuration scripts for your | |
9220 | application, the following lines should suffice to add the appropriate | |
9221 | libraries to your link command: | |
9222 | ||
9223 | ### Find Rx, quickthreads and libguile. | |
9224 | AC_CHECK_LIB(rx, main) | |
9225 | AC_CHECK_LIB(qt, main) | |
9226 | AC_CHECK_LIB(guile, scm_shell) | |
9227 | ||
94982a4e JB |
9228 | The Guile 1.2 distribution does not contain sources for the Rx |
9229 | library, as Guile 1.0 did. If you want to use Rx, you'll need to | |
9230 | retrieve it from a GNU FTP site and install it separately. | |
9231 | ||
b83b8bee JB |
9232 | * Changes to Scheme functions and syntax |
9233 | ||
e035e7e6 MV |
9234 | ** The dynamic linking features of Guile are now enabled by default. |
9235 | You can disable them by giving the `--disable-dynamic-linking' option | |
9236 | to configure. | |
9237 | ||
e035e7e6 MV |
9238 | (dynamic-link FILENAME) |
9239 | ||
9240 | Find the object file denoted by FILENAME (a string) and link it | |
9241 | into the running Guile application. When everything works out, | |
9242 | return a Scheme object suitable for representing the linked object | |
9243 | file. Otherwise an error is thrown. How object files are | |
9244 | searched is system dependent. | |
9245 | ||
9246 | (dynamic-object? VAL) | |
9247 | ||
9248 | Determine whether VAL represents a dynamically linked object file. | |
9249 | ||
9250 | (dynamic-unlink DYNOBJ) | |
9251 | ||
9252 | Unlink the indicated object file from the application. DYNOBJ | |
9253 | should be one of the values returned by `dynamic-link'. | |
9254 | ||
9255 | (dynamic-func FUNCTION DYNOBJ) | |
9256 | ||
9257 | Search the C function indicated by FUNCTION (a string or symbol) | |
9258 | in DYNOBJ and return some Scheme object that can later be used | |
9259 | with `dynamic-call' to actually call this function. Right now, | |
9260 | these Scheme objects are formed by casting the address of the | |
9261 | function to `long' and converting this number to its Scheme | |
9262 | representation. | |
9263 | ||
9264 | (dynamic-call FUNCTION DYNOBJ) | |
9265 | ||
9266 | Call the C function indicated by FUNCTION and DYNOBJ. The | |
9267 | function is passed no arguments and its return value is ignored. | |
9268 | When FUNCTION is something returned by `dynamic-func', call that | |
9269 | function and ignore DYNOBJ. When FUNCTION is a string (or symbol, | |
9270 | etc.), look it up in DYNOBJ; this is equivalent to | |
9271 | ||
9272 | (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f) | |
9273 | ||
9274 | Interrupts are deferred while the C function is executing (with | |
9275 | SCM_DEFER_INTS/SCM_ALLOW_INTS). | |
9276 | ||
9277 | (dynamic-args-call FUNCTION DYNOBJ ARGS) | |
9278 | ||
9279 | Call the C function indicated by FUNCTION and DYNOBJ, but pass it | |
9280 | some arguments and return its return value. The C function is | |
9281 | expected to take two arguments and return an `int', just like | |
9282 | `main': | |
9283 | ||
9284 | int c_func (int argc, char **argv); | |
9285 | ||
9286 | ARGS must be a list of strings and is converted into an array of | |
9287 | `char *'. The array is passed in ARGV and its size in ARGC. The | |
9288 | return value is converted to a Scheme number and returned from the | |
9289 | call to `dynamic-args-call'. | |
9290 | ||
0fcab5ed JB |
9291 | When dynamic linking is disabled or not supported on your system, |
9292 | the above functions throw errors, but they are still available. | |
9293 | ||
e035e7e6 MV |
9294 | Here is a small example that works on GNU/Linux: |
9295 | ||
9296 | (define libc-obj (dynamic-link "libc.so")) | |
9297 | (dynamic-args-call 'rand libc-obj '()) | |
9298 | ||
9299 | See the file `libguile/DYNAMIC-LINKING' for additional comments. | |
9300 | ||
27590f82 | 9301 | ** The #/ syntax for module names is depreciated, and will be removed |
6c0201ad | 9302 | in a future version of Guile. Instead of |
27590f82 JB |
9303 | |
9304 | #/foo/bar/baz | |
9305 | ||
9306 | instead write | |
9307 | ||
9308 | (foo bar baz) | |
9309 | ||
9310 | The latter syntax is more consistent with existing Lisp practice. | |
9311 | ||
5dade857 MV |
9312 | ** Guile now does fancier printing of structures. Structures are the |
9313 | underlying implementation for records, which in turn are used to | |
9314 | implement modules, so all of these object now print differently and in | |
9315 | a more informative way. | |
9316 | ||
161029df JB |
9317 | The Scheme printer will examine the builtin variable *struct-printer* |
9318 | whenever it needs to print a structure object. When this variable is | |
9319 | not `#f' it is deemed to be a procedure and will be applied to the | |
9320 | structure object and the output port. When *struct-printer* is `#f' | |
9321 | or the procedure return `#f' the structure object will be printed in | |
9322 | the boring #<struct 80458270> form. | |
5dade857 MV |
9323 | |
9324 | This hook is used by some routines in ice-9/boot-9.scm to implement | |
9325 | type specific printing routines. Please read the comments there about | |
9326 | "printing structs". | |
9327 | ||
9328 | One of the more specific uses of structs are records. The printing | |
9329 | procedure that could be passed to MAKE-RECORD-TYPE is now actually | |
9330 | called. It should behave like a *struct-printer* procedure (described | |
9331 | above). | |
9332 | ||
b83b8bee JB |
9333 | ** Guile now supports a new R4RS-compliant syntax for keywords. A |
9334 | token of the form #:NAME, where NAME has the same syntax as a Scheme | |
9335 | symbol, is the external representation of the keyword named NAME. | |
9336 | Keyword objects print using this syntax as well, so values containing | |
1e5afba0 JB |
9337 | keyword objects can be read back into Guile. When used in an |
9338 | expression, keywords are self-quoting objects. | |
b83b8bee JB |
9339 | |
9340 | Guile suports this read syntax, and uses this print syntax, regardless | |
9341 | of the current setting of the `keyword' read option. The `keyword' | |
9342 | read option only controls whether Guile recognizes the `:NAME' syntax, | |
9343 | which is incompatible with R4RS. (R4RS says such token represent | |
9344 | symbols.) | |
737c9113 JB |
9345 | |
9346 | ** Guile has regular expression support again. Guile 1.0 included | |
9347 | functions for matching regular expressions, based on the Rx library. | |
9348 | In Guile 1.1, the Guile/Rx interface was removed to simplify the | |
9349 | distribution, and thus Guile had no regular expression support. Guile | |
94982a4e JB |
9350 | 1.2 again supports the most commonly used functions, and supports all |
9351 | of SCSH's regular expression functions. | |
2409cdfa | 9352 | |
94982a4e JB |
9353 | If your system does not include a POSIX regular expression library, |
9354 | and you have not linked Guile with a third-party regexp library such as | |
9355 | Rx, these functions will not be available. You can tell whether your | |
9356 | Guile installation includes regular expression support by checking | |
9357 | whether the `*features*' list includes the `regex' symbol. | |
737c9113 | 9358 | |
94982a4e | 9359 | *** regexp functions |
161029df | 9360 | |
94982a4e JB |
9361 | By default, Guile supports POSIX extended regular expressions. That |
9362 | means that the characters `(', `)', `+' and `?' are special, and must | |
9363 | be escaped if you wish to match the literal characters. | |
e1a191a8 | 9364 | |
94982a4e JB |
9365 | This regular expression interface was modeled after that implemented |
9366 | by SCSH, the Scheme Shell. It is intended to be upwardly compatible | |
9367 | with SCSH regular expressions. | |
9368 | ||
9369 | **** Function: string-match PATTERN STR [START] | |
9370 | Compile the string PATTERN into a regular expression and compare | |
9371 | it with STR. The optional numeric argument START specifies the | |
9372 | position of STR at which to begin matching. | |
9373 | ||
9374 | `string-match' returns a "match structure" which describes what, | |
9375 | if anything, was matched by the regular expression. *Note Match | |
9376 | Structures::. If STR does not match PATTERN at all, | |
9377 | `string-match' returns `#f'. | |
9378 | ||
9379 | Each time `string-match' is called, it must compile its PATTERN | |
9380 | argument into a regular expression structure. This operation is | |
9381 | expensive, which makes `string-match' inefficient if the same regular | |
9382 | expression is used several times (for example, in a loop). For better | |
9383 | performance, you can compile a regular expression in advance and then | |
9384 | match strings against the compiled regexp. | |
9385 | ||
9386 | **** Function: make-regexp STR [FLAGS] | |
9387 | Compile the regular expression described by STR, and return the | |
9388 | compiled regexp structure. If STR does not describe a legal | |
9389 | regular expression, `make-regexp' throws a | |
9390 | `regular-expression-syntax' error. | |
9391 | ||
9392 | FLAGS may be the bitwise-or of one or more of the following: | |
9393 | ||
9394 | **** Constant: regexp/extended | |
9395 | Use POSIX Extended Regular Expression syntax when interpreting | |
9396 | STR. If not set, POSIX Basic Regular Expression syntax is used. | |
9397 | If the FLAGS argument is omitted, we assume regexp/extended. | |
9398 | ||
9399 | **** Constant: regexp/icase | |
9400 | Do not differentiate case. Subsequent searches using the | |
9401 | returned regular expression will be case insensitive. | |
9402 | ||
9403 | **** Constant: regexp/newline | |
9404 | Match-any-character operators don't match a newline. | |
9405 | ||
9406 | A non-matching list ([^...]) not containing a newline matches a | |
9407 | newline. | |
9408 | ||
9409 | Match-beginning-of-line operator (^) matches the empty string | |
9410 | immediately after a newline, regardless of whether the FLAGS | |
9411 | passed to regexp-exec contain regexp/notbol. | |
9412 | ||
9413 | Match-end-of-line operator ($) matches the empty string | |
9414 | immediately before a newline, regardless of whether the FLAGS | |
9415 | passed to regexp-exec contain regexp/noteol. | |
9416 | ||
9417 | **** Function: regexp-exec REGEXP STR [START [FLAGS]] | |
9418 | Match the compiled regular expression REGEXP against `str'. If | |
9419 | the optional integer START argument is provided, begin matching | |
9420 | from that position in the string. Return a match structure | |
9421 | describing the results of the match, or `#f' if no match could be | |
9422 | found. | |
9423 | ||
9424 | FLAGS may be the bitwise-or of one or more of the following: | |
9425 | ||
9426 | **** Constant: regexp/notbol | |
9427 | The match-beginning-of-line operator always fails to match (but | |
9428 | see the compilation flag regexp/newline above) This flag may be | |
9429 | used when different portions of a string are passed to | |
9430 | regexp-exec and the beginning of the string should not be | |
9431 | interpreted as the beginning of the line. | |
9432 | ||
9433 | **** Constant: regexp/noteol | |
9434 | The match-end-of-line operator always fails to match (but see the | |
9435 | compilation flag regexp/newline above) | |
9436 | ||
9437 | **** Function: regexp? OBJ | |
9438 | Return `#t' if OBJ is a compiled regular expression, or `#f' | |
9439 | otherwise. | |
9440 | ||
9441 | Regular expressions are commonly used to find patterns in one string | |
9442 | and replace them with the contents of another string. | |
9443 | ||
9444 | **** Function: regexp-substitute PORT MATCH [ITEM...] | |
9445 | Write to the output port PORT selected contents of the match | |
9446 | structure MATCH. Each ITEM specifies what should be written, and | |
9447 | may be one of the following arguments: | |
9448 | ||
9449 | * A string. String arguments are written out verbatim. | |
9450 | ||
9451 | * An integer. The submatch with that number is written. | |
9452 | ||
9453 | * The symbol `pre'. The portion of the matched string preceding | |
9454 | the regexp match is written. | |
9455 | ||
9456 | * The symbol `post'. The portion of the matched string | |
9457 | following the regexp match is written. | |
9458 | ||
9459 | PORT may be `#f', in which case nothing is written; instead, | |
9460 | `regexp-substitute' constructs a string from the specified ITEMs | |
9461 | and returns that. | |
9462 | ||
9463 | **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...] | |
9464 | Similar to `regexp-substitute', but can be used to perform global | |
9465 | substitutions on STR. Instead of taking a match structure as an | |
9466 | argument, `regexp-substitute/global' takes two string arguments: a | |
9467 | REGEXP string describing a regular expression, and a TARGET string | |
9468 | which should be matched against this regular expression. | |
9469 | ||
9470 | Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following | |
9471 | exceptions: | |
9472 | ||
9473 | * A function may be supplied. When this function is called, it | |
9474 | will be passed one argument: a match structure for a given | |
9475 | regular expression match. It should return a string to be | |
9476 | written out to PORT. | |
9477 | ||
9478 | * The `post' symbol causes `regexp-substitute/global' to recurse | |
9479 | on the unmatched portion of STR. This *must* be supplied in | |
9480 | order to perform global search-and-replace on STR; if it is | |
9481 | not present among the ITEMs, then `regexp-substitute/global' | |
9482 | will return after processing a single match. | |
9483 | ||
9484 | *** Match Structures | |
9485 | ||
9486 | A "match structure" is the object returned by `string-match' and | |
9487 | `regexp-exec'. It describes which portion of a string, if any, matched | |
9488 | the given regular expression. Match structures include: a reference to | |
9489 | the string that was checked for matches; the starting and ending | |
9490 | positions of the regexp match; and, if the regexp included any | |
9491 | parenthesized subexpressions, the starting and ending positions of each | |
9492 | submatch. | |
9493 | ||
9494 | In each of the regexp match functions described below, the `match' | |
9495 | argument must be a match structure returned by a previous call to | |
9496 | `string-match' or `regexp-exec'. Most of these functions return some | |
9497 | information about the original target string that was matched against a | |
9498 | regular expression; we will call that string TARGET for easy reference. | |
9499 | ||
9500 | **** Function: regexp-match? OBJ | |
9501 | Return `#t' if OBJ is a match structure returned by a previous | |
9502 | call to `regexp-exec', or `#f' otherwise. | |
9503 | ||
9504 | **** Function: match:substring MATCH [N] | |
9505 | Return the portion of TARGET matched by subexpression number N. | |
9506 | Submatch 0 (the default) represents the entire regexp match. If | |
9507 | the regular expression as a whole matched, but the subexpression | |
9508 | number N did not match, return `#f'. | |
9509 | ||
9510 | **** Function: match:start MATCH [N] | |
9511 | Return the starting position of submatch number N. | |
9512 | ||
9513 | **** Function: match:end MATCH [N] | |
9514 | Return the ending position of submatch number N. | |
9515 | ||
9516 | **** Function: match:prefix MATCH | |
9517 | Return the unmatched portion of TARGET preceding the regexp match. | |
9518 | ||
9519 | **** Function: match:suffix MATCH | |
9520 | Return the unmatched portion of TARGET following the regexp match. | |
9521 | ||
9522 | **** Function: match:count MATCH | |
9523 | Return the number of parenthesized subexpressions from MATCH. | |
9524 | Note that the entire regular expression match itself counts as a | |
9525 | subexpression, and failed submatches are included in the count. | |
9526 | ||
9527 | **** Function: match:string MATCH | |
9528 | Return the original TARGET string. | |
9529 | ||
9530 | *** Backslash Escapes | |
9531 | ||
9532 | Sometimes you will want a regexp to match characters like `*' or `$' | |
9533 | exactly. For example, to check whether a particular string represents | |
9534 | a menu entry from an Info node, it would be useful to match it against | |
9535 | a regexp like `^* [^:]*::'. However, this won't work; because the | |
9536 | asterisk is a metacharacter, it won't match the `*' at the beginning of | |
9537 | the string. In this case, we want to make the first asterisk un-magic. | |
9538 | ||
9539 | You can do this by preceding the metacharacter with a backslash | |
9540 | character `\'. (This is also called "quoting" the metacharacter, and | |
9541 | is known as a "backslash escape".) When Guile sees a backslash in a | |
9542 | regular expression, it considers the following glyph to be an ordinary | |
9543 | character, no matter what special meaning it would ordinarily have. | |
9544 | Therefore, we can make the above example work by changing the regexp to | |
9545 | `^\* [^:]*::'. The `\*' sequence tells the regular expression engine | |
9546 | to match only a single asterisk in the target string. | |
9547 | ||
9548 | Since the backslash is itself a metacharacter, you may force a | |
9549 | regexp to match a backslash in the target string by preceding the | |
9550 | backslash with itself. For example, to find variable references in a | |
9551 | TeX program, you might want to find occurrences of the string `\let\' | |
9552 | followed by any number of alphabetic characters. The regular expression | |
9553 | `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp | |
9554 | each match a single backslash in the target string. | |
9555 | ||
9556 | **** Function: regexp-quote STR | |
9557 | Quote each special character found in STR with a backslash, and | |
9558 | return the resulting string. | |
9559 | ||
9560 | *Very important:* Using backslash escapes in Guile source code (as | |
9561 | in Emacs Lisp or C) can be tricky, because the backslash character has | |
9562 | special meaning for the Guile reader. For example, if Guile encounters | |
9563 | the character sequence `\n' in the middle of a string while processing | |
9564 | Scheme code, it replaces those characters with a newline character. | |
9565 | Similarly, the character sequence `\t' is replaced by a horizontal tab. | |
9566 | Several of these "escape sequences" are processed by the Guile reader | |
9567 | before your code is executed. Unrecognized escape sequences are | |
9568 | ignored: if the characters `\*' appear in a string, they will be | |
9569 | translated to the single character `*'. | |
9570 | ||
9571 | This translation is obviously undesirable for regular expressions, | |
9572 | since we want to be able to include backslashes in a string in order to | |
9573 | escape regexp metacharacters. Therefore, to make sure that a backslash | |
9574 | is preserved in a string in your Guile program, you must use *two* | |
9575 | consecutive backslashes: | |
9576 | ||
9577 | (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*")) | |
9578 | ||
9579 | The string in this example is preprocessed by the Guile reader before | |
9580 | any code is executed. The resulting argument to `make-regexp' is the | |
9581 | string `^\* [^:]*', which is what we really want. | |
9582 | ||
9583 | This also means that in order to write a regular expression that | |
9584 | matches a single backslash character, the regular expression string in | |
9585 | the source code must include *four* backslashes. Each consecutive pair | |
9586 | of backslashes gets translated by the Guile reader to a single | |
9587 | backslash, and the resulting double-backslash is interpreted by the | |
9588 | regexp engine as matching a single backslash character. Hence: | |
9589 | ||
9590 | (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*")) | |
9591 | ||
9592 | The reason for the unwieldiness of this syntax is historical. Both | |
9593 | regular expression pattern matchers and Unix string processing systems | |
9594 | have traditionally used backslashes with the special meanings described | |
9595 | above. The POSIX regular expression specification and ANSI C standard | |
9596 | both require these semantics. Attempting to abandon either convention | |
9597 | would cause other kinds of compatibility problems, possibly more severe | |
9598 | ones. Therefore, without extending the Scheme reader to support | |
9599 | strings with different quoting conventions (an ungainly and confusing | |
9600 | extension when implemented in other languages), we must adhere to this | |
9601 | cumbersome escape syntax. | |
9602 | ||
7ad3c1e7 GH |
9603 | * Changes to the gh_ interface |
9604 | ||
9605 | * Changes to the scm_ interface | |
9606 | ||
9607 | * Changes to system call interfaces: | |
94982a4e | 9608 | |
7ad3c1e7 | 9609 | ** The value returned by `raise' is now unspecified. It throws an exception |
e1a191a8 GH |
9610 | if an error occurs. |
9611 | ||
94982a4e | 9612 | *** A new procedure `sigaction' can be used to install signal handlers |
115b09a5 GH |
9613 | |
9614 | (sigaction signum [action] [flags]) | |
9615 | ||
9616 | signum is the signal number, which can be specified using the value | |
9617 | of SIGINT etc. | |
9618 | ||
9619 | If action is omitted, sigaction returns a pair: the CAR is the current | |
9620 | signal hander, which will be either an integer with the value SIG_DFL | |
9621 | (default action) or SIG_IGN (ignore), or the Scheme procedure which | |
9622 | handles the signal, or #f if a non-Scheme procedure handles the | |
9623 | signal. The CDR contains the current sigaction flags for the handler. | |
9624 | ||
9625 | If action is provided, it is installed as the new handler for signum. | |
9626 | action can be a Scheme procedure taking one argument, or the value of | |
9627 | SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore | |
9628 | whatever signal handler was installed before sigaction was first used. | |
9629 | Flags can optionally be specified for the new handler (SA_RESTART is | |
9630 | always used if the system provides it, so need not be specified.) The | |
9631 | return value is a pair with information about the old handler as | |
9632 | described above. | |
9633 | ||
9634 | This interface does not provide access to the "signal blocking" | |
9635 | facility. Maybe this is not needed, since the thread support may | |
9636 | provide solutions to the problem of consistent access to data | |
9637 | structures. | |
e1a191a8 | 9638 | |
94982a4e | 9639 | *** A new procedure `flush-all-ports' is equivalent to running |
89ea5b7c GH |
9640 | `force-output' on every port open for output. |
9641 | ||
94982a4e JB |
9642 | ** Guile now provides information on how it was built, via the new |
9643 | global variable, %guile-build-info. This variable records the values | |
9644 | of the standard GNU makefile directory variables as an assocation | |
9645 | list, mapping variable names (symbols) onto directory paths (strings). | |
9646 | For example, to find out where the Guile link libraries were | |
9647 | installed, you can say: | |
9648 | ||
9649 | guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)" | |
9650 | ||
9651 | ||
9652 | * Changes to the scm_ interface | |
9653 | ||
9654 | ** The new function scm_handle_by_message_noexit is just like the | |
9655 | existing scm_handle_by_message function, except that it doesn't call | |
9656 | exit to terminate the process. Instead, it prints a message and just | |
9657 | returns #f. This might be a more appropriate catch-all handler for | |
9658 | new dynamic roots and threads. | |
9659 | ||
cf78e9e8 | 9660 | \f |
c484bf7f | 9661 | Changes in Guile 1.1 (released Friday, May 16 1997): |
f3b1485f JB |
9662 | |
9663 | * Changes to the distribution. | |
9664 | ||
9665 | The Guile 1.0 distribution has been split up into several smaller | |
9666 | pieces: | |
9667 | guile-core --- the Guile interpreter itself. | |
9668 | guile-tcltk --- the interface between the Guile interpreter and | |
9669 | Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk | |
9670 | is a toolkit for building graphical user interfaces. | |
9671 | guile-rgx-ctax --- the interface between Guile and the Rx regular | |
9672 | expression matcher, and the translator for the Ctax | |
9673 | programming language. These are packaged together because the | |
9674 | Ctax translator uses Rx to parse Ctax source code. | |
9675 | ||
095936d2 JB |
9676 | This NEWS file describes the changes made to guile-core since the 1.0 |
9677 | release. | |
9678 | ||
48d224d7 JB |
9679 | We no longer distribute the documentation, since it was either out of |
9680 | date, or incomplete. As soon as we have current documentation, we | |
9681 | will distribute it. | |
9682 | ||
0fcab5ed JB |
9683 | |
9684 | ||
f3b1485f JB |
9685 | * Changes to the stand-alone interpreter |
9686 | ||
48d224d7 JB |
9687 | ** guile now accepts command-line arguments compatible with SCSH, Olin |
9688 | Shivers' Scheme Shell. | |
9689 | ||
9690 | In general, arguments are evaluated from left to right, but there are | |
9691 | exceptions. The following switches stop argument processing, and | |
9692 | stash all remaining command-line arguments as the value returned by | |
9693 | the (command-line) function. | |
9694 | -s SCRIPT load Scheme source code from FILE, and exit | |
9695 | -c EXPR evalute Scheme expression EXPR, and exit | |
9696 | -- stop scanning arguments; run interactively | |
9697 | ||
9698 | The switches below are processed as they are encountered. | |
9699 | -l FILE load Scheme source code from FILE | |
9700 | -e FUNCTION after reading script, apply FUNCTION to | |
9701 | command line arguments | |
9702 | -ds do -s script at this point | |
9703 | --emacs enable Emacs protocol (experimental) | |
9704 | -h, --help display this help and exit | |
9705 | -v, --version display version information and exit | |
9706 | \ read arguments from following script lines | |
9707 | ||
9708 | So, for example, here is a Guile script named `ekko' (thanks, Olin) | |
9709 | which re-implements the traditional "echo" command: | |
9710 | ||
9711 | #!/usr/local/bin/guile -s | |
9712 | !# | |
9713 | (define (main args) | |
9714 | (map (lambda (arg) (display arg) (display " ")) | |
9715 | (cdr args)) | |
9716 | (newline)) | |
9717 | ||
9718 | (main (command-line)) | |
9719 | ||
9720 | Suppose we invoke this script as follows: | |
9721 | ||
9722 | ekko a speckled gecko | |
9723 | ||
9724 | Through the magic of Unix script processing (triggered by the `#!' | |
9725 | token at the top of the file), /usr/local/bin/guile receives the | |
9726 | following list of command-line arguments: | |
9727 | ||
9728 | ("-s" "./ekko" "a" "speckled" "gecko") | |
9729 | ||
9730 | Unix inserts the name of the script after the argument specified on | |
9731 | the first line of the file (in this case, "-s"), and then follows that | |
9732 | with the arguments given to the script. Guile loads the script, which | |
9733 | defines the `main' function, and then applies it to the list of | |
9734 | remaining command-line arguments, ("a" "speckled" "gecko"). | |
9735 | ||
095936d2 JB |
9736 | In Unix, the first line of a script file must take the following form: |
9737 | ||
9738 | #!INTERPRETER ARGUMENT | |
9739 | ||
9740 | where INTERPRETER is the absolute filename of the interpreter | |
9741 | executable, and ARGUMENT is a single command-line argument to pass to | |
9742 | the interpreter. | |
9743 | ||
9744 | You may only pass one argument to the interpreter, and its length is | |
9745 | limited. These restrictions can be annoying to work around, so Guile | |
9746 | provides a general mechanism (borrowed from, and compatible with, | |
9747 | SCSH) for circumventing them. | |
9748 | ||
9749 | If the ARGUMENT in a Guile script is a single backslash character, | |
9750 | `\', Guile will open the script file, parse arguments from its second | |
9751 | and subsequent lines, and replace the `\' with them. So, for example, | |
9752 | here is another implementation of the `ekko' script: | |
9753 | ||
9754 | #!/usr/local/bin/guile \ | |
9755 | -e main -s | |
9756 | !# | |
9757 | (define (main args) | |
9758 | (for-each (lambda (arg) (display arg) (display " ")) | |
9759 | (cdr args)) | |
9760 | (newline)) | |
9761 | ||
9762 | If the user invokes this script as follows: | |
9763 | ||
9764 | ekko a speckled gecko | |
9765 | ||
9766 | Unix expands this into | |
9767 | ||
9768 | /usr/local/bin/guile \ ekko a speckled gecko | |
9769 | ||
9770 | When Guile sees the `\' argument, it replaces it with the arguments | |
9771 | read from the second line of the script, producing: | |
9772 | ||
9773 | /usr/local/bin/guile -e main -s ekko a speckled gecko | |
9774 | ||
9775 | This tells Guile to load the `ekko' script, and apply the function | |
9776 | `main' to the argument list ("a" "speckled" "gecko"). | |
9777 | ||
9778 | Here is how Guile parses the command-line arguments: | |
9779 | - Each space character terminates an argument. This means that two | |
9780 | spaces in a row introduce an empty-string argument. | |
9781 | - The tab character is not permitted (unless you quote it with the | |
9782 | backslash character, as described below), to avoid confusion. | |
9783 | - The newline character terminates the sequence of arguments, and will | |
9784 | also terminate a final non-empty argument. (However, a newline | |
9785 | following a space will not introduce a final empty-string argument; | |
9786 | it only terminates the argument list.) | |
9787 | - The backslash character is the escape character. It escapes | |
9788 | backslash, space, tab, and newline. The ANSI C escape sequences | |
9789 | like \n and \t are also supported. These produce argument | |
9790 | constituents; the two-character combination \n doesn't act like a | |
9791 | terminating newline. The escape sequence \NNN for exactly three | |
9792 | octal digits reads as the character whose ASCII code is NNN. As | |
9793 | above, characters produced this way are argument constituents. | |
9794 | Backslash followed by other characters is not allowed. | |
9795 | ||
48d224d7 JB |
9796 | * Changes to the procedure for linking libguile with your programs |
9797 | ||
9798 | ** Guile now builds and installs a shared guile library, if your | |
9799 | system support shared libraries. (It still builds a static library on | |
9800 | all systems.) Guile automatically detects whether your system | |
9801 | supports shared libraries. To prevent Guile from buildisg shared | |
9802 | libraries, pass the `--disable-shared' flag to the configure script. | |
9803 | ||
9804 | Guile takes longer to compile when it builds shared libraries, because | |
9805 | it must compile every file twice --- once to produce position- | |
9806 | independent object code, and once to produce normal object code. | |
9807 | ||
9808 | ** The libthreads library has been merged into libguile. | |
9809 | ||
9810 | To link a program against Guile, you now need only link against | |
9811 | -lguile and -lqt; -lthreads is no longer needed. If you are using | |
9812 | autoconf to generate configuration scripts for your application, the | |
9813 | following lines should suffice to add the appropriate libraries to | |
9814 | your link command: | |
9815 | ||
9816 | ### Find quickthreads and libguile. | |
9817 | AC_CHECK_LIB(qt, main) | |
9818 | AC_CHECK_LIB(guile, scm_shell) | |
f3b1485f JB |
9819 | |
9820 | * Changes to Scheme functions | |
9821 | ||
095936d2 JB |
9822 | ** Guile Scheme's special syntax for keyword objects is now optional, |
9823 | and disabled by default. | |
9824 | ||
9825 | The syntax variation from R4RS made it difficult to port some | |
9826 | interesting packages to Guile. The routines which accepted keyword | |
9827 | arguments (mostly in the module system) have been modified to also | |
9828 | accept symbols whose names begin with `:'. | |
9829 | ||
9830 | To change the keyword syntax, you must first import the (ice-9 debug) | |
9831 | module: | |
9832 | (use-modules (ice-9 debug)) | |
9833 | ||
9834 | Then you can enable the keyword syntax as follows: | |
9835 | (read-set! keywords 'prefix) | |
9836 | ||
9837 | To disable keyword syntax, do this: | |
9838 | (read-set! keywords #f) | |
9839 | ||
9840 | ** Many more primitive functions accept shared substrings as | |
9841 | arguments. In the past, these functions required normal, mutable | |
9842 | strings as arguments, although they never made use of this | |
9843 | restriction. | |
9844 | ||
9845 | ** The uniform array functions now operate on byte vectors. These | |
9846 | functions are `array-fill!', `serial-array-copy!', `array-copy!', | |
9847 | `serial-array-map', `array-map', `array-for-each', and | |
9848 | `array-index-map!'. | |
9849 | ||
9850 | ** The new functions `trace' and `untrace' implement simple debugging | |
9851 | support for Scheme functions. | |
9852 | ||
9853 | The `trace' function accepts any number of procedures as arguments, | |
9854 | and tells the Guile interpreter to display each procedure's name and | |
9855 | arguments each time the procedure is invoked. When invoked with no | |
9856 | arguments, `trace' returns the list of procedures currently being | |
9857 | traced. | |
9858 | ||
9859 | The `untrace' function accepts any number of procedures as arguments, | |
9860 | and tells the Guile interpreter not to trace them any more. When | |
9861 | invoked with no arguments, `untrace' untraces all curretly traced | |
9862 | procedures. | |
9863 | ||
9864 | The tracing in Guile has an advantage over most other systems: we | |
9865 | don't create new procedure objects, but mark the procedure objects | |
9866 | themselves. This means that anonymous and internal procedures can be | |
9867 | traced. | |
9868 | ||
9869 | ** The function `assert-repl-prompt' has been renamed to | |
9870 | `set-repl-prompt!'. It takes one argument, PROMPT. | |
9871 | - If PROMPT is #f, the Guile read-eval-print loop will not prompt. | |
9872 | - If PROMPT is a string, we use it as a prompt. | |
9873 | - If PROMPT is a procedure accepting no arguments, we call it, and | |
9874 | display the result as a prompt. | |
9875 | - Otherwise, we display "> ". | |
9876 | ||
9877 | ** The new function `eval-string' reads Scheme expressions from a | |
9878 | string and evaluates them, returning the value of the last expression | |
9879 | in the string. If the string contains no expressions, it returns an | |
9880 | unspecified value. | |
9881 | ||
9882 | ** The new function `thunk?' returns true iff its argument is a | |
9883 | procedure of zero arguments. | |
9884 | ||
9885 | ** `defined?' is now a builtin function, instead of syntax. This | |
9886 | means that its argument should be quoted. It returns #t iff its | |
9887 | argument is bound in the current module. | |
9888 | ||
9889 | ** The new syntax `use-modules' allows you to add new modules to your | |
9890 | environment without re-typing a complete `define-module' form. It | |
9891 | accepts any number of module names as arguments, and imports their | |
9892 | public bindings into the current module. | |
9893 | ||
9894 | ** The new function (module-defined? NAME MODULE) returns true iff | |
9895 | NAME, a symbol, is defined in MODULE, a module object. | |
9896 | ||
9897 | ** The new function `builtin-bindings' creates and returns a hash | |
9898 | table containing copies of all the root module's bindings. | |
9899 | ||
9900 | ** The new function `builtin-weak-bindings' does the same as | |
9901 | `builtin-bindings', but creates a doubly-weak hash table. | |
9902 | ||
9903 | ** The `equal?' function now considers variable objects to be | |
9904 | equivalent if they have the same name and the same value. | |
9905 | ||
9906 | ** The new function `command-line' returns the command-line arguments | |
9907 | given to Guile, as a list of strings. | |
9908 | ||
9909 | When using guile as a script interpreter, `command-line' returns the | |
9910 | script's arguments; those processed by the interpreter (like `-s' or | |
9911 | `-c') are omitted. (In other words, you get the normal, expected | |
9912 | behavior.) Any application that uses scm_shell to process its | |
9913 | command-line arguments gets this behavior as well. | |
9914 | ||
9915 | ** The new function `load-user-init' looks for a file called `.guile' | |
9916 | in the user's home directory, and loads it if it exists. This is | |
9917 | mostly for use by the code generated by scm_compile_shell_switches, | |
9918 | but we thought it might also be useful in other circumstances. | |
9919 | ||
9920 | ** The new function `log10' returns the base-10 logarithm of its | |
9921 | argument. | |
9922 | ||
9923 | ** Changes to I/O functions | |
9924 | ||
6c0201ad | 9925 | *** The functions `read', `primitive-load', `read-and-eval!', and |
095936d2 JB |
9926 | `primitive-load-path' no longer take optional arguments controlling |
9927 | case insensitivity and a `#' parser. | |
9928 | ||
9929 | Case sensitivity is now controlled by a read option called | |
9930 | `case-insensitive'. The user can add new `#' syntaxes with the | |
9931 | `read-hash-extend' function (see below). | |
9932 | ||
9933 | *** The new function `read-hash-extend' allows the user to change the | |
9934 | syntax of Guile Scheme in a somewhat controlled way. | |
9935 | ||
9936 | (read-hash-extend CHAR PROC) | |
9937 | When parsing S-expressions, if we read a `#' character followed by | |
9938 | the character CHAR, use PROC to parse an object from the stream. | |
9939 | If PROC is #f, remove any parsing procedure registered for CHAR. | |
9940 | ||
9941 | The reader applies PROC to two arguments: CHAR and an input port. | |
9942 | ||
6c0201ad | 9943 | *** The new functions read-delimited and read-delimited! provide a |
095936d2 JB |
9944 | general mechanism for doing delimited input on streams. |
9945 | ||
9946 | (read-delimited DELIMS [PORT HANDLE-DELIM]) | |
9947 | Read until we encounter one of the characters in DELIMS (a string), | |
9948 | or end-of-file. PORT is the input port to read from; it defaults to | |
9949 | the current input port. The HANDLE-DELIM parameter determines how | |
9950 | the terminating character is handled; it should be one of the | |
9951 | following symbols: | |
9952 | ||
9953 | 'trim omit delimiter from result | |
9954 | 'peek leave delimiter character in input stream | |
9955 | 'concat append delimiter character to returned value | |
9956 | 'split return a pair: (RESULT . TERMINATOR) | |
9957 | ||
9958 | HANDLE-DELIM defaults to 'peek. | |
9959 | ||
9960 | (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END]) | |
9961 | A side-effecting variant of `read-delimited'. | |
9962 | ||
9963 | The data is written into the string BUF at the indices in the | |
9964 | half-open interval [START, END); the default interval is the whole | |
9965 | string: START = 0 and END = (string-length BUF). The values of | |
9966 | START and END must specify a well-defined interval in BUF, i.e. | |
9967 | 0 <= START <= END <= (string-length BUF). | |
9968 | ||
9969 | It returns NBYTES, the number of bytes read. If the buffer filled | |
9970 | up without a delimiter character being found, it returns #f. If the | |
9971 | port is at EOF when the read starts, it returns the EOF object. | |
9972 | ||
9973 | If an integer is returned (i.e., the read is successfully terminated | |
9974 | by reading a delimiter character), then the HANDLE-DELIM parameter | |
9975 | determines how to handle the terminating character. It is described | |
9976 | above, and defaults to 'peek. | |
9977 | ||
9978 | (The descriptions of these functions were borrowed from the SCSH | |
9979 | manual, by Olin Shivers and Brian Carlstrom.) | |
9980 | ||
9981 | *** The `%read-delimited!' function is the primitive used to implement | |
9982 | `read-delimited' and `read-delimited!'. | |
9983 | ||
9984 | (%read-delimited! DELIMS BUF GOBBLE? [PORT START END]) | |
9985 | ||
9986 | This returns a pair of values: (TERMINATOR . NUM-READ). | |
9987 | - TERMINATOR describes why the read was terminated. If it is a | |
9988 | character or the eof object, then that is the value that terminated | |
9989 | the read. If it is #f, the function filled the buffer without finding | |
9990 | a delimiting character. | |
9991 | - NUM-READ is the number of characters read into BUF. | |
9992 | ||
9993 | If the read is successfully terminated by reading a delimiter | |
9994 | character, then the gobble? parameter determines what to do with the | |
9995 | terminating character. If true, the character is removed from the | |
9996 | input stream; if false, the character is left in the input stream | |
9997 | where a subsequent read operation will retrieve it. In either case, | |
9998 | the character is also the first value returned by the procedure call. | |
9999 | ||
10000 | (The descriptions of this function was borrowed from the SCSH manual, | |
10001 | by Olin Shivers and Brian Carlstrom.) | |
10002 | ||
10003 | *** The `read-line' and `read-line!' functions have changed; they now | |
10004 | trim the terminator by default; previously they appended it to the | |
10005 | returned string. For the old behavior, use (read-line PORT 'concat). | |
10006 | ||
10007 | *** The functions `uniform-array-read!' and `uniform-array-write!' now | |
10008 | take new optional START and END arguments, specifying the region of | |
10009 | the array to read and write. | |
10010 | ||
f348c807 JB |
10011 | *** The `ungetc-char-ready?' function has been removed. We feel it's |
10012 | inappropriate for an interface to expose implementation details this | |
10013 | way. | |
095936d2 JB |
10014 | |
10015 | ** Changes to the Unix library and system call interface | |
10016 | ||
10017 | *** The new fcntl function provides access to the Unix `fcntl' system | |
10018 | call. | |
10019 | ||
10020 | (fcntl PORT COMMAND VALUE) | |
10021 | Apply COMMAND to PORT's file descriptor, with VALUE as an argument. | |
10022 | Values for COMMAND are: | |
10023 | ||
10024 | F_DUPFD duplicate a file descriptor | |
10025 | F_GETFD read the descriptor's close-on-exec flag | |
10026 | F_SETFD set the descriptor's close-on-exec flag to VALUE | |
10027 | F_GETFL read the descriptor's flags, as set on open | |
10028 | F_SETFL set the descriptor's flags, as set on open to VALUE | |
10029 | F_GETOWN return the process ID of a socket's owner, for SIGIO | |
10030 | F_SETOWN set the process that owns a socket to VALUE, for SIGIO | |
10031 | FD_CLOEXEC not sure what this is | |
10032 | ||
10033 | For details, see the documentation for the fcntl system call. | |
10034 | ||
10035 | *** The arguments to `select' have changed, for compatibility with | |
10036 | SCSH. The TIMEOUT parameter may now be non-integral, yielding the | |
10037 | expected behavior. The MILLISECONDS parameter has been changed to | |
10038 | MICROSECONDS, to more closely resemble the underlying system call. | |
10039 | The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the | |
10040 | corresponding return set will be the same. | |
10041 | ||
10042 | *** The arguments to the `mknod' system call have changed. They are | |
10043 | now: | |
10044 | ||
10045 | (mknod PATH TYPE PERMS DEV) | |
10046 | Create a new file (`node') in the file system. PATH is the name of | |
10047 | the file to create. TYPE is the kind of file to create; it should | |
10048 | be 'fifo, 'block-special, or 'char-special. PERMS specifies the | |
10049 | permission bits to give the newly created file. If TYPE is | |
10050 | 'block-special or 'char-special, DEV specifies which device the | |
10051 | special file refers to; its interpretation depends on the kind of | |
10052 | special file being created. | |
10053 | ||
10054 | *** The `fork' function has been renamed to `primitive-fork', to avoid | |
10055 | clashing with various SCSH forks. | |
10056 | ||
10057 | *** The `recv' and `recvfrom' functions have been renamed to `recv!' | |
10058 | and `recvfrom!'. They no longer accept a size for a second argument; | |
10059 | you must pass a string to hold the received value. They no longer | |
10060 | return the buffer. Instead, `recv' returns the length of the message | |
10061 | received, and `recvfrom' returns a pair containing the packet's length | |
6c0201ad | 10062 | and originating address. |
095936d2 JB |
10063 | |
10064 | *** The file descriptor datatype has been removed, as have the | |
10065 | `read-fd', `write-fd', `close', `lseek', and `dup' functions. | |
10066 | We plan to replace these functions with a SCSH-compatible interface. | |
10067 | ||
10068 | *** The `create' function has been removed; it's just a special case | |
10069 | of `open'. | |
10070 | ||
10071 | *** There are new functions to break down process termination status | |
10072 | values. In the descriptions below, STATUS is a value returned by | |
10073 | `waitpid'. | |
10074 | ||
10075 | (status:exit-val STATUS) | |
10076 | If the child process exited normally, this function returns the exit | |
10077 | code for the child process (i.e., the value passed to exit, or | |
10078 | returned from main). If the child process did not exit normally, | |
10079 | this function returns #f. | |
10080 | ||
10081 | (status:stop-sig STATUS) | |
10082 | If the child process was suspended by a signal, this function | |
10083 | returns the signal that suspended the child. Otherwise, it returns | |
10084 | #f. | |
10085 | ||
10086 | (status:term-sig STATUS) | |
10087 | If the child process terminated abnormally, this function returns | |
10088 | the signal that terminated the child. Otherwise, this function | |
10089 | returns false. | |
10090 | ||
10091 | POSIX promises that exactly one of these functions will return true on | |
10092 | a valid STATUS value. | |
10093 | ||
10094 | These functions are compatible with SCSH. | |
10095 | ||
10096 | *** There are new accessors and setters for the broken-out time vectors | |
48d224d7 JB |
10097 | returned by `localtime', `gmtime', and that ilk. They are: |
10098 | ||
10099 | Component Accessor Setter | |
10100 | ========================= ============ ============ | |
10101 | seconds tm:sec set-tm:sec | |
10102 | minutes tm:min set-tm:min | |
10103 | hours tm:hour set-tm:hour | |
10104 | day of the month tm:mday set-tm:mday | |
10105 | month tm:mon set-tm:mon | |
10106 | year tm:year set-tm:year | |
10107 | day of the week tm:wday set-tm:wday | |
10108 | day in the year tm:yday set-tm:yday | |
10109 | daylight saving time tm:isdst set-tm:isdst | |
10110 | GMT offset, seconds tm:gmtoff set-tm:gmtoff | |
10111 | name of time zone tm:zone set-tm:zone | |
10112 | ||
095936d2 JB |
10113 | *** There are new accessors for the vectors returned by `uname', |
10114 | describing the host system: | |
48d224d7 JB |
10115 | |
10116 | Component Accessor | |
10117 | ============================================== ================ | |
10118 | name of the operating system implementation utsname:sysname | |
10119 | network name of this machine utsname:nodename | |
10120 | release level of the operating system utsname:release | |
10121 | version level of the operating system utsname:version | |
10122 | machine hardware platform utsname:machine | |
10123 | ||
095936d2 JB |
10124 | *** There are new accessors for the vectors returned by `getpw', |
10125 | `getpwnam', `getpwuid', and `getpwent', describing entries from the | |
10126 | system's user database: | |
10127 | ||
10128 | Component Accessor | |
10129 | ====================== ================= | |
10130 | user name passwd:name | |
10131 | user password passwd:passwd | |
10132 | user id passwd:uid | |
10133 | group id passwd:gid | |
10134 | real name passwd:gecos | |
10135 | home directory passwd:dir | |
10136 | shell program passwd:shell | |
10137 | ||
10138 | *** There are new accessors for the vectors returned by `getgr', | |
10139 | `getgrnam', `getgrgid', and `getgrent', describing entries from the | |
10140 | system's group database: | |
10141 | ||
10142 | Component Accessor | |
10143 | ======================= ============ | |
10144 | group name group:name | |
10145 | group password group:passwd | |
10146 | group id group:gid | |
10147 | group members group:mem | |
10148 | ||
10149 | *** There are new accessors for the vectors returned by `gethost', | |
10150 | `gethostbyaddr', `gethostbyname', and `gethostent', describing | |
10151 | internet hosts: | |
10152 | ||
10153 | Component Accessor | |
10154 | ========================= =============== | |
10155 | official name of host hostent:name | |
10156 | alias list hostent:aliases | |
10157 | host address type hostent:addrtype | |
10158 | length of address hostent:length | |
10159 | list of addresses hostent:addr-list | |
10160 | ||
10161 | *** There are new accessors for the vectors returned by `getnet', | |
10162 | `getnetbyaddr', `getnetbyname', and `getnetent', describing internet | |
10163 | networks: | |
10164 | ||
10165 | Component Accessor | |
10166 | ========================= =============== | |
10167 | official name of net netent:name | |
10168 | alias list netent:aliases | |
10169 | net number type netent:addrtype | |
10170 | net number netent:net | |
10171 | ||
10172 | *** There are new accessors for the vectors returned by `getproto', | |
10173 | `getprotobyname', `getprotobynumber', and `getprotoent', describing | |
10174 | internet protocols: | |
10175 | ||
10176 | Component Accessor | |
10177 | ========================= =============== | |
10178 | official protocol name protoent:name | |
10179 | alias list protoent:aliases | |
10180 | protocol number protoent:proto | |
10181 | ||
10182 | *** There are new accessors for the vectors returned by `getserv', | |
10183 | `getservbyname', `getservbyport', and `getservent', describing | |
10184 | internet protocols: | |
10185 | ||
10186 | Component Accessor | |
10187 | ========================= =============== | |
6c0201ad | 10188 | official service name servent:name |
095936d2 | 10189 | alias list servent:aliases |
6c0201ad TTN |
10190 | port number servent:port |
10191 | protocol to use servent:proto | |
095936d2 JB |
10192 | |
10193 | *** There are new accessors for the sockaddr structures returned by | |
10194 | `accept', `getsockname', `getpeername', `recvfrom!': | |
10195 | ||
10196 | Component Accessor | |
10197 | ======================================== =============== | |
6c0201ad | 10198 | address format (`family') sockaddr:fam |
095936d2 JB |
10199 | path, for file domain addresses sockaddr:path |
10200 | address, for internet domain addresses sockaddr:addr | |
10201 | TCP or UDP port, for internet sockaddr:port | |
10202 | ||
10203 | *** The `getpwent', `getgrent', `gethostent', `getnetent', | |
10204 | `getprotoent', and `getservent' functions now return #f at the end of | |
10205 | the user database. (They used to throw an exception.) | |
10206 | ||
10207 | Note that calling MUMBLEent function is equivalent to calling the | |
10208 | corresponding MUMBLE function with no arguments. | |
10209 | ||
10210 | *** The `setpwent', `setgrent', `sethostent', `setnetent', | |
10211 | `setprotoent', and `setservent' routines now take no arguments. | |
10212 | ||
10213 | *** The `gethost', `getproto', `getnet', and `getserv' functions now | |
10214 | provide more useful information when they throw an exception. | |
10215 | ||
10216 | *** The `lnaof' function has been renamed to `inet-lnaof'. | |
10217 | ||
10218 | *** Guile now claims to have the `current-time' feature. | |
10219 | ||
10220 | *** The `mktime' function now takes an optional second argument ZONE, | |
10221 | giving the time zone to use for the conversion. ZONE should be a | |
10222 | string, in the same format as expected for the "TZ" environment variable. | |
10223 | ||
10224 | *** The `strptime' function now returns a pair (TIME . COUNT), where | |
10225 | TIME is the parsed time as a vector, and COUNT is the number of | |
10226 | characters from the string left unparsed. This function used to | |
10227 | return the remaining characters as a string. | |
10228 | ||
10229 | *** The `gettimeofday' function has replaced the old `time+ticks' function. | |
10230 | The return value is now (SECONDS . MICROSECONDS); the fractional | |
10231 | component is no longer expressed in "ticks". | |
10232 | ||
10233 | *** The `ticks/sec' constant has been removed, in light of the above change. | |
6685dc83 | 10234 | |
ea00ecba MG |
10235 | * Changes to the gh_ interface |
10236 | ||
10237 | ** gh_eval_str() now returns an SCM object which is the result of the | |
10238 | evaluation | |
10239 | ||
aaef0d2a MG |
10240 | ** gh_scm2str() now copies the Scheme data to a caller-provided C |
10241 | array | |
10242 | ||
10243 | ** gh_scm2newstr() now makes a C array, copies the Scheme data to it, | |
10244 | and returns the array | |
10245 | ||
10246 | ** gh_scm2str0() is gone: there is no need to distinguish | |
10247 | null-terminated from non-null-terminated, since gh_scm2newstr() allows | |
10248 | the user to interpret the data both ways. | |
10249 | ||
f3b1485f JB |
10250 | * Changes to the scm_ interface |
10251 | ||
095936d2 JB |
10252 | ** The new function scm_symbol_value0 provides an easy way to get a |
10253 | symbol's value from C code: | |
10254 | ||
10255 | SCM scm_symbol_value0 (char *NAME) | |
10256 | Return the value of the symbol named by the null-terminated string | |
10257 | NAME in the current module. If the symbol named NAME is unbound in | |
10258 | the current module, return SCM_UNDEFINED. | |
10259 | ||
10260 | ** The new function scm_sysintern0 creates new top-level variables, | |
10261 | without assigning them a value. | |
10262 | ||
10263 | SCM scm_sysintern0 (char *NAME) | |
10264 | Create a new Scheme top-level variable named NAME. NAME is a | |
10265 | null-terminated string. Return the variable's value cell. | |
10266 | ||
10267 | ** The function scm_internal_catch is the guts of catch. It handles | |
10268 | all the mechanics of setting up a catch target, invoking the catch | |
10269 | body, and perhaps invoking the handler if the body does a throw. | |
10270 | ||
10271 | The function is designed to be usable from C code, but is general | |
10272 | enough to implement all the semantics Guile Scheme expects from throw. | |
10273 | ||
10274 | TAG is the catch tag. Typically, this is a symbol, but this function | |
10275 | doesn't actually care about that. | |
10276 | ||
10277 | BODY is a pointer to a C function which runs the body of the catch; | |
10278 | this is the code you can throw from. We call it like this: | |
10279 | BODY (BODY_DATA, JMPBUF) | |
10280 | where: | |
10281 | BODY_DATA is just the BODY_DATA argument we received; we pass it | |
10282 | through to BODY as its first argument. The caller can make | |
10283 | BODY_DATA point to anything useful that BODY might need. | |
10284 | JMPBUF is the Scheme jmpbuf object corresponding to this catch, | |
10285 | which we have just created and initialized. | |
10286 | ||
10287 | HANDLER is a pointer to a C function to deal with a throw to TAG, | |
10288 | should one occur. We call it like this: | |
10289 | HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS) | |
10290 | where | |
10291 | HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the | |
10292 | same idea as BODY_DATA above. | |
10293 | THROWN_TAG is the tag that the user threw to; usually this is | |
10294 | TAG, but it could be something else if TAG was #t (i.e., a | |
10295 | catch-all), or the user threw to a jmpbuf. | |
10296 | THROW_ARGS is the list of arguments the user passed to the THROW | |
10297 | function. | |
10298 | ||
10299 | BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA | |
10300 | is just a pointer we pass through to HANDLER. We don't actually | |
10301 | use either of those pointers otherwise ourselves. The idea is | |
10302 | that, if our caller wants to communicate something to BODY or | |
10303 | HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and | |
10304 | HANDLER can then use. Think of it as a way to make BODY and | |
10305 | HANDLER closures, not just functions; MUMBLE_DATA points to the | |
10306 | enclosed variables. | |
10307 | ||
10308 | Of course, it's up to the caller to make sure that any data a | |
10309 | MUMBLE_DATA needs is protected from GC. A common way to do this is | |
10310 | to make MUMBLE_DATA a pointer to data stored in an automatic | |
10311 | structure variable; since the collector must scan the stack for | |
10312 | references anyway, this assures that any references in MUMBLE_DATA | |
10313 | will be found. | |
10314 | ||
10315 | ** The new function scm_internal_lazy_catch is exactly like | |
10316 | scm_internal_catch, except: | |
10317 | ||
10318 | - It does not unwind the stack (this is the major difference). | |
10319 | - If handler returns, its value is returned from the throw. | |
10320 | - BODY always receives #f as its JMPBUF argument (since there's no | |
10321 | jmpbuf associated with a lazy catch, because we don't unwind the | |
10322 | stack.) | |
10323 | ||
10324 | ** scm_body_thunk is a new body function you can pass to | |
10325 | scm_internal_catch if you want the body to be like Scheme's `catch' | |
10326 | --- a thunk, or a function of one argument if the tag is #f. | |
10327 | ||
10328 | BODY_DATA is a pointer to a scm_body_thunk_data structure, which | |
10329 | contains the Scheme procedure to invoke as the body, and the tag | |
10330 | we're catching. If the tag is #f, then we pass JMPBUF (created by | |
10331 | scm_internal_catch) to the body procedure; otherwise, the body gets | |
10332 | no arguments. | |
10333 | ||
10334 | ** scm_handle_by_proc is a new handler function you can pass to | |
10335 | scm_internal_catch if you want the handler to act like Scheme's catch | |
10336 | --- call a procedure with the tag and the throw arguments. | |
10337 | ||
10338 | If the user does a throw to this catch, this function runs a handler | |
10339 | procedure written in Scheme. HANDLER_DATA is a pointer to an SCM | |
10340 | variable holding the Scheme procedure object to invoke. It ought to | |
10341 | be a pointer to an automatic variable (i.e., one living on the stack), | |
10342 | or the procedure object should be otherwise protected from GC. | |
10343 | ||
10344 | ** scm_handle_by_message is a new handler function to use with | |
10345 | `scm_internal_catch' if you want Guile to print a message and die. | |
10346 | It's useful for dealing with throws to uncaught keys at the top level. | |
10347 | ||
10348 | HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a | |
10349 | message header to print; if zero, we use "guile" instead. That | |
10350 | text is followed by a colon, then the message described by ARGS. | |
10351 | ||
10352 | ** The return type of scm_boot_guile is now void; the function does | |
10353 | not return a value, and indeed, never returns at all. | |
10354 | ||
f3b1485f JB |
10355 | ** The new function scm_shell makes it easy for user applications to |
10356 | process command-line arguments in a way that is compatible with the | |
10357 | stand-alone guile interpreter (which is in turn compatible with SCSH, | |
10358 | the Scheme shell). | |
10359 | ||
10360 | To use the scm_shell function, first initialize any guile modules | |
10361 | linked into your application, and then call scm_shell with the values | |
7ed46dc8 | 10362 | of ARGC and ARGV your `main' function received. scm_shell will add |
f3b1485f JB |
10363 | any SCSH-style meta-arguments from the top of the script file to the |
10364 | argument vector, and then process the command-line arguments. This | |
10365 | generally means loading a script file or starting up an interactive | |
10366 | command interpreter. For details, see "Changes to the stand-alone | |
10367 | interpreter" above. | |
10368 | ||
095936d2 | 10369 | ** The new functions scm_get_meta_args and scm_count_argv help you |
6c0201ad | 10370 | implement the SCSH-style meta-argument, `\'. |
095936d2 JB |
10371 | |
10372 | char **scm_get_meta_args (int ARGC, char **ARGV) | |
10373 | If the second element of ARGV is a string consisting of a single | |
10374 | backslash character (i.e. "\\" in Scheme notation), open the file | |
10375 | named by the following argument, parse arguments from it, and return | |
10376 | the spliced command line. The returned array is terminated by a | |
10377 | null pointer. | |
6c0201ad | 10378 | |
095936d2 JB |
10379 | For details of argument parsing, see above, under "guile now accepts |
10380 | command-line arguments compatible with SCSH..." | |
10381 | ||
10382 | int scm_count_argv (char **ARGV) | |
10383 | Count the arguments in ARGV, assuming it is terminated by a null | |
10384 | pointer. | |
10385 | ||
10386 | For an example of how these functions might be used, see the source | |
10387 | code for the function scm_shell in libguile/script.c. | |
10388 | ||
10389 | You will usually want to use scm_shell instead of calling this | |
10390 | function yourself. | |
10391 | ||
10392 | ** The new function scm_compile_shell_switches turns an array of | |
10393 | command-line arguments into Scheme code to carry out the actions they | |
10394 | describe. Given ARGC and ARGV, it returns a Scheme expression to | |
10395 | evaluate, and calls scm_set_program_arguments to make any remaining | |
10396 | command-line arguments available to the Scheme code. For example, | |
10397 | given the following arguments: | |
10398 | ||
10399 | -e main -s ekko a speckled gecko | |
10400 | ||
10401 | scm_set_program_arguments will return the following expression: | |
10402 | ||
10403 | (begin (load "ekko") (main (command-line)) (quit)) | |
10404 | ||
10405 | You will usually want to use scm_shell instead of calling this | |
10406 | function yourself. | |
10407 | ||
10408 | ** The function scm_shell_usage prints a usage message appropriate for | |
10409 | an interpreter that uses scm_compile_shell_switches to handle its | |
10410 | command-line arguments. | |
10411 | ||
10412 | void scm_shell_usage (int FATAL, char *MESSAGE) | |
10413 | Print a usage message to the standard error output. If MESSAGE is | |
10414 | non-zero, write it before the usage message, followed by a newline. | |
10415 | If FATAL is non-zero, exit the process, using FATAL as the | |
10416 | termination status. (If you want to be compatible with Guile, | |
10417 | always use 1 as the exit status when terminating due to command-line | |
10418 | usage problems.) | |
10419 | ||
10420 | You will usually want to use scm_shell instead of calling this | |
10421 | function yourself. | |
48d224d7 JB |
10422 | |
10423 | ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no | |
095936d2 JB |
10424 | expressions. It used to return SCM_EOL. Earth-shattering. |
10425 | ||
10426 | ** The macros for declaring scheme objects in C code have been | |
10427 | rearranged slightly. They are now: | |
10428 | ||
10429 | SCM_SYMBOL (C_NAME, SCHEME_NAME) | |
10430 | Declare a static SCM variable named C_NAME, and initialize it to | |
10431 | point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should | |
10432 | be a C identifier, and SCHEME_NAME should be a C string. | |
10433 | ||
10434 | SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME) | |
10435 | Just like SCM_SYMBOL, but make C_NAME globally visible. | |
10436 | ||
10437 | SCM_VCELL (C_NAME, SCHEME_NAME) | |
10438 | Create a global variable at the Scheme level named SCHEME_NAME. | |
10439 | Declare a static SCM variable named C_NAME, and initialize it to | |
10440 | point to the Scheme variable's value cell. | |
10441 | ||
10442 | SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME) | |
10443 | Just like SCM_VCELL, but make C_NAME globally visible. | |
10444 | ||
10445 | The `guile-snarf' script writes initialization code for these macros | |
10446 | to its standard output, given C source code as input. | |
10447 | ||
10448 | The SCM_GLOBAL macro is gone. | |
10449 | ||
10450 | ** The scm_read_line and scm_read_line_x functions have been replaced | |
10451 | by Scheme code based on the %read-delimited! procedure (known to C | |
10452 | code as scm_read_delimited_x). See its description above for more | |
10453 | information. | |
48d224d7 | 10454 | |
095936d2 JB |
10455 | ** The function scm_sys_open has been renamed to scm_open. It now |
10456 | returns a port instead of an FD object. | |
ea00ecba | 10457 | |
095936d2 JB |
10458 | * The dynamic linking support has changed. For more information, see |
10459 | libguile/DYNAMIC-LINKING. | |
ea00ecba | 10460 | |
f7b47737 JB |
10461 | \f |
10462 | Guile 1.0b3 | |
3065a62a | 10463 | |
f3b1485f JB |
10464 | User-visible changes from Thursday, September 5, 1996 until Guile 1.0 |
10465 | (Sun 5 Jan 1997): | |
3065a62a | 10466 | |
4b521edb | 10467 | * Changes to the 'guile' program: |
3065a62a | 10468 | |
4b521edb JB |
10469 | ** Guile now loads some new files when it starts up. Guile first |
10470 | searches the load path for init.scm, and loads it if found. Then, if | |
10471 | Guile is not being used to execute a script, and the user's home | |
10472 | directory contains a file named `.guile', Guile loads that. | |
c6486f8a | 10473 | |
4b521edb | 10474 | ** You can now use Guile as a shell script interpreter. |
3065a62a JB |
10475 | |
10476 | To paraphrase the SCSH manual: | |
10477 | ||
10478 | When Unix tries to execute an executable file whose first two | |
10479 | characters are the `#!', it treats the file not as machine code to | |
10480 | be directly executed by the native processor, but as source code | |
10481 | to be executed by some interpreter. The interpreter to use is | |
10482 | specified immediately after the #! sequence on the first line of | |
10483 | the source file. The kernel reads in the name of the interpreter, | |
10484 | and executes that instead. It passes the interpreter the source | |
10485 | filename as its first argument, with the original arguments | |
10486 | following. Consult the Unix man page for the `exec' system call | |
10487 | for more information. | |
10488 | ||
1a1945be JB |
10489 | Now you can use Guile as an interpreter, using a mechanism which is a |
10490 | compatible subset of that provided by SCSH. | |
10491 | ||
3065a62a JB |
10492 | Guile now recognizes a '-s' command line switch, whose argument is the |
10493 | name of a file of Scheme code to load. It also treats the two | |
10494 | characters `#!' as the start of a comment, terminated by `!#'. Thus, | |
10495 | to make a file of Scheme code directly executable by Unix, insert the | |
10496 | following two lines at the top of the file: | |
10497 | ||
10498 | #!/usr/local/bin/guile -s | |
10499 | !# | |
10500 | ||
10501 | Guile treats the argument of the `-s' command-line switch as the name | |
10502 | of a file of Scheme code to load, and treats the sequence `#!' as the | |
10503 | start of a block comment, terminated by `!#'. | |
10504 | ||
10505 | For example, here's a version of 'echo' written in Scheme: | |
10506 | ||
10507 | #!/usr/local/bin/guile -s | |
10508 | !# | |
10509 | (let loop ((args (cdr (program-arguments)))) | |
10510 | (if (pair? args) | |
10511 | (begin | |
10512 | (display (car args)) | |
10513 | (if (pair? (cdr args)) | |
10514 | (display " ")) | |
10515 | (loop (cdr args))))) | |
10516 | (newline) | |
10517 | ||
10518 | Why does `#!' start a block comment terminated by `!#', instead of the | |
10519 | end of the line? That is the notation SCSH uses, and although we | |
10520 | don't yet support the other SCSH features that motivate that choice, | |
10521 | we would like to be backward-compatible with any existing Guile | |
3763761c JB |
10522 | scripts once we do. Furthermore, if the path to Guile on your system |
10523 | is too long for your kernel, you can start the script with this | |
10524 | horrible hack: | |
10525 | ||
10526 | #!/bin/sh | |
10527 | exec /really/long/path/to/guile -s "$0" ${1+"$@"} | |
10528 | !# | |
3065a62a JB |
10529 | |
10530 | Note that some very old Unix systems don't support the `#!' syntax. | |
10531 | ||
c6486f8a | 10532 | |
4b521edb | 10533 | ** You can now run Guile without installing it. |
6685dc83 JB |
10534 | |
10535 | Previous versions of the interactive Guile interpreter (`guile') | |
10536 | couldn't start up unless Guile's Scheme library had been installed; | |
10537 | they used the value of the environment variable `SCHEME_LOAD_PATH' | |
10538 | later on in the startup process, but not to find the startup code | |
10539 | itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme | |
10540 | code. | |
10541 | ||
10542 | To run Guile without installing it, build it in the normal way, and | |
10543 | then set the environment variable `SCHEME_LOAD_PATH' to a | |
10544 | colon-separated list of directories, including the top-level directory | |
10545 | of the Guile sources. For example, if you unpacked Guile so that the | |
10546 | full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then | |
10547 | you might say | |
10548 | ||
10549 | export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3 | |
10550 | ||
c6486f8a | 10551 | |
4b521edb JB |
10552 | ** Guile's read-eval-print loop no longer prints #<unspecified> |
10553 | results. If the user wants to see this, she can evaluate the | |
10554 | expression (assert-repl-print-unspecified #t), perhaps in her startup | |
48d224d7 | 10555 | file. |
6685dc83 | 10556 | |
4b521edb JB |
10557 | ** Guile no longer shows backtraces by default when an error occurs; |
10558 | however, it does display a message saying how to get one, and how to | |
10559 | request that they be displayed by default. After an error, evaluate | |
10560 | (backtrace) | |
10561 | to see a backtrace, and | |
10562 | (debug-enable 'backtrace) | |
10563 | to see them by default. | |
6685dc83 | 10564 | |
6685dc83 | 10565 | |
d9fb83d9 | 10566 | |
4b521edb JB |
10567 | * Changes to Guile Scheme: |
10568 | ||
10569 | ** Guile now distinguishes between #f and the empty list. | |
10570 | ||
10571 | This is for compatibility with the IEEE standard, the (possibly) | |
10572 | upcoming Revised^5 Report on Scheme, and many extant Scheme | |
10573 | implementations. | |
10574 | ||
10575 | Guile used to have #f and '() denote the same object, to make Scheme's | |
10576 | type system more compatible with Emacs Lisp's. However, the change | |
10577 | caused too much trouble for Scheme programmers, and we found another | |
10578 | way to reconcile Emacs Lisp with Scheme that didn't require this. | |
10579 | ||
10580 | ||
10581 | ** Guile's delq, delv, delete functions, and their destructive | |
c6486f8a JB |
10582 | counterparts, delq!, delv!, and delete!, now remove all matching |
10583 | elements from the list, not just the first. This matches the behavior | |
10584 | of the corresponding Emacs Lisp functions, and (I believe) the Maclisp | |
10585 | functions which inspired them. | |
10586 | ||
10587 | I recognize that this change may break code in subtle ways, but it | |
10588 | seems best to make the change before the FSF's first Guile release, | |
10589 | rather than after. | |
10590 | ||
10591 | ||
4b521edb | 10592 | ** The compiled-library-path function has been deleted from libguile. |
6685dc83 | 10593 | |
4b521edb | 10594 | ** The facilities for loading Scheme source files have changed. |
c6486f8a | 10595 | |
4b521edb | 10596 | *** The variable %load-path now tells Guile which directories to search |
6685dc83 JB |
10597 | for Scheme code. Its value is a list of strings, each of which names |
10598 | a directory. | |
10599 | ||
4b521edb JB |
10600 | *** The variable %load-extensions now tells Guile which extensions to |
10601 | try appending to a filename when searching the load path. Its value | |
10602 | is a list of strings. Its default value is ("" ".scm"). | |
10603 | ||
10604 | *** (%search-load-path FILENAME) searches the directories listed in the | |
10605 | value of the %load-path variable for a Scheme file named FILENAME, | |
10606 | with all the extensions listed in %load-extensions. If it finds a | |
10607 | match, then it returns its full filename. If FILENAME is absolute, it | |
10608 | returns it unchanged. Otherwise, it returns #f. | |
6685dc83 | 10609 | |
4b521edb JB |
10610 | %search-load-path will not return matches that refer to directories. |
10611 | ||
10612 | *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP) | |
10613 | uses %seach-load-path to find a file named FILENAME, and loads it if | |
10614 | it finds it. If it can't read FILENAME for any reason, it throws an | |
10615 | error. | |
6685dc83 JB |
10616 | |
10617 | The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the | |
4b521edb JB |
10618 | `read' function. |
10619 | ||
10620 | *** load uses the same searching semantics as primitive-load. | |
10621 | ||
10622 | *** The functions %try-load, try-load-with-path, %load, load-with-path, | |
10623 | basic-try-load-with-path, basic-load-with-path, try-load-module-with- | |
10624 | path, and load-module-with-path have been deleted. The functions | |
10625 | above should serve their purposes. | |
10626 | ||
10627 | *** If the value of the variable %load-hook is a procedure, | |
10628 | `primitive-load' applies its value to the name of the file being | |
10629 | loaded (without the load path directory name prepended). If its value | |
10630 | is #f, it is ignored. Otherwise, an error occurs. | |
10631 | ||
10632 | This is mostly useful for printing load notification messages. | |
10633 | ||
10634 | ||
10635 | ** The function `eval!' is no longer accessible from the scheme level. | |
10636 | We can't allow operations which introduce glocs into the scheme level, | |
10637 | because Guile's type system can't handle these as data. Use `eval' or | |
10638 | `read-and-eval!' (see below) as replacement. | |
10639 | ||
10640 | ** The new function read-and-eval! reads an expression from PORT, | |
10641 | evaluates it, and returns the result. This is more efficient than | |
10642 | simply calling `read' and `eval', since it is not necessary to make a | |
10643 | copy of the expression for the evaluator to munge. | |
10644 | ||
10645 | Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as | |
10646 | for the `read' function. | |
10647 | ||
10648 | ||
10649 | ** The function `int?' has been removed; its definition was identical | |
10650 | to that of `integer?'. | |
10651 | ||
10652 | ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should | |
10653 | use the R4RS names for these functions. | |
10654 | ||
10655 | ** The function object-properties no longer returns the hash handle; | |
10656 | it simply returns the object's property list. | |
10657 | ||
10658 | ** Many functions have been changed to throw errors, instead of | |
10659 | returning #f on failure. The point of providing exception handling in | |
10660 | the language is to simplify the logic of user code, but this is less | |
10661 | useful if Guile's primitives don't throw exceptions. | |
10662 | ||
10663 | ** The function `fileno' has been renamed from `%fileno'. | |
10664 | ||
10665 | ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0. | |
10666 | ||
10667 | ||
10668 | * Changes to Guile's C interface: | |
10669 | ||
10670 | ** The library's initialization procedure has been simplified. | |
10671 | scm_boot_guile now has the prototype: | |
10672 | ||
10673 | void scm_boot_guile (int ARGC, | |
10674 | char **ARGV, | |
10675 | void (*main_func) (), | |
10676 | void *closure); | |
10677 | ||
10678 | scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV. | |
10679 | MAIN_FUNC should do all the work of the program (initializing other | |
10680 | packages, reading user input, etc.) before returning. When MAIN_FUNC | |
10681 | returns, call exit (0); this function never returns. If you want some | |
10682 | other exit value, MAIN_FUNC may call exit itself. | |
10683 | ||
10684 | scm_boot_guile arranges for program-arguments to return the strings | |
10685 | given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call | |
10686 | scm_set_program_arguments with the final list, so Scheme code will | |
10687 | know which arguments have been processed. | |
10688 | ||
10689 | scm_boot_guile establishes a catch-all catch handler which prints an | |
10690 | error message and exits the process. This means that Guile exits in a | |
10691 | coherent way when system errors occur and the user isn't prepared to | |
10692 | handle it. If the user doesn't like this behavior, they can establish | |
10693 | their own universal catcher in MAIN_FUNC to shadow this one. | |
10694 | ||
10695 | Why must the caller do all the real work from MAIN_FUNC? The garbage | |
10696 | collector assumes that all local variables of type SCM will be above | |
10697 | scm_boot_guile's stack frame on the stack. If you try to manipulate | |
10698 | SCM values after this function returns, it's the luck of the draw | |
10699 | whether the GC will be able to find the objects you allocate. So, | |
10700 | scm_boot_guile function exits, rather than returning, to discourage | |
10701 | people from making that mistake. | |
10702 | ||
10703 | The IN, OUT, and ERR arguments were removed; there are other | |
10704 | convenient ways to override these when desired. | |
10705 | ||
10706 | The RESULT argument was deleted; this function should never return. | |
10707 | ||
10708 | The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more | |
10709 | general. | |
10710 | ||
10711 | ||
10712 | ** Guile's header files should no longer conflict with your system's | |
10713 | header files. | |
10714 | ||
10715 | In order to compile code which #included <libguile.h>, previous | |
10716 | versions of Guile required you to add a directory containing all the | |
10717 | Guile header files to your #include path. This was a problem, since | |
10718 | Guile's header files have names which conflict with many systems' | |
10719 | header files. | |
10720 | ||
10721 | Now only <libguile.h> need appear in your #include path; you must | |
10722 | refer to all Guile's other header files as <libguile/mumble.h>. | |
10723 | Guile's installation procedure puts libguile.h in $(includedir), and | |
10724 | the rest in $(includedir)/libguile. | |
10725 | ||
10726 | ||
10727 | ** Two new C functions, scm_protect_object and scm_unprotect_object, | |
10728 | have been added to the Guile library. | |
10729 | ||
10730 | scm_protect_object (OBJ) protects OBJ from the garbage collector. | |
10731 | OBJ will not be freed, even if all other references are dropped, | |
10732 | until someone does scm_unprotect_object (OBJ). Both functions | |
10733 | return OBJ. | |
10734 | ||
10735 | Note that calls to scm_protect_object do not nest. You can call | |
10736 | scm_protect_object any number of times on a given object, and the | |
10737 | next call to scm_unprotect_object will unprotect it completely. | |
10738 | ||
10739 | Basically, scm_protect_object and scm_unprotect_object just | |
10740 | maintain a list of references to things. Since the GC knows about | |
10741 | this list, all objects it mentions stay alive. scm_protect_object | |
10742 | adds its argument to the list; scm_unprotect_object remove its | |
10743 | argument from the list. | |
10744 | ||
10745 | ||
10746 | ** scm_eval_0str now returns the value of the last expression | |
10747 | evaluated. | |
10748 | ||
10749 | ** The new function scm_read_0str reads an s-expression from a | |
10750 | null-terminated string, and returns it. | |
10751 | ||
10752 | ** The new function `scm_stdio_to_port' converts a STDIO file pointer | |
10753 | to a Scheme port object. | |
10754 | ||
10755 | ** The new function `scm_set_program_arguments' allows C code to set | |
e80c8fea | 10756 | the value returned by the Scheme `program-arguments' function. |
6685dc83 | 10757 | |
6685dc83 | 10758 | \f |
1a1945be JB |
10759 | Older changes: |
10760 | ||
10761 | * Guile no longer includes sophisticated Tcl/Tk support. | |
10762 | ||
10763 | The old Tcl/Tk support was unsatisfying to us, because it required the | |
10764 | user to link against the Tcl library, as well as Tk and Guile. The | |
10765 | interface was also un-lispy, in that it preserved Tcl/Tk's practice of | |
10766 | referring to widgets by names, rather than exporting widgets to Scheme | |
10767 | code as a special datatype. | |
10768 | ||
10769 | In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk | |
10770 | maintainers described some very interesting changes in progress to the | |
10771 | Tcl/Tk internals, which would facilitate clean interfaces between lone | |
10772 | Tk and other interpreters --- even for garbage-collected languages | |
10773 | like Scheme. They expected the new Tk to be publicly available in the | |
10774 | fall of 1996. | |
10775 | ||
10776 | Since it seems that Guile might soon have a new, cleaner interface to | |
10777 | lone Tk, and that the old Guile/Tk glue code would probably need to be | |
10778 | completely rewritten, we (Jim Blandy and Richard Stallman) have | |
10779 | decided not to support the old code. We'll spend the time instead on | |
10780 | a good interface to the newer Tk, as soon as it is available. | |
5c54da76 | 10781 | |
8512dea6 | 10782 | Until then, gtcltk-lib provides trivial, low-maintenance functionality. |
deb95d71 | 10783 | |
5c54da76 JB |
10784 | \f |
10785 | Copyright information: | |
10786 | ||
4f416616 | 10787 | Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc. |
5c54da76 JB |
10788 | |
10789 | Permission is granted to anyone to make or distribute verbatim copies | |
10790 | of this document as received, in any medium, provided that the | |
10791 | copyright notice and this permission notice are preserved, | |
10792 | thus giving the recipient permission to redistribute in turn. | |
10793 | ||
10794 | Permission is granted to distribute modified versions | |
10795 | of this document, or of portions of it, | |
10796 | under the above conditions, provided also that they | |
10797 | carry prominent notices stating who last changed them. | |
10798 | ||
48d224d7 JB |
10799 | \f |
10800 | Local variables: | |
10801 | mode: outline | |
10802 | paragraph-separate: "[ \f]*$" | |
10803 | end: |