1 Guile NEWS --- history of user-visible changes.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
3 See the end for copying conditions.
5 Please send Guile bug reports to bug-guile@gnu.org.
7 Each release reports the NEWS in the following sections:
9 * Changes to the distribution
10 * Changes to the stand-alone interpreter
11 * Changes to Scheme functions and syntax
12 * Changes to the C interface
15 Changes in 1.9.XXXXXXXX:
17 * Changes to the distribution
18 * Changes to the stand-alone interpreter
19 * Changes to Scheme functions and syntax
20 * Changes to the C interface
23 Changes in 1.8.1 (since 1.8.0):
25 * Changes to the distribution
27 ** New primitive-_exit giving the _exit() system call.
29 * Changes to Scheme functions and syntax
31 ** A one-dimenisonal array can now be 'equal?' to a vector.
32 ** Structures, records, and SRFI-9 records can now be compared with `equal?'.
34 * Changes to the C interface
36 ** New function scm_c_locale_stringn_to_number.
40 ** array-set! with bit vector.
41 ** make-shared-array fixes, including examples in the manual which failed.
42 ** string<? and friends follow char<? etc order on 8-bit chars.
43 ** n-par-for-each, n-for-each-par-map for "futures" variable.
44 ** module autoload and explicit use-modules cooperate.
45 ** ice-9 format ~f with infs and nans.
46 ** exact->inexact overflows on fractions with big num/den but small result.
47 ** srfi-1 assoc "=" procedure argument order.
48 ** Build problems on MacOS, SunOS, QNX.
51 Changes since the 1.6.x series:
53 * Changes to the distribution
55 ** Guile is now licensed with the GNU Lesser General Public License.
57 ** The manual is now licensed with the GNU Free Documentation License.
59 ** Guile now requires GNU MP (http://swox.com/gmp).
61 Guile now uses the GNU MP library for arbitrary precision arithmetic.
63 ** Guile now has separate private and public configuration headers.
65 That is, things like HAVE_STRING_H no longer leak from Guile's
68 ** Guile now provides and uses an "effective" version number.
70 Guile now provides scm_effective_version and effective-version
71 functions which return the "effective" version number. This is just
72 the normal full version string without the final micro-version number,
73 so the current effective-version is "1.8". The effective version
74 should remain unchanged during a stable series, and should be used for
75 items like the versioned share directory name
76 i.e. /usr/share/guile/1.8.
78 Providing an unchanging version number during a stable release for
79 things like the versioned share directory can be particularly
80 important for Guile "add-on" packages, since it provides a directory
81 that they can install to that won't be changed out from under them
82 with each micro release during a stable series.
84 ** Thread implementation has changed.
86 When you configure "--with-threads=null", you will get the usual
87 threading API (call-with-new-thread, make-mutex, etc), but you can't
88 actually create new threads. Also, "--with-threads=no" is now
89 equivalent to "--with-threads=null". This means that the thread API
90 is always present, although you might not be able to create new
93 When you configure "--with-threads=pthreads" or "--with-threads=yes",
94 you will get threads that are implemented with the portable POSIX
95 threads. These threads can run concurrently (unlike the previous
96 "coop" thread implementation), but need to cooperate for things like
99 The default is "pthreads", unless your platform doesn't have pthreads,
100 in which case "null" threads are used.
102 See the manual for details, nodes "Initialization", "Multi-Threading",
103 "Blocking", and others.
105 ** There is the new notion of 'discouraged' features.
107 This is a milder form of deprecation.
109 Things that are discouraged should not be used in new code, but it is
110 OK to leave them in old code for now. When a discouraged feature is
111 used, no warning message is printed like there is for 'deprecated'
112 features. Also, things that are merely discouraged are nevertheless
113 implemented efficiently, while deprecated features can be very slow.
115 You can omit discouraged features from libguile by configuring it with
116 the '--disable-discouraged' option.
118 ** Deprecation warnings can be controlled at run-time.
120 (debug-enable 'warn-deprecated) switches them on and (debug-disable
121 'warn-deprecated) switches them off.
123 ** Support for SRFI 61, extended cond syntax for multiple values has
126 This SRFI is always available.
128 ** Support for require-extension, SRFI-55, has been added.
130 The SRFI-55 special form `require-extension' has been added. It is
131 available at startup, and provides a portable way to load Scheme
132 extensions. SRFI-55 only requires support for one type of extension,
133 "srfi"; so a set of SRFIs may be loaded via (require-extension (srfi 1
136 ** New module (srfi srfi-26) provides support for `cut' and `cute'.
138 The (srfi srfi-26) module is an implementation of SRFI-26 which
139 provides the `cut' and `cute' syntax. These may be used to specialize
140 parameters without currying.
142 ** New module (srfi srfi-31)
144 This is an implementation of SRFI-31 which provides a special form
145 `rec' for recursive evaluation.
147 ** The modules (srfi srfi-13), (srfi srfi-14) and (srfi srfi-4) have
148 been merged with the core, making their functionality always
151 The modules are still available, tho, and you could use them together
152 with a renaming import, for example.
154 ** Guile no longer includes its own version of libltdl.
156 The official version is good enough now.
158 ** The --enable-htmldoc option has been removed from 'configure'.
160 Support for translating the documentation into HTML is now always
161 provided. Use 'make html'.
163 ** New module (ice-9 serialize):
165 (serialize FORM1 ...) and (parallelize FORM1 ...) are useful when you
166 don't trust the thread safety of most of your program, but where you
167 have some section(s) of code which you consider can run in parallel to
168 other sections. See ice-9/serialize.scm for more information.
170 ** The configure option '--disable-arrays' has been removed.
172 Support for arrays and uniform numeric arrays is now always included
175 * Changes to the stand-alone interpreter
177 ** New command line option `-L'.
179 This option adds a directory to the front of the load path.
181 ** New command line option `--no-debug'.
183 Specifying `--no-debug' on the command line will keep the debugging
184 evaluator turned off, even for interactive sessions.
186 ** User-init file ~/.guile is now loaded with the debugging evaluator.
188 Previously, the normal evaluator would have been used. Using the
189 debugging evaluator gives better error messages.
191 ** The '-e' option now 'read's its argument.
193 This is to allow the new '(@ MODULE-NAME VARIABLE-NAME)' construct to
194 be used with '-e'. For example, you can now write a script like
197 exec guile -e '(@ (demo) main)' -s "$0" "$@"
200 (define-module (demo)
204 (format #t "Demo: ~a~%" args))
207 * Changes to Scheme functions and syntax
209 ** Guardians have changed back to their original semantics
211 Guardians now behave like described in the paper by Dybvig et al. In
212 particular, they no longer make guarantees about the order in which
213 they return objects, and they can no longer be greedy.
215 They no longer drop cyclic data structures.
217 The C function scm_make_guardian has been changed incompatibly and no
218 longer takes the 'greedy_p' argument.
220 ** New function hashx-remove!
222 This function completes the set of 'hashx' functions.
224 ** The concept of dynamic roots has been factored into continuation
225 barriers and dynamic states.
227 Each thread has a current dynamic state that carries the values of the
228 fluids. You can create and copy dynamic states and use them as the
229 second argument for 'eval'. See "Fluids and Dynamic States" in the
232 To restrict the influence that captured continuations can have on the
233 control flow, you can errect continuation barriers. See "Continuation
234 Barriers" in the manual.
236 The function call-with-dynamic-root now essentially temporarily
237 installs a new dynamic state and errects a continuation barrier.
239 ** The default load path no longer includes "." at the end.
241 Automatically loading modules from the current directory should not
242 happen by default. If you want to allow it in a more controlled
243 manner, set the environment variable GUILE_LOAD_PATH or the Scheme
246 ** The uniform vector and array support has been overhauled.
248 It now complies with SRFI-4 and the weird prototype based uniform
249 array creation has been deprecated. See the manual for more details.
251 Some non-compatible changes have been made:
252 - characters can no longer be stored into byte arrays.
253 - strings and bit vectors are no longer considered to be uniform numeric
255 - array-rank throws an error for non-arrays instead of returning zero.
256 - array-ref does no longer accept non-arrays when no indices are given.
258 There is the new notion of 'generalized vectors' and corresponding
259 procedures like 'generalized-vector-ref'. Generalized vectors include
260 strings, bitvectors, ordinary vectors, and uniform numeric vectors.
262 Arrays use generalized vectors as their storage, so that you still
263 have arrays of characters, bits, etc. However, uniform-array-read!
264 and uniform-array-write can no longer read/write strings and
267 ** There is now support for copy-on-write substrings, mutation-sharing
268 substrings and read-only strings.
270 Three new procedures are related to this: substring/shared,
271 substring/copy, and substring/read-only. See the manual for more
274 ** Backtraces will now highlight the value that caused the error.
276 By default, these values are enclosed in "{...}", such as in this
285 <unnamed port>:1:1: In procedure car in expression (car (quote a)):
286 <unnamed port>:1:1: Wrong type (expecting pair): a
287 ABORT: (wrong-type-arg)
289 The prefix and suffix used for highlighting can be set via the two new
290 printer options 'highlight-prefix' and 'highlight-suffix'. For
291 example, putting this into ~/.guile will output the bad value in bold
294 (print-set! highlight-prefix "\x1b[1m")
295 (print-set! highlight-suffix "\x1b[22m")
298 ** 'gettext' support for internationalization has been added.
300 See the manual for details.
302 ** New syntax '@' and '@@':
304 You can now directly refer to variables exported from a module by
307 (@ MODULE-NAME VARIABLE-NAME)
309 For example (@ (ice-9 pretty-print) pretty-print) will directly access
310 the pretty-print variable exported from the (ice-9 pretty-print)
311 module. You don't need to 'use' that module first. You can also use
312 '@' as a target of 'set!', as in (set! (@ mod var) val).
314 The related syntax (@@ MODULE-NAME VARIABLE-NAME) works just like '@',
315 but it can also access variables that have not been exported. It is
316 intended only for kluges and temporary fixes and for debugging, not
319 ** Keyword syntax has been made more disciplined.
321 Previously, the name of a keyword was read as a 'token' but printed as
322 a symbol. Now, it is read as a general Scheme datum which must be a
333 ERROR: In expression (a b c):
337 ERROR: Unbound variable: foo
342 ERROR: Wrong type (expecting symbol): 12
346 ERROR: Wrong type (expecting symbol): (a b c)
350 ** The printing of symbols that might look like keywords can be
353 The new printer option 'quote-keywordish-symbols' controls how symbols
354 are printed that have a colon as their first or last character. The
355 default now is to only quote a symbol with #{...}# when the read
356 option 'keywords' is not '#f'. Thus:
358 guile> (define foo (string->symbol ":foo"))
359 guile> (read-set! keywords #f)
362 guile> (read-set! keywords 'prefix)
365 guile> (print-set! quote-keywordish-symbols #f)
369 ** 'while' now provides 'break' and 'continue'
371 break and continue were previously bound in a while loop, but not
372 documented, and continue didn't quite work properly. The undocumented
373 parameter to break which gave a return value for the while has been
376 ** 'call-with-current-continuation' is now also available under the name
379 ** The module system now checks for duplicate bindings.
381 The module system now can check for name conflicts among imported
384 The behavior can be controlled by specifying one or more 'duplicates'
385 handlers. For example, to make Guile return an error for every name
393 The new default behavior of the module system when a name collision
394 has been detected is to
396 1. Give priority to bindings marked as a replacement.
397 2. Issue a warning (different warning if overriding core binding).
398 3. Give priority to the last encountered binding (this corresponds to
401 If you want the old behavior back without replacements or warnings you
404 (default-duplicate-binding-handler 'last)
406 to your .guile init file.
408 ** New define-module option: :replace
410 :replace works as :export, but, in addition, marks the binding as a
413 A typical example is `format' in (ice-9 format) which is a replacement
414 for the core binding `format'.
416 ** Adding prefixes to imported bindings in the module system
418 There is now a new :use-module option :prefix. It can be used to add
419 a prefix to all imported bindings.
422 :use-module ((bar) :prefix bar:))
424 will import all bindings exported from bar, but rename them by adding
427 ** Conflicting generic functions can be automatically merged.
429 When two imported bindings conflict and they are both generic
430 functions, the two functions can now be merged automatically. This is
431 activated with the 'duplicates' handler 'merge-generics'.
433 ** New function: effective-version
435 Returns the "effective" version number. This is just the normal full
436 version string without the final micro-version number. See "Changes
437 to the distribution" above.
439 ** New threading functions: parallel, letpar, par-map, and friends
441 These are convenient ways to run calculations in parallel in new
442 threads. See "Parallel forms" in the manual for details.
444 ** New function 'try-mutex'.
446 This function will attempt to lock a mutex but will return immediately
447 instead of blocking and indicate failure.
449 ** Waiting on a condition variable can have a timeout.
451 The function 'wait-condition-variable' now takes a third, optional
452 argument that specifies the point in time where the waiting should be
455 ** New function 'broadcast-condition-variable'.
457 ** New functions 'all-threads' and 'current-thread'.
459 ** Signals and system asyncs work better with threads.
461 The function 'sigaction' now takes a fourth, optional, argument that
462 specifies the thread that the handler should run in. When the
463 argument is omitted, the handler will run in the thread that called
466 Likewise, 'system-async-mark' takes a second, optional, argument that
467 specifies the thread that the async should run in. When it is
468 omitted, the async will run in the thread that called
471 C code can use the new functions scm_sigaction_for_thread and
472 scm_system_async_mark_for_thread to pass the new thread argument.
474 When a thread blocks on a mutex, a condition variable or is waiting
475 for IO to be possible, it will still execute system asyncs. This can
476 be used to interrupt such a thread by making it execute a 'throw', for
479 ** The function 'system-async' is deprecated.
481 You can now pass any zero-argument procedure to 'system-async-mark'.
482 The function 'system-async' will just return its argument unchanged
485 ** New functions 'call-with-blocked-asyncs' and
486 'call-with-unblocked-asyncs'
488 The expression (call-with-blocked-asyncs PROC) will call PROC and will
489 block execution of system asyncs for the current thread by one level
490 while PROC runs. Likewise, call-with-unblocked-asyncs will call a
491 procedure and will unblock the execution of system asyncs by one
492 level for the current thread.
494 Only system asyncs are affected by these functions.
496 ** The functions 'mask-signals' and 'unmask-signals' are deprecated.
498 Use 'call-with-blocked-asyncs' or 'call-with-unblocked-asyncs'
499 instead. Those functions are easier to use correctly and can be
502 ** New function 'unsetenv'.
504 ** New macro 'define-syntax-public'.
506 It works like 'define-syntax' and also exports the defined macro (but
509 ** There is support for Infinity and NaNs.
511 Following PLT Scheme, Guile can now work with infinite numbers, and
514 There is new syntax for numbers: "+inf.0" (infinity), "-inf.0"
515 (negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as
516 "+nan.0"). These numbers are inexact and have no exact counterpart.
518 Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the
519 sign of the dividend. The infinities are integers, and they answer #t
520 for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is
521 not '=' to itself, but '+nan.0' is 'eqv?' to itself.
532 ERROR: Numerical overflow
534 Two new predicates 'inf?' and 'nan?' can be used to test for the
537 ** Inexact zero can have a sign.
539 Guile can now distinguish between plus and minus inexact zero, if your
540 platform supports this, too. The two zeros are equal according to
541 '=', but not according to 'eqv?'. For example
552 ** Guile now has exact rationals.
554 Guile can now represent fractions such as 1/3 exactly. Computing with
555 them is also done exactly, of course:
560 ** 'floor', 'ceiling', 'round' and 'truncate' now return exact numbers
563 For example: (floor 2) now returns an exact 2 where in the past it
564 returned an inexact 2.0. Likewise, (floor 5/4) returns an exact 1.
566 ** inexact->exact no longer returns only integers.
568 Without exact rationals, the closest exact number was always an
569 integer, but now inexact->exact returns the fraction that is exactly
570 equal to a floating point number. For example:
572 (inexact->exact 1.234)
573 => 694680242521899/562949953421312
575 When you want the old behavior, use 'round' explicitly:
577 (inexact->exact (round 1.234))
580 ** New function 'rationalize'.
582 This function finds a simple fraction that is close to a given real
583 number. For example (and compare with inexact->exact above):
585 (rationalize (inexact->exact 1.234) 1/2000)
588 Note that, as required by R5RS, rationalize returns only then an exact
589 result when both its arguments are exact.
591 ** 'odd?' and 'even?' work also for inexact integers.
593 Previously, (odd? 1.0) would signal an error since only exact integers
594 were recognized as integers. Now (odd? 1.0) returns #t, (odd? 2.0)
595 returns #f and (odd? 1.5) signals an error.
597 ** Guile now has uninterned symbols.
599 The new function 'make-symbol' will return an uninterned symbol. This
600 is a symbol that is unique and is guaranteed to remain unique.
601 However, uninterned symbols can not yet be read back in.
603 Use the new function 'symbol-interned?' to check whether a symbol is
606 ** pretty-print has more options.
608 The function pretty-print from the (ice-9 pretty-print) module can now
609 also be invoked with keyword arguments that control things like
610 maximum output width. See the manual for details.
612 ** Variables have no longer a special behavior for `equal?'.
614 Previously, comparing two variables with `equal?' would recursivly
615 compare their values. This is no longer done. Variables are now only
616 `equal?' if they are `eq?'.
618 ** `(begin)' is now valid.
620 You can now use an empty `begin' form. It will yield #<unspecified>
621 when evaluated and simply be ignored in a definition context.
623 ** Deprecated: procedure->macro
625 Change your code to use 'define-macro' or r5rs macros. Also, be aware
626 that macro expansion will not be done during evaluation, but prior to
629 ** Soft ports now allow a `char-ready?' procedure
631 The vector argument to `make-soft-port' can now have a length of
632 either 5 or 6. (Previously the length had to be 5.) The optional 6th
633 element is interpreted as an `input-waiting' thunk -- i.e. a thunk
634 that returns the number of characters that can be read immediately
635 without the soft port blocking.
637 ** Deprecated: undefine
639 There is no replacement for undefine.
641 ** The functions make-keyword-from-dash-symbol and keyword-dash-symbol
642 have been discouraged.
644 They are relics from a time where a keyword like #:foo was used
645 directly as a Tcl option "-foo" and thus keywords were internally
646 stored as a symbol with a starting dash. We now store a symbol
649 Use symbol->keyword and keyword->symbol instead.
651 ** The `cheap' debug option is now obsolete
653 Evaluator trap calls are now unconditionally "cheap" - in other words,
654 they pass a debug object to the trap handler rather than a full
655 continuation. The trap handler code can capture a full continuation
656 by using `call-with-current-continuation' in the usual way, if it so
659 The `cheap' option is retained for now so as not to break existing
660 code which gets or sets it, but setting it now has no effect. It will
661 be removed in the next major Guile release.
663 ** Evaluator trap calls now support `tweaking'
665 `Tweaking' means that the trap handler code can modify the Scheme
666 expression that is about to be evaluated (in the case of an
667 enter-frame trap) or the value that is being returned (in the case of
668 an exit-frame trap). The trap handler code indicates that it wants to
669 do this by returning a pair whose car is the symbol 'instead and whose
670 cdr is the modified expression or return value.
672 * Changes to the C interface
674 ** The functions scm_hash_fn_remove_x and scm_hashx_remove_x no longer
675 take a 'delete' function argument.
677 This argument makes no sense since the delete function is used to
678 remove a pair from an alist, and this must not be configurable.
680 This is an incompatible change.
682 ** The GH interface is now subject to the deprecation mechanism
684 The GH interface has been deprecated for quite some time but now it is
685 actually removed from Guile when it is configured with
686 --disable-deprecated.
688 See the manual "Transitioning away from GH" for more information.
690 ** A new family of functions for converting between C values and
691 Scheme values has been added.
693 These functions follow a common naming scheme and are designed to be
694 easier to use, thread-safe and more future-proof than the older
699 These are predicates that return a C boolean: 1 or 0. Instead of
700 SCM_NFALSEP, you can now use scm_is_true, for example.
702 - <type> scm_to_<type> (SCM val, ...)
704 These are functions that convert a Scheme value into an appropriate
705 C value. For example, you can use scm_to_int to safely convert from
708 - SCM scm_from_<type> (<type> val, ...)
710 These functions convert from a C type to a SCM value; for example,
711 scm_from_int for ints.
713 There is a huge number of these functions, for numbers, strings,
714 symbols, vectors, etc. They are documented in the reference manual in
715 the API section together with the types that they apply to.
717 ** New functions for dealing with complex numbers in C have been added.
719 The new functions are scm_c_make_rectangular, scm_c_make_polar,
720 scm_c_real_part, scm_c_imag_part, scm_c_magnitude and scm_c_angle.
721 They work like scm_make_rectangular etc but take or return doubles
724 ** The function scm_make_complex has been discouraged.
726 Use scm_c_make_rectangular instead.
728 ** The INUM macros have been deprecated.
730 A lot of code uses these macros to do general integer conversions,
731 although the macros only work correctly with fixnums. Use the
732 following alternatives.
734 SCM_INUMP -> scm_is_integer or similar
735 SCM_NINUMP -> !scm_is_integer or similar
736 SCM_MAKINUM -> scm_from_int or similar
737 SCM_INUM -> scm_to_int or similar
739 SCM_VALIDATE_INUM_* -> Do not use these; scm_to_int, etc. will
740 do the validating for you.
742 ** The scm_num2<type> and scm_<type>2num functions and scm_make_real
743 have been discouraged.
745 Use the newer scm_to_<type> and scm_from_<type> functions instead for
746 new code. The functions have been discouraged since they don't fit
749 ** The 'boolean' macros SCM_FALSEP etc have been discouraged.
751 They have strange names, especially SCM_NFALSEP, and SCM_BOOLP
752 evaluates its argument twice. Use scm_is_true, etc. instead for new
755 ** The macro SCM_EQ_P has been discouraged.
757 Use scm_is_eq for new code, which fits better into the naming
760 ** The macros SCM_CONSP, SCM_NCONSP, SCM_NULLP, and SCM_NNULLP have
763 Use the function scm_is_pair or scm_is_null instead.
765 ** The functions scm_round and scm_truncate have been deprecated and
766 are now available as scm_c_round and scm_c_truncate, respectively.
768 These functions occupy the names that scm_round_number and
769 scm_truncate_number should have.
771 ** The functions scm_c_string2str, scm_c_substring2str, and
772 scm_c_symbol2str have been deprecated.
774 Use scm_to_locale_stringbuf or similar instead, maybe together with
777 ** New functions scm_c_make_string, scm_c_string_length,
778 scm_c_string_ref, scm_c_string_set_x, scm_c_substring,
779 scm_c_substring_shared, scm_c_substring_copy.
781 These are like scm_make_string, scm_length, etc. but are slightly
782 easier to use from C.
784 ** The macros SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_LENGTH,
785 SCM_SYMBOL_CHARS, and SCM_SYMBOL_LENGTH have been deprecated.
787 They export too many assumptions about the implementation of strings
788 and symbols that are no longer true in the presence of
789 mutation-sharing substrings and when Guile switches to some form of
792 When working with strings, it is often best to use the normal string
793 functions provided by Guile, such as scm_c_string_ref,
794 scm_c_string_set_x, scm_string_append, etc. Be sure to look in the
795 manual since many more such functions are now provided than
798 When you want to convert a SCM string to a C string, use the
799 scm_to_locale_string function or similar instead. For symbols, use
800 scm_symbol_to_string and then work with that string. Because of the
801 new string representation, scm_symbol_to_string does not need to copy
802 and is thus quite efficient.
804 ** Some string, symbol and keyword functions have been discouraged.
806 They don't fit into the uniform naming scheme and are not explicit
807 about the character encoding.
809 Replace according to the following table:
811 scm_allocate_string -> scm_c_make_string
812 scm_take_str -> scm_take_locale_stringn
813 scm_take0str -> scm_take_locale_string
814 scm_mem2string -> scm_from_locale_stringn
815 scm_str2string -> scm_from_locale_string
816 scm_makfrom0str -> scm_from_locale_string
817 scm_mem2symbol -> scm_from_locale_symboln
818 scm_mem2uninterned_symbol -> scm_from_locale_stringn + scm_make_symbol
819 scm_str2symbol -> scm_from_locale_symbol
821 SCM_SYMBOL_HASH -> scm_hashq
822 SCM_SYMBOL_INTERNED_P -> scm_symbol_interned_p
824 scm_c_make_keyword -> scm_from_locale_keyword
826 ** The functions scm_keyword_to_symbol and sym_symbol_to_keyword are
827 now also available to C code.
829 ** SCM_KEYWORDP and SCM_KEYWORDSYM have been deprecated.
831 Use scm_is_keyword and scm_keyword_to_symbol instead, but note that
832 the latter returns the true name of the keyword, not the 'dash name',
833 as SCM_KEYWORDSYM used to do.
835 ** A new way to access arrays in a thread-safe and efficient way has
838 See the manual, node "Accessing Arrays From C".
840 ** The old uniform vector and bitvector implementations have been
841 unceremoniously removed.
843 This implementation exposed the details of the tagging system of
844 Guile. Use the new C API explained in the manual in node "Uniform
845 Numeric Vectors" and "Bit Vectors", respectively.
847 The following macros are gone: SCM_UVECTOR_BASE, SCM_SET_UVECTOR_BASE,
848 SCM_UVECTOR_MAXLENGTH, SCM_UVECTOR_LENGTH, SCM_MAKE_UVECTOR_TAG,
849 SCM_SET_UVECTOR_LENGTH, SCM_BITVECTOR_P, SCM_BITVECTOR_BASE,
850 SCM_SET_BITVECTOR_BASE, SCM_BITVECTOR_MAX_LENGTH,
851 SCM_BITVECTOR_LENGTH, SCM_MAKE_BITVECTOR_TAG,
852 SCM_SET_BITVECTOR_LENGTH, SCM_BITVEC_REF, SCM_BITVEC_SET,
855 ** The macros dealing with vectors have been deprecated.
857 Use the new functions scm_is_vector, scm_vector_elements,
858 scm_vector_writable_elements, etc, or scm_is_simple_vector,
859 SCM_SIMPLE_VECTOR_REF, SCM_SIMPLE_VECTOR_SET, etc instead. See the
860 manual for more details.
862 Deprecated are SCM_VECTORP, SCM_VELTS, SCM_VECTOR_MAX_LENGTH,
863 SCM_VECTOR_LENGTH, SCM_VECTOR_REF, SCM_VECTOR_SET, SCM_WRITABLE_VELTS.
865 The following macros have been removed: SCM_VECTOR_BASE,
866 SCM_SET_VECTOR_BASE, SCM_MAKE_VECTOR_TAG, SCM_SET_VECTOR_LENGTH,
867 SCM_VELTS_AS_STACKITEMS, SCM_SETVELTS, SCM_GC_WRITABLE_VELTS.
869 ** Some C functions and macros related to arrays have been deprecated.
871 Migrate according to the following table:
873 scm_make_uve -> scm_make_typed_array, scm_make_u8vector etc.
874 scm_make_ra -> scm_make_array
875 scm_shap2ra -> scm_make_array
876 scm_cvref -> scm_c_generalized_vector_ref
877 scm_ra_set_contp -> do not use
878 scm_aind -> scm_array_handle_pos
879 scm_raprin1 -> scm_display or scm_write
881 SCM_ARRAYP -> scm_is_array
882 SCM_ARRAY_NDIM -> scm_c_array_rank
883 SCM_ARRAY_DIMS -> scm_array_handle_dims
884 SCM_ARRAY_CONTP -> do not use
885 SCM_ARRAY_MEM -> do not use
886 SCM_ARRAY_V -> scm_array_handle_elements or similar
887 SCM_ARRAY_BASE -> do not use
889 ** SCM_CELL_WORD_LOC has been deprecated.
891 Use the new macro SCM_CELL_OBJECT_LOC instead, which returns a pointer
892 to a SCM, as opposed to a pointer to a scm_t_bits.
894 This was done to allow the correct use of pointers into the Scheme
895 heap. Previously, the heap words were of type scm_t_bits and local
896 variables and function arguments were of type SCM, making it
897 non-standards-conformant to have a pointer that can point to both.
899 ** New macros SCM_SMOB_DATA_2, SCM_SMOB_DATA_3, etc.
901 These macros should be used instead of SCM_CELL_WORD_2/3 to access the
902 second and third words of double smobs. Likewise for
903 SCM_SET_SMOB_DATA_2 and SCM_SET_SMOB_DATA_3.
905 Also, there is SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS that should be
906 used to get and set the 16 exra bits in the zeroth word of a smob.
908 And finally, there is SCM_SMOB_OBJECT and SCM_SMOB_SET_OBJECT for
909 accesing the first immediate word of a smob as a SCM value, and there
910 is SCM_SMOB_OBJECT_LOC for getting a pointer to the first immediate
911 smob word. Like wise for SCM_SMOB_OBJECT_2, etc.
913 ** New way to deal with non-local exits and re-entries.
915 There is a new set of functions that essentially do what
916 scm_internal_dynamic_wind does, but in a way that is more convenient
917 for C code in some situations. Here is a quick example of how to
918 prevent a potential memory leak:
925 scm_dynwind_begin (0);
927 mem = scm_malloc (100);
928 scm_dynwind_unwind_handler (free, mem, SCM_F_WIND_EXPLICITLY);
930 /* MEM would leak if BAR throws an error.
931 SCM_DYNWIND_UNWIND_HANDLER frees it nevertheless.
938 /* Because of SCM_F_WIND_EXPLICITLY, MEM will be freed by
939 SCM_DYNWIND_END as well.
943 For full documentation, see the node "Dynamic Wind" in the manual.
945 ** New function scm_dynwind_free
947 This function calls 'free' on a given pointer when a dynwind context
948 is left. Thus the call to scm_dynwind_unwind_handler above could be
949 replaced with simply scm_dynwind_free (mem).
951 ** New functions scm_c_call_with_blocked_asyncs and
952 scm_c_call_with_unblocked_asyncs
954 Like scm_call_with_blocked_asyncs etc. but for C functions.
956 ** New functions scm_dynwind_block_asyncs and scm_dynwind_unblock_asyncs
958 In addition to scm_c_call_with_blocked_asyncs you can now also use
959 scm_dynwind_block_asyncs in a 'dynwind context' (see above). Likewise for
960 scm_c_call_with_unblocked_asyncs and scm_dynwind_unblock_asyncs.
962 ** The macros SCM_DEFER_INTS, SCM_ALLOW_INTS, SCM_REDEFER_INTS,
963 SCM_REALLOW_INTS have been deprecated.
965 They do no longer fulfill their original role of blocking signal
966 delivery. Depending on what you want to achieve, replace a pair of
967 SCM_DEFER_INTS and SCM_ALLOW_INTS with a dynwind context that locks a
968 mutex, blocks asyncs, or both. See node "Critical Sections" in the
971 ** The value 'scm_mask_ints' is no longer writable.
973 Previously, you could set scm_mask_ints directly. This is no longer
974 possible. Use scm_c_call_with_blocked_asyncs and
975 scm_c_call_with_unblocked_asyncs instead.
977 ** New way to temporarily set the current input, output or error ports
979 C code can now use scm_dynwind_current_<foo>_port in a 'dynwind
980 context' (see above). <foo> is one of "input", "output" or "error".
982 ** New way to temporarily set fluids
984 C code can now use scm_dynwind_fluid in a 'dynwind context' (see
985 above) to temporarily set the value of a fluid.
987 ** New types scm_t_intmax and scm_t_uintmax.
989 On platforms that have them, these types are identical to intmax_t and
990 uintmax_t, respectively. On other platforms, they are identical to
991 the largest integer types that Guile knows about.
993 ** The functions scm_unmemocopy and scm_unmemoize have been removed.
995 You should not have used them.
997 ** Many public #defines with generic names have been made private.
999 #defines with generic names like HAVE_FOO or SIZEOF_FOO have been made
1000 private or renamed with a more suitable public name.
1002 ** The macro SCM_TYP16S has been deprecated.
1004 This macro is not intended for public use.
1006 ** The macro SCM_SLOPPY_INEXACTP has been deprecated.
1008 Use scm_is_true (scm_inexact_p (...)) instead.
1010 ** The macro SCM_SLOPPY_REALP has been deprecated.
1012 Use scm_is_real instead.
1014 ** The macro SCM_SLOPPY_COMPLEXP has been deprecated.
1016 Use scm_is_complex instead.
1018 ** Some preprocessor defines have been deprecated.
1020 These defines indicated whether a certain feature was present in Guile
1021 or not. Going forward, assume that the features are always present.
1023 The macros are: USE_THREADS, GUILE_ISELECT, READER_EXTENSIONS,
1024 DEBUG_EXTENSIONS, DYNAMIC_LINKING.
1026 The following macros have been removed completely: MEMOIZE_LOCALS,
1027 SCM_RECKLESS, SCM_CAUTIOUS.
1029 ** The preprocessor define STACK_DIRECTION has been deprecated.
1031 There should be no need to know about the stack direction for ordinary
1034 ** New function: scm_effective_version
1036 Returns the "effective" version number. This is just the normal full
1037 version string without the final micro-version number. See "Changes
1038 to the distribution" above.
1040 ** The function scm_call_with_new_thread has a new prototype.
1042 Instead of taking a list with the thunk and handler, these two
1043 arguments are now passed directly:
1045 SCM scm_call_with_new_thread (SCM thunk, SCM handler);
1047 This is an incompatible change.
1049 ** New snarfer macro SCM_DEFINE_PUBLIC.
1051 This is like SCM_DEFINE, but also calls scm_c_export for the defined
1052 function in the init section.
1054 ** The snarfer macro SCM_SNARF_INIT is now officially supported.
1056 ** Garbage collector rewrite.
1058 The garbage collector is cleaned up a lot, and now uses lazy
1059 sweeping. This is reflected in the output of (gc-stats); since cells
1060 are being freed when they are allocated, the cells-allocated field
1061 stays roughly constant.
1063 For malloc related triggers, the behavior is changed. It uses the same
1064 heuristic as the cell-triggered collections. It may be tuned with the
1065 environment variables GUILE_MIN_YIELD_MALLOC. This is the percentage
1066 for minimum yield of malloc related triggers. The default is 40.
1067 GUILE_INIT_MALLOC_LIMIT sets the initial trigger for doing a GC. The
1070 Debugging operations for the freelist have been deprecated, along with
1071 the C variables that control garbage collection. The environment
1072 variables GUILE_MAX_SEGMENT_SIZE, GUILE_INIT_SEGMENT_SIZE_2,
1073 GUILE_INIT_SEGMENT_SIZE_1, and GUILE_MIN_YIELD_2 should be used.
1075 For understanding the memory usage of a GUILE program, the routine
1076 gc-live-object-stats returns an alist containing the number of live
1077 objects for every type.
1080 ** The function scm_definedp has been renamed to scm_defined_p
1082 The name scm_definedp is deprecated.
1084 ** The struct scm_cell type has been renamed to scm_t_cell
1086 This is in accordance to Guile's naming scheme for types. Note that
1087 the name scm_cell is now used for a function that allocates and
1088 initializes a new cell (see below).
1090 ** New functions for memory management
1092 A new set of functions for memory management has been added since the
1093 old way (scm_must_malloc, scm_must_free, etc) was error prone and
1094 indeed, Guile itself contained some long standing bugs that could
1095 cause aborts in long running programs.
1097 The new functions are more symmetrical and do not need cooperation
1098 from smob free routines, among other improvements.
1100 The new functions are scm_malloc, scm_realloc, scm_calloc, scm_strdup,
1101 scm_strndup, scm_gc_malloc, scm_gc_calloc, scm_gc_realloc,
1102 scm_gc_free, scm_gc_register_collectable_memory, and
1103 scm_gc_unregister_collectable_memory. Refer to the manual for more
1104 details and for upgrading instructions.
1106 The old functions for memory management have been deprecated. They
1107 are: scm_must_malloc, scm_must_realloc, scm_must_free,
1108 scm_must_strdup, scm_must_strndup, scm_done_malloc, scm_done_free.
1110 ** Declarations of exported features are marked with SCM_API.
1112 Every declaration of a feature that belongs to the exported Guile API
1113 has been marked by adding the macro "SCM_API" to the start of the
1114 declaration. This macro can expand into different things, the most
1115 common of which is just "extern" for Unix platforms. On Win32, it can
1116 be used to control which symbols are exported from a DLL.
1118 If you `#define SCM_IMPORT' before including <libguile.h>, SCM_API
1119 will expand into "__declspec (dllimport) extern", which is needed for
1120 linking to the Guile DLL in Windows.
1122 There are also SCM_RL_IMPORT, SCM_SRFI1314_IMPORT, and
1123 SCM_SRFI4_IMPORT, for the corresponding libraries.
1125 ** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated.
1127 Use the new functions scm_cell and scm_double_cell instead. The old
1128 macros had problems because with them allocation and initialization
1129 was separated and the GC could sometimes observe half initialized
1130 cells. Only careful coding by the user of SCM_NEWCELL and
1131 SCM_NEWCELL2 could make this safe and efficient.
1133 ** CHECK_ENTRY, CHECK_APPLY and CHECK_EXIT have been deprecated.
1135 Use the variables scm_check_entry_p, scm_check_apply_p and scm_check_exit_p
1138 ** SRCBRKP has been deprecated.
1140 Use scm_c_source_property_breakpoint_p instead.
1142 ** Deprecated: scm_makmacro
1144 Change your code to use either scm_makmmacro or to define macros in
1145 Scheme, using 'define-macro'.
1147 ** New function scm_c_port_for_each.
1149 This function is like scm_port_for_each but takes a pointer to a C
1150 function as the callback instead of a SCM value.
1152 ** The names scm_internal_select, scm_thread_sleep, and
1153 scm_thread_usleep have been discouraged.
1155 Use scm_std_select, scm_std_sleep, scm_std_usleep instead.
1157 ** The GC can no longer be blocked.
1159 The global flags scm_gc_heap_lock and scm_block_gc have been removed.
1160 The GC can now run (partially) concurrently with other code and thus
1161 blocking it is not well defined.
1163 ** Many definitions have been removed that were previously deprecated.
1165 scm_lisp_nil, scm_lisp_t, s_nil_ify, scm_m_nil_ify, s_t_ify,
1166 scm_m_t_ify, s_0_cond, scm_m_0_cond, s_0_ify, scm_m_0_ify, s_1_ify,
1167 scm_m_1_ify, scm_debug_newcell, scm_debug_newcell2,
1168 scm_tc16_allocated, SCM_SET_SYMBOL_HASH, SCM_IM_NIL_IFY, SCM_IM_T_IFY,
1169 SCM_IM_0_COND, SCM_IM_0_IFY, SCM_IM_1_IFY, SCM_GC_SET_ALLOCATED,
1170 scm_debug_newcell, scm_debug_newcell2, SCM_HUP_SIGNAL, SCM_INT_SIGNAL,
1171 SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, SCM_ALRM_SIGNAL,
1172 SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, SCM_ORD_SIG,
1173 SCM_NUM_SIGS, scm_top_level_lookup_closure_var,
1174 *top-level-lookup-closure*, scm_system_transformer, scm_eval_3,
1175 scm_eval2, root_module_lookup_closure, SCM_SLOPPY_STRINGP,
1176 SCM_RWSTRINGP, scm_read_only_string_p, scm_make_shared_substring,
1177 scm_tc7_substring, sym_huh, SCM_VARVCELL, SCM_UDVARIABLEP,
1178 SCM_DEFVARIABLEP, scm_mkbig, scm_big2inum, scm_adjbig, scm_normbig,
1179 scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl, SCM_FIXNUM_BIT,
1180 SCM_SETCHARS, SCM_SLOPPY_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
1181 SCM_LENGTH_MAX, SCM_SETLENGTH, SCM_ROSTRINGP, SCM_ROLENGTH,
1182 SCM_ROCHARS, SCM_ROUCHARS, SCM_SUBSTRP, SCM_COERCE_SUBSTR,
1183 scm_sym2vcell, scm_intern, scm_intern0, scm_sysintern, scm_sysintern0,
1184 scm_sysintern0_no_module_lookup, scm_init_symbols_deprecated,
1185 scm_vector_set_length_x, scm_contregs, scm_debug_info,
1186 scm_debug_frame, SCM_DSIDEVAL, SCM_CONST_LONG, SCM_VCELL,
1187 SCM_GLOBAL_VCELL, SCM_VCELL_INIT, SCM_GLOBAL_VCELL_INIT,
1188 SCM_HUGE_LENGTH, SCM_VALIDATE_STRINGORSUBSTR, SCM_VALIDATE_ROSTRING,
1189 SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY,
1190 SCM_VALIDATE_RWSTRING, DIGITS, scm_small_istr2int, scm_istr2int,
1191 scm_istr2flo, scm_istring2number, scm_istr2int, scm_istr2flo,
1192 scm_istring2number, scm_vtable_index_vcell, scm_si_vcell, SCM_ECONSP,
1193 SCM_NECONSP, SCM_GLOC_VAR, SCM_GLOC_VAL, SCM_GLOC_SET_VAL,
1194 SCM_GLOC_VAL_LOC, scm_make_gloc, scm_gloc_p, scm_tc16_variable,
1195 SCM_CHARS, SCM_LENGTH, SCM_SET_STRING_CHARS, SCM_SET_STRING_LENGTH.
1197 * Changes to bundled modules
1201 Using the (ice-9 debug) module no longer automatically switches Guile
1202 to use the debugging evaluator. If you want to switch to the
1203 debugging evaluator (which is needed for backtrace information if you
1204 hit an error), please add an explicit "(debug-enable 'debug)" to your
1205 code just after the code to use (ice-9 debug).
1208 Changes since Guile 1.4:
1210 * Changes to the distribution
1212 ** A top-level TODO file is included.
1214 ** Guile now uses a versioning scheme similar to that of the Linux kernel.
1216 Guile now always uses three numbers to represent the version,
1217 i.e. "1.6.5". The first number, 1, is the major version number, the
1218 second number, 6, is the minor version number, and the third number,
1219 5, is the micro version number. Changes in major version number
1220 indicate major changes in Guile.
1222 Minor version numbers that are even denote stable releases, and odd
1223 minor version numbers denote development versions (which may be
1224 unstable). The micro version number indicates a minor sub-revision of
1225 a given MAJOR.MINOR release.
1227 In keeping with the new scheme, (minor-version) and scm_minor_version
1228 no longer return everything but the major version number. They now
1229 just return the minor version number. Two new functions
1230 (micro-version) and scm_micro_version have been added to report the
1231 micro version number.
1233 In addition, ./GUILE-VERSION now defines GUILE_MICRO_VERSION.
1235 ** New preprocessor definitions are available for checking versions.
1237 version.h now #defines SCM_MAJOR_VERSION, SCM_MINOR_VERSION, and
1238 SCM_MICRO_VERSION to the appropriate integer values.
1240 ** Guile now actively warns about deprecated features.
1242 The new configure option `--enable-deprecated=LEVEL' and the
1243 environment variable GUILE_WARN_DEPRECATED control this mechanism.
1244 See INSTALL and README for more information.
1246 ** Guile is much more likely to work on 64-bit architectures.
1248 Guile now compiles and passes "make check" with only two UNRESOLVED GC
1249 cases on Alpha and ia64 based machines now. Thanks to John Goerzen
1250 for the use of a test machine, and thanks to Stefan Jahn for ia64
1253 ** New functions: setitimer and getitimer.
1255 These implement a fairly direct interface to the libc functions of the
1258 ** The #. reader extension is now disabled by default.
1260 For safety reasons, #. evaluation is disabled by default. To
1261 re-enable it, set the fluid read-eval? to #t. For example:
1263 (fluid-set! read-eval? #t)
1265 but make sure you realize the potential security risks involved. With
1266 read-eval? enabled, reading a data file from an untrusted source can
1269 ** New SRFI modules have been added:
1271 SRFI-0 `cond-expand' is now supported in Guile, without requiring
1274 (srfi srfi-1) is a library containing many useful pair- and list-processing
1277 (srfi srfi-2) exports and-let*.
1279 (srfi srfi-4) implements homogeneous numeric vector datatypes.
1281 (srfi srfi-6) is a dummy module for now, since guile already provides
1282 all of the srfi-6 procedures by default: open-input-string,
1283 open-output-string, get-output-string.
1285 (srfi srfi-8) exports receive.
1287 (srfi srfi-9) exports define-record-type.
1289 (srfi srfi-10) exports define-reader-ctor and implements the reader
1292 (srfi srfi-11) exports let-values and let*-values.
1294 (srfi srfi-13) implements the SRFI String Library.
1296 (srfi srfi-14) implements the SRFI Character-Set Library.
1298 (srfi srfi-17) implements setter and getter-with-setter and redefines
1299 some accessor procedures as procedures with getters. (such as car,
1300 cdr, vector-ref etc.)
1302 (srfi srfi-19) implements the SRFI Time/Date Library.
1304 ** New scripts / "executable modules"
1306 Subdirectory "scripts" contains Scheme modules that are packaged to
1307 also be executable as scripts. At this time, these scripts are available:
1316 See README there for more info.
1318 These scripts can be invoked from the shell with the new program
1319 "guile-tools", which keeps track of installation directory for you.
1322 $ guile-tools display-commentary srfi/*.scm
1324 guile-tools is copied to the standard $bindir on "make install".
1326 ** New module (ice-9 stack-catch):
1328 stack-catch is like catch, but saves the current state of the stack in
1329 the fluid the-last-stack. This fluid can be useful when using the
1330 debugger and when re-throwing an error.
1332 ** The module (ice-9 and-let*) has been renamed to (ice-9 and-let-star)
1334 This has been done to prevent problems on lesser operating systems
1335 that can't tolerate `*'s in file names. The exported macro continues
1336 to be named `and-let*', of course.
1338 On systems that support it, there is also a compatibility module named
1339 (ice-9 and-let*). It will go away in the next release.
1341 ** New modules (oop goops) etc.:
1344 (oop goops describe)
1346 (oop goops active-slot)
1347 (oop goops composite-slot)
1349 The Guile Object Oriented Programming System (GOOPS) has been
1350 integrated into Guile. For further information, consult the GOOPS
1351 manual and tutorial in the `doc' directory.
1353 ** New module (ice-9 rdelim).
1355 This exports the following procedures which were previously defined
1356 in the default environment:
1358 read-line read-line! read-delimited read-delimited! %read-delimited!
1359 %read-line write-line
1361 For backwards compatibility the definitions are still imported into the
1362 default environment in this version of Guile. However you should add:
1364 (use-modules (ice-9 rdelim))
1366 to any program which uses the definitions, since this may change in
1369 Alternatively, if guile-scsh is installed, the (scsh rdelim) module
1370 can be used for similar functionality.
1372 ** New module (ice-9 rw)
1374 This is a subset of the (scsh rw) module from guile-scsh. Currently
1375 it defines two procedures:
1377 *** New function: read-string!/partial str [port_or_fdes [start [end]]]
1379 Read characters from a port or file descriptor into a string STR.
1380 A port must have an underlying file descriptor -- a so-called
1381 fport. This procedure is scsh-compatible and can efficiently read
1384 *** New function: write-string/partial str [port_or_fdes [start [end]]]
1386 Write characters from a string STR to a port or file descriptor.
1387 A port must have an underlying file descriptor -- a so-called
1388 fport. This procedure is mostly compatible and can efficiently
1389 write large strings.
1391 ** New module (ice-9 match)
1393 This module includes Andrew K. Wright's pattern matcher. See
1394 ice-9/match.scm for brief description or
1396 http://www.star-lab.com/wright/code.html
1398 for complete documentation.
1400 ** New module (ice-9 buffered-input)
1402 This module provides procedures to construct an input port from an
1403 underlying source of input that reads and returns its input in chunks.
1404 The underlying input source is a Scheme procedure, specified by the
1405 caller, which the port invokes whenever it needs more input.
1407 This is useful when building an input port whose back end is Readline
1408 or a UI element such as the GtkEntry widget.
1412 The reference and tutorial documentation that was previously
1413 distributed separately, as `guile-doc', is now included in the core
1414 Guile distribution. The documentation consists of the following
1417 - The Guile Tutorial (guile-tut.texi) contains a tutorial introduction
1420 - The Guile Reference Manual (guile.texi) contains (or is intended to
1421 contain) reference documentation on all aspects of Guile.
1423 - The GOOPS Manual (goops.texi) contains both tutorial-style and
1424 reference documentation for using GOOPS, Guile's Object Oriented
1427 - The Revised^5 Report on the Algorithmic Language Scheme
1430 See the README file in the `doc' directory for more details.
1432 ** There are a couple of examples in the examples/ directory now.
1434 * Changes to the stand-alone interpreter
1436 ** New command line option `--use-srfi'
1438 Using this option, SRFI modules can be loaded on startup and be
1439 available right from the beginning. This makes programming portable
1440 Scheme programs easier.
1442 The option `--use-srfi' expects a comma-separated list of numbers,
1443 each representing a SRFI number to be loaded into the interpreter
1444 before starting evaluating a script file or the REPL. Additionally,
1445 the feature identifier for the loaded SRFIs is recognized by
1446 `cond-expand' when using this option.
1449 $ guile --use-srfi=8,13
1450 guile> (receive (x z) (values 1 2) (+ 1 2))
1452 guile> (string-pad "bla" 20)
1455 ** Guile now always starts up in the `(guile-user)' module.
1457 Previously, scripts executed via the `-s' option would run in the
1458 `(guile)' module and the repl would run in the `(guile-user)' module.
1459 Now every user action takes place in the `(guile-user)' module by
1462 * Changes to Scheme functions and syntax
1464 ** Character classifiers work for non-ASCII characters.
1466 The predicates `char-alphabetic?', `char-numeric?',
1467 `char-whitespace?', `char-lower?', `char-upper?' and `char-is-both?'
1468 no longer check whether their arguments are ASCII characters.
1469 Previously, a character would only be considered alphabetic when it
1470 was also ASCII, for example.
1472 ** Previously deprecated Scheme functions have been removed:
1474 tag - no replacement.
1475 fseek - replaced by seek.
1476 list* - replaced by cons*.
1478 ** It's now possible to create modules with controlled environments
1482 (use-modules (ice-9 safe))
1483 (define m (make-safe-module))
1484 ;;; m will now be a module containing only a safe subset of R5RS
1485 (eval '(+ 1 2) m) --> 3
1486 (eval 'load m) --> ERROR: Unbound variable: load
1488 ** Evaluation of "()", the empty list, is now an error.
1490 Previously, the expression "()" evaluated to the empty list. This has
1491 been changed to signal a "missing expression" error. The correct way
1492 to write the empty list as a literal constant is to use quote: "'()".
1494 ** New concept of `Guile Extensions'.
1496 A Guile Extension is just a ordinary shared library that can be linked
1497 at run-time. We found it advantageous to give this simple concept a
1498 dedicated name to distinguish the issues related to shared libraries
1499 from the issues related to the module system.
1501 *** New function: load-extension
1503 Executing (load-extension lib init) is mostly equivalent to
1505 (dynamic-call init (dynamic-link lib))
1507 except when scm_register_extension has been called previously.
1508 Whenever appropriate, you should use `load-extension' instead of
1509 dynamic-link and dynamic-call.
1511 *** New C function: scm_c_register_extension
1513 This function registers a initialization function for use by
1514 `load-extension'. Use it when you don't want specific extensions to
1515 be loaded as shared libraries (for example on platforms that don't
1516 support dynamic linking).
1518 ** Auto-loading of compiled-code modules is deprecated.
1520 Guile used to be able to automatically find and link a shared
1521 library to satisfy requests for a module. For example, the module
1522 `(foo bar)' could be implemented by placing a shared library named
1523 "foo/libbar.so" (or with a different extension) in a directory on the
1526 This has been found to be too tricky, and is no longer supported. The
1527 shared libraries are now called "extensions". You should now write a
1528 small Scheme file that calls `load-extension' to load the shared
1529 library and initialize it explicitly.
1531 The shared libraries themselves should be installed in the usual
1532 places for shared libraries, with names like "libguile-foo-bar".
1534 For example, place this into a file "foo/bar.scm"
1536 (define-module (foo bar))
1538 (load-extension "libguile-foo-bar" "foobar_init")
1540 ** Backward incompatible change: eval EXP ENVIRONMENT-SPECIFIER
1542 `eval' is now R5RS, that is it takes two arguments.
1543 The second argument is an environment specifier, i.e. either
1545 (scheme-report-environment 5)
1546 (null-environment 5)
1547 (interaction-environment)
1553 ** The module system has been made more disciplined.
1555 The function `eval' will save and restore the current module around
1556 the evaluation of the specified expression. While this expression is
1557 evaluated, `(current-module)' will now return the right module, which
1558 is the module specified as the second argument to `eval'.
1560 A consequence of this change is that `eval' is not particularly
1561 useful when you want allow the evaluated code to change what module is
1562 designated as the current module and have this change persist from one
1563 call to `eval' to the next. The read-eval-print-loop is an example
1564 where `eval' is now inadequate. To compensate, there is a new
1565 function `primitive-eval' that does not take a module specifier and
1566 that does not save/restore the current module. You should use this
1567 function together with `set-current-module', `current-module', etc
1568 when you want to have more control over the state that is carried from
1569 one eval to the next.
1571 Additionally, it has been made sure that forms that are evaluated at
1572 the top level are always evaluated with respect to the current module.
1573 Previously, subforms of top-level forms such as `begin', `case',
1574 etc. did not respect changes to the current module although these
1575 subforms are at the top-level as well.
1577 To prevent strange behavior, the forms `define-module',
1578 `use-modules', `use-syntax', and `export' have been restricted to only
1579 work on the top level. The forms `define-public' and
1580 `defmacro-public' only export the new binding on the top level. They
1581 behave just like `define' and `defmacro', respectively, when they are
1582 used in a lexical environment.
1584 Also, `export' will no longer silently re-export bindings imported
1585 from a used module. It will emit a `deprecation' warning and will
1586 cease to perform any re-export in the next version. If you actually
1587 want to re-export bindings, use the new `re-export' in place of
1588 `export'. The new `re-export' will not make copies of variables when
1589 rexporting them, as `export' did wrongly.
1591 ** Module system now allows selection and renaming of imported bindings
1593 Previously, when using `use-modules' or the `#:use-module' clause in
1594 the `define-module' form, all the bindings (association of symbols to
1595 values) for imported modules were added to the "current module" on an
1596 as-is basis. This has been changed to allow finer control through two
1597 new facilities: selection and renaming.
1599 You can now select which of the imported module's bindings are to be
1600 visible in the current module by using the `:select' clause. This
1601 clause also can be used to rename individual bindings. For example:
1603 ;; import all bindings no questions asked
1604 (use-modules (ice-9 common-list))
1606 ;; import four bindings, renaming two of them;
1607 ;; the current module sees: every some zonk-y zonk-n
1608 (use-modules ((ice-9 common-list)
1610 (remove-if . zonk-y)
1611 (remove-if-not . zonk-n))))
1613 You can also programmatically rename all selected bindings using the
1614 `:renamer' clause, which specifies a proc that takes a symbol and
1615 returns another symbol. Because it is common practice to use a prefix,
1616 we now provide the convenience procedure `symbol-prefix-proc'. For
1619 ;; import four bindings, renaming two of them specifically,
1620 ;; and all four w/ prefix "CL:";
1621 ;; the current module sees: CL:every CL:some CL:zonk-y CL:zonk-n
1622 (use-modules ((ice-9 common-list)
1624 (remove-if . zonk-y)
1625 (remove-if-not . zonk-n))
1626 :renamer (symbol-prefix-proc 'CL:)))
1628 ;; import four bindings, renaming two of them specifically,
1629 ;; and all four by upcasing.
1630 ;; the current module sees: EVERY SOME ZONK-Y ZONK-N
1631 (define (upcase-symbol sym)
1632 (string->symbol (string-upcase (symbol->string sym))))
1634 (use-modules ((ice-9 common-list)
1636 (remove-if . zonk-y)
1637 (remove-if-not . zonk-n))
1638 :renamer upcase-symbol))
1640 Note that programmatic renaming is done *after* individual renaming.
1641 Also, the above examples show `use-modules', but the same facilities are
1642 available for the `#:use-module' clause of `define-module'.
1644 See manual for more info.
1646 ** The semantics of guardians have changed.
1648 The changes are for the most part compatible. An important criterion
1649 was to keep the typical usage of guardians as simple as before, but to
1650 make the semantics safer and (as a result) more useful.
1652 *** All objects returned from guardians are now properly alive.
1654 It is now guaranteed that any object referenced by an object returned
1655 from a guardian is alive. It's now impossible for a guardian to
1656 return a "contained" object before its "containing" object.
1658 One incompatible (but probably not very important) change resulting
1659 from this is that it is no longer possible to guard objects that
1660 indirectly reference themselves (i.e. are parts of cycles). If you do
1661 so accidentally, you'll get a warning.
1663 *** There are now two types of guardians: greedy and sharing.
1665 If you call (make-guardian #t) or just (make-guardian), you'll get a
1666 greedy guardian, and for (make-guardian #f) a sharing guardian.
1668 Greedy guardians are the default because they are more "defensive".
1669 You can only greedily guard an object once. If you guard an object
1670 more than once, once in a greedy guardian and the rest of times in
1671 sharing guardians, then it is guaranteed that the object won't be
1672 returned from sharing guardians as long as it is greedily guarded
1675 Guardians returned by calls to `make-guardian' can now take one more
1676 optional parameter, which says whether to throw an error in case an
1677 attempt is made to greedily guard an object that is already greedily
1678 guarded. The default is true, i.e. throw an error. If the parameter
1679 is false, the guardian invocation returns #t if guarding was
1680 successful and #f if it wasn't.
1682 Also, since greedy guarding is, in effect, a side-effecting operation
1683 on objects, a new function is introduced: `destroy-guardian!'.
1684 Invoking this function on a guardian renders it unoperative and, if
1685 the guardian is greedy, clears the "greedily guarded" property of the
1686 objects that were guarded by it, thus undoing the side effect.
1688 Note that all this hair is hardly very important, since guardian
1689 objects are usually permanent.
1691 ** Continuations created by call-with-current-continuation now accept
1692 any number of arguments, as required by R5RS.
1694 ** New function `issue-deprecation-warning'
1696 This function is used to display the deprecation messages that are
1697 controlled by GUILE_WARN_DEPRECATION as explained in the README.
1700 (issue-deprecation-warning "`id' is deprecated. Use `identity' instead.")
1704 ;; `id' is deprecated. Use `identity' instead.
1709 ** New syntax `begin-deprecated'
1711 When deprecated features are included (as determined by the configure
1712 option --enable-deprecated), `begin-deprecated' is identical to
1713 `begin'. When deprecated features are excluded, it always evaluates
1714 to `#f', ignoring the body forms.
1716 ** New function `make-object-property'
1718 This function returns a new `procedure with setter' P that can be used
1719 to attach a property to objects. When calling P as
1723 where `obj' is any kind of object, it attaches `val' to `obj' in such
1724 a way that it can be retrieved by calling P as
1728 This function will replace procedure properties, symbol properties and
1729 source properties eventually.
1731 ** Module (ice-9 optargs) now uses keywords instead of `#&'.
1733 Instead of #&optional, #&key, etc you should now use #:optional,
1734 #:key, etc. Since #:optional is a keyword, you can write it as just
1735 :optional when (read-set! keywords 'prefix) is active.
1737 The old reader syntax `#&' is still supported, but deprecated. It
1738 will be removed in the next release.
1740 ** New define-module option: pure
1742 Tells the module system not to include any bindings from the root
1747 (define-module (totally-empty-module)
1750 ** New define-module option: export NAME1 ...
1752 Export names NAME1 ...
1754 This option is required if you want to be able to export bindings from
1755 a module which doesn't import one of `define-public' or `export'.
1759 (define-module (foo)
1761 :use-module (ice-9 r5rs)
1764 ;;; Note that we're pure R5RS below this point!
1769 ** New function: object->string OBJ
1771 Return a Scheme string obtained by printing a given object.
1773 ** New function: port? X
1775 Returns a boolean indicating whether X is a port. Equivalent to
1776 `(or (input-port? X) (output-port? X))'.
1778 ** New function: file-port?
1780 Determines whether a given object is a port that is related to a file.
1782 ** New function: port-for-each proc
1784 Apply PROC to each port in the Guile port table in turn. The return
1785 value is unspecified. More specifically, PROC is applied exactly once
1786 to every port that exists in the system at the time PORT-FOR-EACH is
1787 invoked. Changes to the port table while PORT-FOR-EACH is running
1788 have no effect as far as PORT-FOR-EACH is concerned.
1790 ** New function: dup2 oldfd newfd
1792 A simple wrapper for the `dup2' system call. Copies the file
1793 descriptor OLDFD to descriptor number NEWFD, replacing the
1794 previous meaning of NEWFD. Both OLDFD and NEWFD must be integers.
1795 Unlike for dup->fdes or primitive-move->fdes, no attempt is made
1796 to move away ports which are using NEWFD. The return value is
1799 ** New function: close-fdes fd
1801 A simple wrapper for the `close' system call. Close file
1802 descriptor FD, which must be an integer. Unlike close (*note
1803 close: Ports and File Descriptors.), the file descriptor will be
1804 closed even if a port is using it. The return value is
1807 ** New function: crypt password salt
1809 Encrypts `password' using the standard unix password encryption
1812 ** New function: chroot path
1814 Change the root directory of the running process to `path'.
1816 ** New functions: getlogin, cuserid
1818 Return the login name or the user name of the current effective user
1821 ** New functions: getpriority which who, setpriority which who prio
1823 Get or set the priority of the running process.
1825 ** New function: getpass prompt
1827 Read a password from the terminal, first displaying `prompt' and
1830 ** New function: flock file operation
1832 Set/remove an advisory shared or exclusive lock on `file'.
1834 ** New functions: sethostname name, gethostname
1836 Set or get the hostname of the machine the current process is running
1839 ** New function: mkstemp! tmpl
1841 mkstemp creates a new unique file in the file system and returns a
1842 new buffered port open for reading and writing to the file. TMPL
1843 is a string specifying where the file should be created: it must
1844 end with `XXXXXX' and will be changed in place to return the name
1845 of the temporary file.
1847 ** New function: open-input-string string
1849 Return an input string port which delivers the characters from
1850 `string'. This procedure, together with `open-output-string' and
1851 `get-output-string' implements SRFI-6.
1853 ** New function: open-output-string
1855 Return an output string port which collects all data written to it.
1856 The data can then be retrieved by `get-output-string'.
1858 ** New function: get-output-string
1860 Return the contents of an output string port.
1862 ** New function: identity
1864 Return the argument.
1866 ** socket, connect, accept etc., now have support for IPv6. IPv6 addresses
1867 are represented in Scheme as integers with normal host byte ordering.
1869 ** New function: inet-pton family address
1871 Convert a printable string network address into an integer. Note that
1872 unlike the C version of this function, the result is an integer with
1873 normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
1876 (inet-pton AF_INET "127.0.0.1") => 2130706433
1877 (inet-pton AF_INET6 "::1") => 1
1879 ** New function: inet-ntop family address
1881 Convert an integer network address into a printable string. Note that
1882 unlike the C version of this function, the input is an integer with
1883 normal host byte ordering. FAMILY can be `AF_INET' or `AF_INET6'.
1886 (inet-ntop AF_INET 2130706433) => "127.0.0.1"
1887 (inet-ntop AF_INET6 (- (expt 2 128) 1)) =>
1888 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
1892 Use `identity' instead.
1898 ** Deprecated: return-it
1902 ** Deprecated: string-character-length
1904 Use `string-length' instead.
1906 ** Deprecated: flags
1908 Use `logior' instead.
1910 ** Deprecated: close-all-ports-except.
1912 This was intended for closing ports in a child process after a fork,
1913 but it has the undesirable side effect of flushing buffers.
1914 port-for-each is more flexible.
1916 ** The (ice-9 popen) module now attempts to set up file descriptors in
1917 the child process from the current Scheme ports, instead of using the
1918 current values of file descriptors 0, 1, and 2 in the parent process.
1920 ** Removed function: builtin-weak-bindings
1922 There is no such concept as a weak binding any more.
1924 ** Removed constants: bignum-radix, scm-line-incrementors
1926 ** define-method: New syntax mandatory.
1928 The new method syntax is now mandatory:
1930 (define-method (NAME ARG-SPEC ...) BODY ...)
1931 (define-method (NAME ARG-SPEC ... . REST-ARG) BODY ...)
1933 ARG-SPEC ::= ARG-NAME | (ARG-NAME TYPE)
1934 REST-ARG ::= ARG-NAME
1936 If you have old code using the old syntax, import
1937 (oop goops old-define-method) before (oop goops) as in:
1939 (use-modules (oop goops old-define-method) (oop goops))
1941 ** Deprecated function: builtin-variable
1942 Removed function: builtin-bindings
1944 There is no longer a distinction between builtin or other variables.
1945 Use module system operations for all variables.
1947 ** Lazy-catch handlers are no longer allowed to return.
1949 That is, a call to `throw', `error', etc is now guaranteed to not
1952 ** Bugfixes for (ice-9 getopt-long)
1954 This module is now tested using test-suite/tests/getopt-long.test.
1955 The following bugs have been fixed:
1957 *** Parsing for options that are specified to have `optional' args now checks
1958 if the next element is an option instead of unconditionally taking it as the
1961 *** An error is now thrown for `--opt=val' when the option description
1962 does not specify `(value #t)' or `(value optional)'. This condition used to
1963 be accepted w/o error, contrary to the documentation.
1965 *** The error message for unrecognized options is now more informative.
1966 It used to be "not a record", an artifact of the implementation.
1968 *** The error message for `--opt' terminating the arg list (no value), when
1969 `(value #t)' is specified, is now more informative. It used to be "not enough
1972 *** "Clumped" single-char args now preserve trailing string, use it as arg.
1973 The expansion used to be like so:
1975 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "--xyz")
1977 Note that the "5d" is dropped. Now it is like so:
1979 ("-abc5d" "--xyz") => ("-a" "-b" "-c" "5d" "--xyz")
1981 This enables single-char options to have adjoining arguments as long as their
1982 constituent characters are not potential single-char options.
1984 ** (ice-9 session) procedure `arity' now works with (ice-9 optargs) `lambda*'
1986 The `lambda*' and derivative forms in (ice-9 optargs) now set a procedure
1987 property `arglist', which can be retrieved by `arity'. The result is that
1988 `arity' can give more detailed information than before:
1992 guile> (use-modules (ice-9 optargs))
1993 guile> (define* (foo #:optional a b c) a)
1995 0 or more arguments in `lambda*:G0'.
2000 3 optional arguments: `a', `b' and `c'.
2001 guile> (define* (bar a b #:key c d #:allow-other-keys) a)
2003 2 required arguments: `a' and `b', 2 keyword arguments: `c'
2004 and `d', other keywords allowed.
2005 guile> (define* (baz a b #:optional c #:rest r) a)
2007 2 required arguments: `a' and `b', 1 optional argument: `c',
2010 * Changes to the C interface
2012 ** Types have been renamed from scm_*_t to scm_t_*.
2014 This has been done for POSIX sake. It reserves identifiers ending
2015 with "_t". What a concept.
2017 The old names are still available with status `deprecated'.
2019 ** scm_t_bits (former scm_bits_t) is now a unsigned type.
2021 ** Deprecated features have been removed.
2025 SCM_INPORTP, SCM_OUTPORTP SCM_ICHRP, SCM_ICHR, SCM_MAKICHR
2026 SCM_SETJMPBUF SCM_NSTRINGP SCM_NRWSTRINGP SCM_NVECTORP SCM_DOUBLE_CELLP
2028 *** C Functions removed
2030 scm_sysmissing scm_tag scm_tc16_flo scm_tc_flo
2031 scm_fseek - replaced by scm_seek.
2032 gc-thunk - replaced by after-gc-hook.
2033 gh_int2scmb - replaced by gh_bool2scm.
2034 scm_tc_dblr - replaced by scm_tc16_real.
2035 scm_tc_dblc - replaced by scm_tc16_complex.
2036 scm_list_star - replaced by scm_cons_star.
2038 ** Deprecated: scm_makfromstr
2040 Use scm_mem2string instead.
2042 ** Deprecated: scm_make_shared_substring
2044 Explicit shared substrings will disappear from Guile.
2046 Instead, "normal" strings will be implemented using sharing
2047 internally, combined with a copy-on-write strategy.
2049 ** Deprecated: scm_read_only_string_p
2051 The concept of read-only strings will disappear in next release of
2054 ** Deprecated: scm_sloppy_memq, scm_sloppy_memv, scm_sloppy_member
2056 Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
2058 ** New functions: scm_call_0, scm_call_1, scm_call_2, scm_call_3
2060 Call a procedure with the indicated number of arguments. See "Fly
2061 Evaluation" in the manual.
2063 ** New functions: scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3
2065 Call a procedure with the indicated number of arguments and a list of
2066 further arguments. See "Fly Evaluation" in the manual.
2068 ** New functions: scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5
2070 Create a list of the given number of elements. See "List
2071 Constructors" in the manual.
2073 ** Renamed function: scm_listify has been replaced by scm_list_n.
2075 ** Deprecated macros: SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4,
2076 SCM_LIST5, SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9.
2078 Use functions scm_list_N instead.
2080 ** New function: scm_c_read (SCM port, void *buffer, scm_sizet size)
2082 Used by an application to read arbitrary number of bytes from a port.
2083 Same semantics as libc read, except that scm_c_read only returns less
2084 than SIZE bytes if at end-of-file.
2086 Warning: Doesn't update port line and column counts!
2088 ** New function: scm_c_write (SCM port, const void *ptr, scm_sizet size)
2090 Used by an application to write arbitrary number of bytes to an SCM
2091 port. Similar semantics as libc write. However, unlike libc
2092 write, scm_c_write writes the requested number of bytes and has no
2095 Warning: Doesn't update port line and column counts!
2097 ** New function: scm_init_guile ()
2099 In contrast to scm_boot_guile, scm_init_guile will return normally
2100 after initializing Guile. It is not available on all systems, tho.
2102 ** New functions: scm_str2symbol, scm_mem2symbol
2104 The function scm_str2symbol takes a const char* pointing to a zero-terminated
2105 field of characters and creates a scheme symbol object from that C string.
2106 The function scm_mem2symbol takes a const char* and a number of characters and
2107 creates a symbol from the characters in that memory area.
2109 ** New functions: scm_primitive_make_property
2110 scm_primitive_property_ref
2111 scm_primitive_property_set_x
2112 scm_primitive_property_del_x
2114 These functions implement a new way to deal with object properties.
2115 See libguile/properties.c for their documentation.
2117 ** New function: scm_done_free (long size)
2119 This function is the inverse of scm_done_malloc. Use it to report the
2120 amount of smob memory you free. The previous method, which involved
2121 calling scm_done_malloc with negative argument, was somewhat
2122 unintuitive (and is still available, of course).
2124 ** New function: scm_c_memq (SCM obj, SCM list)
2126 This function provides a fast C level alternative for scm_memq for the case
2127 that the list parameter is known to be a proper list. The function is a
2128 replacement for scm_sloppy_memq, but is stricter in its requirements on its
2129 list input parameter, since for anything else but a proper list the function's
2130 behaviour is undefined - it may even crash or loop endlessly. Further, for
2131 the case that the object is not found in the list, scm_c_memq returns #f which
2132 is similar to scm_memq, but different from scm_sloppy_memq's behaviour.
2134 ** New functions: scm_remember_upto_here_1, scm_remember_upto_here_2,
2135 scm_remember_upto_here
2137 These functions replace the function scm_remember.
2139 ** Deprecated function: scm_remember
2141 Use one of the new functions scm_remember_upto_here_1,
2142 scm_remember_upto_here_2 or scm_remember_upto_here instead.
2144 ** New function: scm_allocate_string
2146 This function replaces the function scm_makstr.
2148 ** Deprecated function: scm_makstr
2150 Use the new function scm_allocate_string instead.
2152 ** New global variable scm_gc_running_p introduced.
2154 Use this variable to find out if garbage collection is being executed. Up to
2155 now applications have used scm_gc_heap_lock to test if garbage collection was
2156 running, which also works because of the fact that up to know only the garbage
2157 collector has set this variable. But, this is an implementation detail that
2158 may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use
2159 of this variable is (and has been) not fully safe anyway.
2161 ** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH
2163 Use these instead of SCM_LENGTH_MAX.
2165 ** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH,
2166 SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH,
2167 SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH.
2169 Use these instead of SCM_LENGTH.
2171 ** New macros: SCM_SET_CONTINUATION_LENGTH, SCM_SET_STRING_LENGTH,
2172 SCM_SET_SYMBOL_LENGTH, SCM_SET_VECTOR_LENGTH, SCM_SET_UVECTOR_LENGTH,
2173 SCM_SET_BITVECTOR_LENGTH
2175 Use these instead of SCM_SETLENGTH
2177 ** New macros: SCM_STRING_CHARS, SCM_SYMBOL_CHARS, SCM_CCLO_BASE,
2178 SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM,
2181 Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or
2184 ** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS,
2185 SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE,
2188 Use these instead of SCM_SETCHARS.
2190 ** New macro: SCM_BITVECTOR_P
2192 ** New macro: SCM_STRING_COERCE_0TERMINATION_X
2194 Use instead of SCM_COERCE_SUBSTR.
2196 ** New macros: SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN
2198 For directory objects, use these instead of SCM_OPDIRP and SCM_OPN.
2200 ** Deprecated macros: SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL,
2201 SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL,
2202 SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD,
2203 SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SYMBOL_SLOTS, SCM_SLOTS, SCM_SLOPPY_STRINGP,
2204 SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
2205 SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
2206 SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
2207 SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
2208 SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
2209 SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP,
2210 SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC,
2211 SCM_OPDIRP, SCM_VALIDATE_OPDIR, SCM_WTA, RETURN_SCM_WTA, SCM_CONST_LONG,
2212 SCM_WNA, SCM_FUNC_NAME, SCM_VALIDATE_NUMBER_COPY,
2213 SCM_VALIDATE_NUMBER_DEF_COPY, SCM_SLOPPY_CONSP, SCM_SLOPPY_NCONSP,
2214 SCM_SETAND_CDR, SCM_SETOR_CDR, SCM_SETAND_CAR, SCM_SETOR_CAR
2216 Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
2217 Use scm_memory_error instead of SCM_NALLOC.
2218 Use SCM_STRINGP instead of SCM_SLOPPY_STRINGP.
2219 Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_STRINGORSUBSTR.
2220 Use SCM_FREE_CELL_P instead of SCM_FREEP/SCM_NFREEP
2221 Use a type specific accessor macro instead of SCM_CHARS/SCM_UCHARS.
2222 Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH.
2223 Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING.
2224 Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
2225 Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
2226 Use SCM_STRINGP instead of SCM_RWSTRINGP.
2227 Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
2228 Use SCM_STRING_CHARS instead of SCM_ROCHARS.
2229 Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
2230 Use a type specific setter macro instead of SCM_SETLENGTH.
2231 Use a type specific setter macro instead of SCM_SETCHARS.
2232 Use a type specific length macro instead of SCM_LENGTH_MAX.
2233 Use SCM_GCMARKP instead of SCM_GC8MARKP.
2234 Use SCM_SETGCMARK instead of SCM_SETGC8MARK.
2235 Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK.
2236 Use SCM_TYP16 instead of SCM_GCTYP16.
2237 Use SCM_CDR instead of SCM_GCCDR.
2238 Use SCM_DIR_OPEN_P instead of SCM_OPDIRP.
2239 Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of SCM_WTA.
2240 Use SCM_MISC_ERROR or SCM_WRONG_TYPE_ARG instead of RETURN_SCM_WTA.
2241 Use SCM_VCELL_INIT instead of SCM_CONST_LONG.
2242 Use SCM_WRONG_NUM_ARGS instead of SCM_WNA.
2243 Use SCM_CONSP instead of SCM_SLOPPY_CONSP.
2244 Use !SCM_CONSP instead of SCM_SLOPPY_NCONSP.
2246 ** Removed function: scm_struct_init
2248 ** Removed variable: scm_symhash_dim
2250 ** Renamed function: scm_make_cont has been replaced by
2251 scm_make_continuation, which has a different interface.
2253 ** Deprecated function: scm_call_catching_errors
2255 Use scm_catch or scm_lazy_catch from throw.[ch] instead.
2257 ** Deprecated function: scm_strhash
2259 Use scm_string_hash instead.
2261 ** Deprecated function: scm_vector_set_length_x
2263 Instead, create a fresh vector of the desired size and copy the contents.
2265 ** scm_gensym has changed prototype
2267 scm_gensym now only takes one argument.
2269 ** Deprecated type tags: scm_tc7_ssymbol, scm_tc7_msymbol, scm_tcs_symbols,
2272 There is now only a single symbol type scm_tc7_symbol.
2273 The tag scm_tc7_lvector was not used anyway.
2275 ** Deprecated function: scm_make_smob_type_mfpe, scm_set_smob_mfpe.
2277 Use scm_make_smob_type and scm_set_smob_XXX instead.
2279 ** New function scm_set_smob_apply.
2281 This can be used to set an apply function to a smob type.
2283 ** Deprecated function: scm_strprint_obj
2285 Use scm_object_to_string instead.
2287 ** Deprecated function: scm_wta
2289 Use scm_wrong_type_arg, or another appropriate error signalling function
2292 ** Explicit support for obarrays has been deprecated.
2294 Use `scm_str2symbol' and the generic hashtable functions instead.
2296 ** The concept of `vcells' has been deprecated.
2298 The data type `variable' is now used exclusively. `Vcells' have been
2299 a low-level concept so you are likely not affected by this change.
2301 *** Deprecated functions: scm_sym2vcell, scm_sysintern,
2302 scm_sysintern0, scm_symbol_value0, scm_intern, scm_intern0.
2304 Use scm_c_define or scm_c_lookup instead, as appropriate.
2306 *** New functions: scm_c_module_lookup, scm_c_lookup,
2307 scm_c_module_define, scm_c_define, scm_module_lookup, scm_lookup,
2308 scm_module_define, scm_define.
2310 These functions work with variables instead of with vcells.
2312 ** New functions for creating and defining `subr's and `gsubr's.
2314 The new functions more clearly distinguish between creating a subr (or
2315 gsubr) object and adding it to the current module.
2317 These new functions are available: scm_c_make_subr, scm_c_define_subr,
2318 scm_c_make_subr_with_generic, scm_c_define_subr_with_generic,
2319 scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
2320 scm_c_define_gsubr_with_generic.
2322 ** Deprecated functions: scm_make_subr, scm_make_subr_opt,
2323 scm_make_subr_with_generic, scm_make_gsubr,
2324 scm_make_gsubr_with_generic.
2326 Use the new ones from above instead.
2328 ** C interface to the module system has changed.
2330 While we suggest that you avoid as many explicit module system
2331 operations from C as possible for the time being, the C interface has
2332 been made more similar to the high-level Scheme module system.
2334 *** New functions: scm_c_define_module, scm_c_use_module,
2335 scm_c_export, scm_c_resolve_module.
2337 They mostly work like their Scheme namesakes. scm_c_define_module
2338 takes a function that is called a context where the new module is
2341 *** Deprecated functions: scm_the_root_module, scm_make_module,
2342 scm_ensure_user_module, scm_load_scheme_module.
2344 Use the new functions instead.
2346 ** Renamed function: scm_internal_with_fluids becomes
2349 scm_internal_with_fluids is available as a deprecated function.
2351 ** New function: scm_c_with_fluid.
2353 Just like scm_c_with_fluids, but takes one fluid and one value instead
2356 ** Deprecated typedefs: long_long, ulong_long.
2358 They are of questionable utility and they pollute the global
2361 ** Deprecated typedef: scm_sizet
2363 It is of questionable utility now that Guile requires ANSI C, and is
2366 ** Deprecated typedefs: scm_port_rw_active, scm_port,
2367 scm_ptob_descriptor, scm_debug_info, scm_debug_frame, scm_fport,
2368 scm_option, scm_rstate, scm_rng, scm_array, scm_array_dim.
2370 Made more compliant with the naming policy by adding a _t at the end.
2372 ** Deprecated functions: scm_mkbig, scm_big2num, scm_adjbig,
2373 scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl
2375 With the exception of the mysterious scm_2ulong2big, they are still
2376 available under new names (scm_i_mkbig etc). These functions are not
2377 intended to be used in user code. You should avoid dealing with
2378 bignums directly, and should deal with numbers in general (which can
2381 ** Change in behavior: scm_num2long, scm_num2ulong
2383 The scm_num2[u]long functions don't any longer accept an inexact
2384 argument. This change in behavior is motivated by concordance with
2385 R5RS: It is more common that a primitive doesn't want to accept an
2386 inexact for an exact.
2388 ** New functions: scm_short2num, scm_ushort2num, scm_int2num,
2389 scm_uint2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
2390 scm_num2ushort, scm_num2int, scm_num2uint, scm_num2ptrdiff,
2393 These are conversion functions between the various ANSI C integral
2394 types and Scheme numbers. NOTE: The scm_num2xxx functions don't
2395 accept an inexact argument.
2397 ** New functions: scm_float2num, scm_double2num,
2398 scm_num2float, scm_num2double.
2400 These are conversion functions between the two ANSI C float types and
2403 ** New number validation macros:
2404 SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,INT,UINT}[_DEF]
2408 ** New functions: scm_gc_protect_object, scm_gc_unprotect_object
2410 These are just nicer-named old scm_protect_object and
2411 scm_unprotect_object.
2413 ** Deprecated functions: scm_protect_object, scm_unprotect_object
2415 ** New functions: scm_gc_[un]register_root, scm_gc_[un]register_roots
2417 These functions can be used to register pointers to locations that
2420 ** Deprecated function: scm_create_hook.
2422 Its sins are: misleading name, non-modularity and lack of general
2426 Changes since Guile 1.3.4:
2428 * Changes to the distribution
2430 ** Trees from nightly snapshots and CVS now require you to run autogen.sh.
2432 We've changed the way we handle generated files in the Guile source
2433 repository. As a result, the procedure for building trees obtained
2434 from the nightly FTP snapshots or via CVS has changed:
2435 - You must have appropriate versions of autoconf, automake, and
2436 libtool installed on your system. See README for info on how to
2437 obtain these programs.
2438 - Before configuring the tree, you must first run the script
2439 `autogen.sh' at the top of the source tree.
2441 The Guile repository used to contain not only source files, written by
2442 humans, but also some generated files, like configure scripts and
2443 Makefile.in files. Even though the contents of these files could be
2444 derived mechanically from other files present, we thought it would
2445 make the tree easier to build if we checked them into CVS.
2447 However, this approach means that minor differences between
2448 developer's installed tools and habits affected the whole team.
2449 So we have removed the generated files from the repository, and
2450 added the autogen.sh script, which will reconstruct them
2454 ** configure now has experimental options to remove support for certain
2457 --disable-arrays omit array and uniform array support
2458 --disable-posix omit posix interfaces
2459 --disable-networking omit networking interfaces
2460 --disable-regex omit regular expression interfaces
2462 These are likely to become separate modules some day.
2464 ** New configure option --enable-debug-freelist
2466 This enables a debugging version of SCM_NEWCELL(), and also registers
2467 an extra primitive, the setter `gc-set-debug-check-freelist!'.
2469 Configure with the --enable-debug-freelist option to enable
2470 the gc-set-debug-check-freelist! primitive, and then use:
2472 (gc-set-debug-check-freelist! #t) # turn on checking of the freelist
2473 (gc-set-debug-check-freelist! #f) # turn off checking
2475 Checking of the freelist forces a traversal of the freelist and
2476 a garbage collection before each allocation of a cell. This can
2477 slow down the interpreter dramatically, so the setter should be used to
2478 turn on this extra processing only when necessary.
2480 ** New configure option --enable-debug-malloc
2482 Include code for debugging of calls to scm_must_malloc/realloc/free.
2486 1. objects freed by scm_must_free has been mallocated by scm_must_malloc
2487 2. objects reallocated by scm_must_realloc has been allocated by
2489 3. reallocated objects are reallocated with the same what string
2491 But, most importantly, it records the number of allocated objects of
2492 each kind. This is useful when searching for memory leaks.
2494 A Guile compiled with this option provides the primitive
2495 `malloc-stats' which returns an alist with pairs of kind and the
2496 number of objects of that kind.
2498 ** All includes are now referenced relative to the root directory
2500 Since some users have had problems with mixups between Guile and
2501 system headers, we have decided to always refer to Guile headers via
2502 their parent directories. This essentially creates a "private name
2503 space" for Guile headers. This means that the compiler only is given
2504 -I options for the root build and root source directory.
2506 ** Header files kw.h and genio.h have been removed.
2508 ** The module (ice-9 getopt-gnu-style) has been removed.
2510 ** New module (ice-9 documentation)
2512 Implements the interface to documentation strings associated with
2515 ** New module (ice-9 time)
2517 Provides a macro `time', which displays execution time of a given form.
2519 ** New module (ice-9 history)
2521 Loading this module enables value history in the repl.
2523 * Changes to the stand-alone interpreter
2525 ** New command line option --debug
2527 Start Guile with debugging evaluator and backtraces enabled.
2529 This is useful when debugging your .guile init file or scripts.
2531 ** New help facility
2533 Usage: (help NAME) gives documentation about objects named NAME (a symbol)
2534 (help REGEXP) ditto for objects with names matching REGEXP (a string)
2535 (help 'NAME) gives documentation for NAME, even if it is not an object
2536 (help ,EXPR) gives documentation for object returned by EXPR
2537 (help (my module)) gives module commentary for `(my module)'
2538 (help) gives this text
2540 `help' searches among bindings exported from loaded modules, while
2541 `apropos' searches among bindings visible from the "current" module.
2543 Examples: (help help)
2545 (help "output-string")
2547 ** `help' and `apropos' now prints full module names
2549 ** Dynamic linking now uses libltdl from the libtool package.
2551 The old system dependent code for doing dynamic linking has been
2552 replaced with calls to the libltdl functions which do all the hairy
2555 The major improvement is that you can now directly pass libtool
2556 library names like "libfoo.la" to `dynamic-link' and `dynamic-link'
2557 will be able to do the best shared library job you can get, via
2560 The way dynamic libraries are found has changed and is not really
2561 portable across platforms, probably. It is therefore recommended to
2562 use absolute filenames when possible.
2564 If you pass a filename without an extension to `dynamic-link', it will
2565 try a few appropriate ones. Thus, the most platform ignorant way is
2566 to specify a name like "libfoo", without any directories and
2569 ** Guile COOP threads are now compatible with LinuxThreads
2571 Previously, COOP threading wasn't possible in applications linked with
2572 Linux POSIX threads due to their use of the stack pointer to find the
2573 thread context. This has now been fixed with a workaround which uses
2574 the pthreads to allocate the stack.
2576 ** New primitives: `pkgdata-dir', `site-dir', `library-dir'
2578 ** Positions of erring expression in scripts
2580 With version 1.3.4, the location of the erring expression in Guile
2581 scipts is no longer automatically reported. (This should have been
2582 documented before the 1.3.4 release.)
2584 You can get this information by enabling recording of positions of
2585 source expressions and running the debugging evaluator. Put this at
2586 the top of your script (or in your "site" file):
2588 (read-enable 'positions)
2589 (debug-enable 'debug)
2591 ** Backtraces in scripts
2593 It is now possible to get backtraces in scripts.
2597 (debug-enable 'debug 'backtrace)
2599 at the top of the script.
2601 (The first options enables the debugging evaluator.
2602 The second enables backtraces.)
2604 ** Part of module system symbol lookup now implemented in C
2606 The eval closure of most modules is now implemented in C. Since this
2607 was one of the bottlenecks for loading speed, Guile now loads code
2608 substantially faster than before.
2610 ** Attempting to get the value of an unbound variable now produces
2611 an exception with a key of 'unbound-variable instead of 'misc-error.
2613 ** The initial default output port is now unbuffered if it's using a
2614 tty device. Previously in this situation it was line-buffered.
2616 ** New hook: after-gc-hook
2618 after-gc-hook takes over the role of gc-thunk. This hook is run at
2619 the first SCM_TICK after a GC. (Thus, the code is run at the same
2620 point during evaluation as signal handlers.)
2622 Note that this hook should be used only for diagnostic and debugging
2623 purposes. It is not certain that it will continue to be well-defined
2624 when this hook is run in the future.
2626 C programmers: Note the new C level hooks scm_before_gc_c_hook,
2627 scm_before_sweep_c_hook, scm_after_gc_c_hook.
2629 ** Improvements to garbage collector
2631 Guile 1.4 has a new policy for triggering heap allocation and
2632 determining the sizes of heap segments. It fixes a number of problems
2635 1. The new policy can handle two separate pools of cells
2636 (2-word/4-word) better. (The old policy would run wild, allocating
2637 more and more memory for certain programs.)
2639 2. The old code would sometimes allocate far too much heap so that the
2640 Guile process became gigantic. The new code avoids this.
2642 3. The old code would sometimes allocate too little so that few cells
2643 were freed at GC so that, in turn, too much time was spent in GC.
2645 4. The old code would often trigger heap allocation several times in a
2646 row. (The new scheme predicts how large the segments needs to be
2647 in order not to need further allocation.)
2649 All in all, the new GC policy will make larger applications more
2652 The new GC scheme also is prepared for POSIX threading. Threads can
2653 allocate private pools of cells ("clusters") with just a single
2654 function call. Allocation of single cells from such a cluster can
2655 then proceed without any need of inter-thread synchronization.
2657 ** New environment variables controlling GC parameters
2659 GUILE_MAX_SEGMENT_SIZE Maximal segment size
2662 Allocation of 2-word cell heaps:
2664 GUILE_INIT_SEGMENT_SIZE_1 Size of initial heap segment in bytes
2667 GUILE_MIN_YIELD_1 Minimum number of freed cells at each
2668 GC in percent of total heap size
2671 Allocation of 4-word cell heaps
2672 (used for real numbers and misc other objects):
2674 GUILE_INIT_SEGMENT_SIZE_2, GUILE_MIN_YIELD_2
2676 (See entry "Way for application to customize GC parameters" under
2677 section "Changes to the scm_ interface" below.)
2679 ** Guile now implements reals using 4-word cells
2681 This speeds up computation with reals. (They were earlier allocated
2682 with `malloc'.) There is still some room for optimizations, however.
2684 ** Some further steps toward POSIX thread support have been taken
2686 *** Guile's critical sections (SCM_DEFER/ALLOW_INTS)
2687 don't have much effect any longer, and many of them will be removed in
2691 are only handled at the top of the evaluator loop, immediately after
2692 I/O, and in scm_equalp.
2694 *** The GC can allocate thread private pools of pairs.
2696 * Changes to Scheme functions and syntax
2698 ** close-input-port and close-output-port are now R5RS
2700 These procedures have been turned into primitives and have R5RS behaviour.
2702 ** New procedure: simple-format PORT MESSAGE ARG1 ...
2704 (ice-9 boot) makes `format' an alias for `simple-format' until possibly
2705 extended by the more sophisticated version in (ice-9 format)
2707 (simple-format port message . args)
2708 Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
2709 MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
2710 the escapes are replaced with corresponding members of ARGS:
2711 ~A formats using `display' and ~S formats using `write'.
2712 If DESTINATION is #t, then use the `current-output-port',
2713 if DESTINATION is #f, then return a string containing the formatted text.
2714 Does not add a trailing newline."
2716 ** string-ref: the second argument is no longer optional.
2718 ** string, list->string: no longer accept strings in their arguments,
2719 only characters, for compatibility with R5RS.
2721 ** New procedure: port-closed? PORT
2722 Returns #t if PORT is closed or #f if it is open.
2724 ** Deprecated: list*
2726 The list* functionality is now provided by cons* (SRFI-1 compliant)
2728 ** New procedure: cons* ARG1 ARG2 ... ARGn
2730 Like `list', but the last arg provides the tail of the constructed list,
2731 returning (cons ARG1 (cons ARG2 (cons ... ARGn))).
2733 Requires at least one argument. If given one argument, that argument
2734 is returned as result.
2736 This function is called `list*' in some other Schemes and in Common LISP.
2738 ** Removed deprecated: serial-map, serial-array-copy!, serial-array-map!
2740 ** New procedure: object-documentation OBJECT
2742 Returns the documentation string associated with OBJECT. The
2743 procedure uses a caching mechanism so that subsequent lookups are
2746 Exported by (ice-9 documentation).
2748 ** module-name now returns full names of modules
2750 Previously, only the last part of the name was returned (`session' for
2751 `(ice-9 session)'). Ex: `(ice-9 session)'.
2753 * Changes to the gh_ interface
2755 ** Deprecated: gh_int2scmb
2757 Use gh_bool2scm instead.
2759 * Changes to the scm_ interface
2761 ** Guile primitives now carry docstrings!
2763 Thanks to Greg Badros!
2765 ** Guile primitives are defined in a new way: SCM_DEFINE/SCM_DEFINE1/SCM_PROC
2767 Now Guile primitives are defined using the SCM_DEFINE/SCM_DEFINE1/SCM_PROC
2768 macros and must contain a docstring that is extracted into foo.doc using a new
2769 guile-doc-snarf script (that uses guile-doc-snarf.awk).
2771 However, a major overhaul of these macros is scheduled for the next release of
2774 ** Guile primitives use a new technique for validation of arguments
2776 SCM_VALIDATE_* macros are defined to ease the redundancy and improve
2777 the readability of argument checking.
2779 ** All (nearly?) K&R prototypes for functions replaced with ANSI C equivalents.
2781 ** New macros: SCM_PACK, SCM_UNPACK
2783 Compose/decompose an SCM value.
2785 The SCM type is now treated as an abstract data type and may be defined as a
2786 long, a void* or as a struct, depending on the architecture and compile time
2787 options. This makes it easier to find several types of bugs, for example when
2788 SCM values are treated as integers without conversion. Values of the SCM type
2789 should be treated as "atomic" values. These macros are used when
2790 composing/decomposing an SCM value, either because you want to access
2791 individual bits, or because you want to treat it as an integer value.
2793 E.g., in order to set bit 7 in an SCM value x, use the expression
2795 SCM_PACK (SCM_UNPACK (x) | 0x80)
2797 ** The name property of hooks is deprecated.
2798 Thus, the use of SCM_HOOK_NAME and scm_make_hook_with_name is deprecated.
2800 You can emulate this feature by using object properties.
2802 ** Deprecated macros: SCM_INPORTP, SCM_OUTPORTP, SCM_CRDY, SCM_ICHRP,
2803 SCM_ICHR, SCM_MAKICHR, SCM_SETJMPBUF, SCM_NSTRINGP, SCM_NRWSTRINGP,
2806 These macros will be removed in a future release of Guile.
2808 ** The following types, functions and macros from numbers.h are deprecated:
2809 scm_dblproc, SCM_UNEGFIXABLE, SCM_FLOBUFLEN, SCM_INEXP, SCM_CPLXP, SCM_REAL,
2810 SCM_IMAG, SCM_REALPART, scm_makdbl, SCM_SINGP, SCM_NUM2DBL, SCM_NO_BIGDIG
2812 ** Port internals: the rw_random variable in the scm_port structure
2813 must be set to non-zero in any random access port. In recent Guile
2814 releases it was only set for bidirectional random-access ports.
2816 ** Port internals: the seek ptob procedure is now responsible for
2817 resetting the buffers if required. The change was made so that in the
2818 special case of reading the current position (i.e., seek p 0 SEEK_CUR)
2819 the fport and strport ptobs can avoid resetting the buffers,
2820 in particular to avoid discarding unread chars. An existing port
2821 type can be fixed by adding something like the following to the
2822 beginning of the ptob seek procedure:
2824 if (pt->rw_active == SCM_PORT_READ)
2825 scm_end_input (object);
2826 else if (pt->rw_active == SCM_PORT_WRITE)
2827 ptob->flush (object);
2829 although to actually avoid resetting the buffers and discard unread
2830 chars requires further hacking that depends on the characteristics
2833 ** Deprecated functions: scm_fseek, scm_tag
2835 These functions are no longer used and will be removed in a future version.
2837 ** The scm_sysmissing procedure is no longer used in libguile.
2838 Unless it turns out to be unexpectedly useful to somebody, it will be
2839 removed in a future version.
2841 ** The format of error message strings has changed
2843 The two C procedures: scm_display_error and scm_error, as well as the
2844 primitive `scm-error', now use scm_simple_format to do their work.
2845 This means that the message strings of all code must be updated to use
2846 ~A where %s was used before, and ~S where %S was used before.
2848 During the period when there still are a lot of old Guiles out there,
2849 you might want to support both old and new versions of Guile.
2851 There are basically two methods to achieve this. Both methods use
2854 AC_CHECK_FUNCS(scm_simple_format)
2856 in your configure.in.
2858 Method 1: Use the string concatenation features of ANSI C's
2863 #ifdef HAVE_SCM_SIMPLE_FORMAT
2869 Then represent each of your error messages using a preprocessor macro:
2871 #define E_SPIDER_ERROR "There's a spider in your " ## FMT_S ## "!!!"
2875 (define fmt-s (if (defined? 'simple-format) "~S" "%S"))
2876 (define make-message string-append)
2878 (define e-spider-error (make-message "There's a spider in your " fmt-s "!!!"))
2880 Method 2: Use the oldfmt function found in doc/oldfmt.c.
2884 scm_misc_error ("picnic", scm_c_oldfmt0 ("There's a spider in your ~S!!!"),
2889 (scm-error 'misc-error "picnic" (oldfmt "There's a spider in your ~S!!!")
2893 ** Deprecated: coop_mutex_init, coop_condition_variable_init
2895 Don't use the functions coop_mutex_init and
2896 coop_condition_variable_init. They will change.
2898 Use scm_mutex_init and scm_cond_init instead.
2900 ** New function: int scm_cond_timedwait (scm_cond_t *COND, scm_mutex_t *MUTEX, const struct timespec *ABSTIME)
2901 `scm_cond_timedwait' atomically unlocks MUTEX and waits on
2902 COND, as `scm_cond_wait' does, but it also bounds the duration
2903 of the wait. If COND has not been signaled before time ABSTIME,
2904 the mutex MUTEX is re-acquired and `scm_cond_timedwait'
2905 returns the error code `ETIMEDOUT'.
2907 The ABSTIME parameter specifies an absolute time, with the same
2908 origin as `time' and `gettimeofday': an ABSTIME of 0 corresponds
2909 to 00:00:00 GMT, January 1, 1970.
2911 ** New function: scm_cond_broadcast (scm_cond_t *COND)
2912 `scm_cond_broadcast' restarts all the threads that are waiting
2913 on the condition variable COND. Nothing happens if no threads are
2916 ** New function: scm_key_create (scm_key_t *KEY, void (*destr_function) (void *))
2917 `scm_key_create' allocates a new TSD key. The key is stored in
2918 the location pointed to by KEY. There is no limit on the number
2919 of keys allocated at a given time. The value initially associated
2920 with the returned key is `NULL' in all currently executing threads.
2922 The DESTR_FUNCTION argument, if not `NULL', specifies a destructor
2923 function associated with the key. When a thread terminates,
2924 DESTR_FUNCTION is called on the value associated with the key in
2925 that thread. The DESTR_FUNCTION is not called if a key is deleted
2926 with `scm_key_delete' or a value is changed with
2927 `scm_setspecific'. The order in which destructor functions are
2928 called at thread termination time is unspecified.
2930 Destructors are not yet implemented.
2932 ** New function: scm_setspecific (scm_key_t KEY, const void *POINTER)
2933 `scm_setspecific' changes the value associated with KEY in the
2934 calling thread, storing the given POINTER instead.
2936 ** New function: scm_getspecific (scm_key_t KEY)
2937 `scm_getspecific' returns the value currently associated with
2938 KEY in the calling thread.
2940 ** New function: scm_key_delete (scm_key_t KEY)
2941 `scm_key_delete' deallocates a TSD key. It does not check
2942 whether non-`NULL' values are associated with that key in the
2943 currently executing threads, nor call the destructor function
2944 associated with the key.
2946 ** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE)
2948 Initialize a C level hook HOOK with associated HOOK_DATA and type
2949 TYPE. (See scm_c_hook_run ().)
2951 ** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP)
2953 Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP
2954 is true, add it last, otherwise first. The same FUNC can be added
2955 multiple times if FUNC_DATA differ and vice versa.
2957 ** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA)
2959 Remove hook function FUNC with associated FUNC_DATA from HOOK. A
2960 function is only removed if both FUNC and FUNC_DATA matches.
2962 ** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA)
2964 Run hook HOOK passing DATA to the hook functions.
2966 If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value
2967 returned is undefined.
2969 If TYPE is SCM_C_HOOK_OR, hook functions are run until a function
2970 returns a non-NULL value. This value is returned as the result of
2971 scm_c_hook_run. If all functions return NULL, NULL is returned.
2973 If TYPE is SCM_C_HOOK_AND, hook functions are run until a function
2974 returns a NULL value, and NULL is returned. If all functions returns
2975 a non-NULL value, the last value is returned.
2977 ** New C level GC hooks
2979 Five new C level hooks has been added to the garbage collector.
2981 scm_before_gc_c_hook
2984 are run before locking and after unlocking the heap. The system is
2985 thus in a mode where evaluation can take place. (Except that
2986 scm_before_gc_c_hook must not allocate new cells.)
2988 scm_before_mark_c_hook
2989 scm_before_sweep_c_hook
2990 scm_after_sweep_c_hook
2992 are run when the heap is locked. These are intended for extension of
2993 the GC in a modular fashion. Examples are the weaks and guardians
2996 ** Way for application to customize GC parameters
2998 The application can set up other default values for the GC heap
2999 allocation parameters
3001 GUILE_INIT_HEAP_SIZE_1, GUILE_MIN_YIELD_1,
3002 GUILE_INIT_HEAP_SIZE_2, GUILE_MIN_YIELD_2,
3003 GUILE_MAX_SEGMENT_SIZE,
3007 scm_default_init_heap_size_1, scm_default_min_yield_1,
3008 scm_default_init_heap_size_2, scm_default_min_yield_2,
3009 scm_default_max_segment_size
3011 respectively before callong scm_boot_guile.
3013 (See entry "New environment variables ..." in section
3014 "Changes to the stand-alone interpreter" above.)
3016 ** scm_protect_object/scm_unprotect_object now nest
3018 This means that you can call scm_protect_object multiple times on an
3019 object and count on the object being protected until
3020 scm_unprotect_object has been call the same number of times.
3022 The functions also have better time complexity.
3024 Still, it is usually possible to structure the application in a way
3025 that you don't need to use these functions. For example, if you use a
3026 protected standard Guile list to keep track of live objects rather
3027 than some custom data type, objects will die a natural death when they
3028 are no longer needed.
3030 ** Deprecated type tags: scm_tc16_flo, scm_tc_flo, scm_tc_dblr, scm_tc_dblc
3032 Guile does not provide the float representation for inexact real numbers any
3033 more. Now, only doubles are used to represent inexact real numbers. Further,
3034 the tag names scm_tc_dblr and scm_tc_dblc have been changed to scm_tc16_real
3035 and scm_tc16_complex, respectively.
3037 ** Removed deprecated type scm_smobfuns
3039 ** Removed deprecated function scm_newsmob
3041 ** Warning: scm_make_smob_type_mfpe might become deprecated in a future release
3043 There is an ongoing discussion among the developers whether to
3044 deprecate `scm_make_smob_type_mfpe' or not. Please use the current
3045 standard interface (scm_make_smob_type, scm_set_smob_XXX) in new code
3046 until this issue has been settled.
3048 ** Removed deprecated type tag scm_tc16_kw
3050 ** Added type tag scm_tc16_keyword
3052 (This was introduced already in release 1.3.4 but was not documented
3055 ** gdb_print now prints "*** Guile not initialized ***" until Guile initialized
3057 * Changes to system call interfaces:
3059 ** The "select" procedure now tests port buffers for the ability to
3060 provide input or accept output. Previously only the underlying file
3061 descriptors were checked.
3063 ** New variable PIPE_BUF: the maximum number of bytes that can be
3064 atomically written to a pipe.
3066 ** If a facility is not available on the system when Guile is
3067 compiled, the corresponding primitive procedure will not be defined.
3068 Previously it would have been defined but would throw a system-error
3069 exception if called. Exception handlers which catch this case may
3070 need minor modification: an error will be thrown with key
3071 'unbound-variable instead of 'system-error. Alternatively it's
3072 now possible to use `defined?' to check whether the facility is
3075 ** Procedures which depend on the timezone should now give the correct
3076 result on systems which cache the TZ environment variable, even if TZ
3077 is changed without calling tzset.
3079 * Changes to the networking interfaces:
3081 ** New functions: htons, ntohs, htonl, ntohl: for converting short and
3082 long integers between network and host format. For now, it's not
3083 particularly convenient to do this kind of thing, but consider:
3085 (define write-network-long
3086 (lambda (value port)
3087 (let ((v (make-uniform-vector 1 1 0)))
3088 (uniform-vector-set! v 0 (htonl value))
3089 (uniform-vector-write v port))))
3091 (define read-network-long
3093 (let ((v (make-uniform-vector 1 1 0)))
3094 (uniform-vector-read! v port)
3095 (ntohl (uniform-vector-ref v 0)))))
3097 ** If inet-aton fails, it now throws an error with key 'misc-error
3098 instead of 'system-error, since errno is not relevant.
3100 ** Certain gethostbyname/gethostbyaddr failures now throw errors with
3101 specific keys instead of 'system-error. The latter is inappropriate
3102 since errno will not have been set. The keys are:
3103 'host-not-found, 'try-again, 'no-recovery and 'no-data.
3105 ** sethostent, setnetent, setprotoent, setservent: now take an
3106 optional argument STAYOPEN, which specifies whether the database
3107 remains open after a database entry is accessed randomly (e.g., using
3108 gethostbyname for the hosts database.) The default is #f. Previously
3112 Changes since Guile 1.3.2:
3114 * Changes to the stand-alone interpreter
3118 An initial version of the Guile debugger written by Chris Hanson has
3119 been added. The debugger is still under development but is included
3120 in the distribution anyway since it is already quite useful.
3126 after an error to enter the debugger. Type `help' inside the debugger
3127 for a description of available commands.
3129 If you prefer to have stack frames numbered and printed in
3130 anti-chronological order and prefer up in the stack to be down on the
3131 screen as is the case in gdb, you can put
3133 (debug-enable 'backwards)
3135 in your .guile startup file. (However, this means that Guile can't
3136 use indentation to indicate stack level.)
3138 The debugger is autoloaded into Guile at the first use.
3140 ** Further enhancements to backtraces
3142 There is a new debug option `width' which controls the maximum width
3143 on the screen of printed stack frames. Fancy printing parameters
3144 ("level" and "length" as in Common LISP) are adaptively adjusted for
3145 each stack frame to give maximum information while still fitting
3146 within the bounds. If the stack frame can't be made to fit by
3147 adjusting parameters, it is simply cut off at the end. This is marked
3150 ** Some modules are now only loaded when the repl is started
3152 The modules (ice-9 debug), (ice-9 session), (ice-9 threads) and (ice-9
3153 regex) are now loaded into (guile-user) only if the repl has been
3154 started. The effect is that the startup time for scripts has been
3155 reduced to 30% of what it was previously.
3157 Correctly written scripts load the modules they require at the top of
3158 the file and should not be affected by this change.
3160 ** Hooks are now represented as smobs
3162 * Changes to Scheme functions and syntax
3164 ** Readline support has changed again.
3166 The old (readline-activator) module is gone. Use (ice-9 readline)
3167 instead, which now contains all readline functionality. So the code
3168 to activate readline is now
3170 (use-modules (ice-9 readline))
3173 This should work at any time, including from the guile prompt.
3175 To avoid confusion about the terms of Guile's license, please only
3176 enable readline for your personal use; please don't make it the
3177 default for others. Here is why we make this rather odd-sounding
3180 Guile is normally licensed under a weakened form of the GNU General
3181 Public License, which allows you to link code with Guile without
3182 placing that code under the GPL. This exception is important to some
3185 However, since readline is distributed under the GNU General Public
3186 License, when you link Guile with readline, either statically or
3187 dynamically, you effectively change Guile's license to the strict GPL.
3188 Whenever you link any strictly GPL'd code into Guile, uses of Guile
3189 which are normally permitted become forbidden. This is a rather
3190 non-obvious consequence of the licensing terms.
3192 So, to make sure things remain clear, please let people choose for
3193 themselves whether to link GPL'd libraries like readline with Guile.
3195 ** regexp-substitute/global has changed slightly, but incompatibly.
3197 If you include a function in the item list, the string of the match
3198 object it receives is the same string passed to
3199 regexp-substitute/global, not some suffix of that string.
3200 Correspondingly, the match's positions are relative to the entire
3201 string, not the suffix.
3203 If the regexp can match the empty string, the way matches are chosen
3204 from the string has changed. regexp-substitute/global recognizes the
3205 same set of matches that list-matches does; see below.
3207 ** New function: list-matches REGEXP STRING [FLAGS]
3209 Return a list of match objects, one for every non-overlapping, maximal
3210 match of REGEXP in STRING. The matches appear in left-to-right order.
3211 list-matches only reports matches of the empty string if there are no
3212 other matches which begin on, end at, or include the empty match's
3215 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
3217 ** New function: fold-matches REGEXP STRING INIT PROC [FLAGS]
3219 For each match of REGEXP in STRING, apply PROC to the match object,
3220 and the last value PROC returned, or INIT for the first call. Return
3221 the last value returned by PROC. We apply PROC to the matches as they
3222 appear from left to right.
3224 This function recognizes matches according to the same criteria as
3227 Thus, you could define list-matches like this:
3229 (define (list-matches regexp string . flags)
3230 (reverse! (apply fold-matches regexp string '() cons flags)))
3232 If present, FLAGS is passed as the FLAGS argument to regexp-exec.
3236 *** New function: hook? OBJ
3238 Return #t if OBJ is a hook, otherwise #f.
3240 *** New function: make-hook-with-name NAME [ARITY]
3242 Return a hook with name NAME and arity ARITY. The default value for
3243 ARITY is 0. The only effect of NAME is that it will appear when the
3244 hook object is printed to ease debugging.
3246 *** New function: hook-empty? HOOK
3248 Return #t if HOOK doesn't contain any procedures, otherwise #f.
3250 *** New function: hook->list HOOK
3252 Return a list of the procedures that are called when run-hook is
3255 ** `map' signals an error if its argument lists are not all the same length.
3257 This is the behavior required by R5RS, so this change is really a bug
3258 fix. But it seems to affect a lot of people's code, so we're
3259 mentioning it here anyway.
3261 ** Print-state handling has been made more transparent
3263 Under certain circumstances, ports are represented as a port with an
3264 associated print state. Earlier, this pair was represented as a pair
3265 (see "Some magic has been added to the printer" below). It is now
3266 indistinguishable (almost; see `get-print-state') from a port on the
3269 *** New function: port-with-print-state OUTPUT-PORT PRINT-STATE
3271 Return a new port with the associated print state PRINT-STATE.
3273 *** New function: get-print-state OUTPUT-PORT
3275 Return the print state associated with this port if it exists,
3276 otherwise return #f.
3278 *** New function: directory-stream? OBJECT
3280 Returns true iff OBJECT is a directory stream --- the sort of object
3281 returned by `opendir'.
3283 ** New function: using-readline?
3285 Return #t if readline is in use in the current repl.
3287 ** structs will be removed in 1.4
3289 Structs will be replaced in Guile 1.4. We will merge GOOPS into Guile
3290 and use GOOPS objects as the fundamental record type.
3292 * Changes to the scm_ interface
3294 ** structs will be removed in 1.4
3296 The entire current struct interface (struct.c, struct.h) will be
3297 replaced in Guile 1.4. We will merge GOOPS into libguile and use
3298 GOOPS objects as the fundamental record type.
3300 ** The internal representation of subr's has changed
3302 Instead of giving a hint to the subr name, the CAR field of the subr
3303 now contains an index to a subr entry in scm_subr_table.
3305 *** New variable: scm_subr_table
3307 An array of subr entries. A subr entry contains the name, properties
3308 and documentation associated with the subr. The properties and
3309 documentation slots are not yet used.
3311 ** A new scheme for "forwarding" calls to a builtin to a generic function
3313 It is now possible to extend the functionality of some Guile
3314 primitives by letting them defer a call to a GOOPS generic function on
3315 argument mismatch. This means that there is no loss of efficiency in
3320 (use-modules (oop goops)) ; Must be GOOPS version 0.2.
3321 (define-method + ((x <string>) (y <string>))
3322 (string-append x y))
3324 + will still be as efficient as usual in numerical calculations, but
3325 can also be used for concatenating strings.
3327 Who will be the first one to extend Guile's numerical tower to
3328 rationals? :) [OK, there a few other things to fix before this can
3329 be made in a clean way.]
3331 *** New snarf macros for defining primitives: SCM_GPROC, SCM_GPROC1
3333 New macro: SCM_GPROC (CNAME, SNAME, REQ, OPT, VAR, CFUNC, GENERIC)
3335 New macro: SCM_GPROC1 (CNAME, SNAME, TYPE, CFUNC, GENERIC)
3337 These do the same job as SCM_PROC and SCM_PROC1, but they also define
3338 a variable GENERIC which can be used by the dispatch macros below.
3340 [This is experimental code which may change soon.]
3342 *** New macros for forwarding control to a generic on arg type error
3344 New macro: SCM_WTA_DISPATCH_1 (GENERIC, ARG1, POS, SUBR)
3346 New macro: SCM_WTA_DISPATCH_2 (GENERIC, ARG1, ARG2, POS, SUBR)
3348 These correspond to the scm_wta function call, and have the same
3349 behaviour until the user has called the GOOPS primitive
3350 `enable-primitive-generic!'. After that, these macros will apply the
3351 generic function GENERIC to the argument(s) instead of calling
3354 [This is experimental code which may change soon.]
3356 *** New macros for argument testing with generic dispatch
3358 New macro: SCM_GASSERT1 (COND, GENERIC, ARG1, POS, SUBR)
3360 New macro: SCM_GASSERT2 (COND, GENERIC, ARG1, ARG2, POS, SUBR)
3362 These correspond to the SCM_ASSERT macro, but will defer control to
3363 GENERIC on error after `enable-primitive-generic!' has been called.
3365 [This is experimental code which may change soon.]
3367 ** New function: SCM scm_eval_body (SCM body, SCM env)
3369 Evaluates the body of a special form.
3371 ** The internal representation of struct's has changed
3373 Previously, four slots were allocated for the procedure(s) of entities
3374 and operators. The motivation for this representation had to do with
3375 the structure of the evaluator, the wish to support tail-recursive
3376 generic functions, and efficiency. Since the generic function
3377 dispatch mechanism has changed, there is no longer a need for such an
3378 expensive representation, and the representation has been simplified.
3380 This should not make any difference for most users.
3382 ** GOOPS support has been cleaned up.
3384 Some code has been moved from eval.c to objects.c and code in both of
3385 these compilation units has been cleaned up and better structured.
3387 *** New functions for applying generic functions
3389 New function: SCM scm_apply_generic (GENERIC, ARGS)
3390 New function: SCM scm_call_generic_0 (GENERIC)
3391 New function: SCM scm_call_generic_1 (GENERIC, ARG1)
3392 New function: SCM scm_call_generic_2 (GENERIC, ARG1, ARG2)
3393 New function: SCM scm_call_generic_3 (GENERIC, ARG1, ARG2, ARG3)
3395 ** Deprecated function: scm_make_named_hook
3397 It is now replaced by:
3399 ** New function: SCM scm_create_hook (const char *name, int arity)
3401 Creates a hook in the same way as make-hook above but also
3402 binds a variable named NAME to it.
3404 This is the typical way of creating a hook from C code.
3406 Currently, the variable is created in the "current" module.
3407 This might change when we get the new module system.
3409 [The behaviour is identical to scm_make_named_hook.]
3413 Changes since Guile 1.3:
3415 * Changes to mailing lists
3417 ** Some of the Guile mailing lists have moved to sourceware.cygnus.com.
3419 See the README file to find current addresses for all the Guile
3422 * Changes to the distribution
3424 ** Readline support is no longer included with Guile by default.
3426 Based on the different license terms of Guile and Readline, we
3427 concluded that Guile should not *by default* cause the linking of
3428 Readline into an application program. Readline support is now offered
3429 as a separate module, which is linked into an application only when
3430 you explicitly specify it.
3432 Although Guile is GNU software, its distribution terms add a special
3433 exception to the usual GNU General Public License (GPL). Guile's
3434 license includes a clause that allows you to link Guile with non-free
3435 programs. We add this exception so as not to put Guile at a
3436 disadvantage vis-a-vis other extensibility packages that support other
3439 In contrast, the GNU Readline library is distributed under the GNU
3440 General Public License pure and simple. This means that you may not
3441 link Readline, even dynamically, into an application unless it is
3442 distributed under a free software license that is compatible the GPL.
3444 Because of this difference in distribution terms, an application that
3445 can use Guile may not be able to use Readline. Now users will be
3446 explicitly offered two independent decisions about the use of these
3449 You can activate the readline support by issuing
3451 (use-modules (readline-activator))
3454 from your ".guile" file, for example.
3456 * Changes to the stand-alone interpreter
3458 ** All builtins now print as primitives.
3459 Previously builtin procedures not belonging to the fundamental subr
3460 types printed as #<compiled closure #<primitive-procedure gsubr-apply>>.
3461 Now, they print as #<primitive-procedure NAME>.
3463 ** Backtraces slightly more intelligible.
3464 gsubr-apply and macro transformer application frames no longer appear
3467 * Changes to Scheme functions and syntax
3469 ** Guile now correctly handles internal defines by rewriting them into
3470 their equivalent letrec. Previously, internal defines would
3471 incrementally add to the innermost environment, without checking
3472 whether the restrictions specified in RnRS were met. This lead to the
3473 correct behaviour when these restriction actually were met, but didn't
3474 catch all illegal uses. Such an illegal use could lead to crashes of
3475 the Guile interpreter or or other unwanted results. An example of
3476 incorrect internal defines that made Guile behave erratically:
3488 The problem with this example is that the definition of `c' uses the
3489 value of `b' directly. This confuses the meoization machine of Guile
3490 so that the second call of `b' (this time in a larger environment that
3491 also contains bindings for `c' and `d') refers to the binding of `c'
3492 instead of `a'. You could also make Guile crash with a variation on
3497 (define (b flag) (if flag a 1))
3498 (define c (1+ (b flag)))
3506 From now on, Guile will issue an `Unbound variable: b' error message
3511 A hook contains a list of functions which should be called on
3512 particular occasions in an existing program. Hooks are used for
3515 A window manager might have a hook before-window-map-hook. The window
3516 manager uses the function run-hooks to call all functions stored in
3517 before-window-map-hook each time a window is mapped. The user can
3518 store functions in the hook using add-hook!.
3520 In Guile, hooks are first class objects.
3522 *** New function: make-hook [N_ARGS]
3524 Return a hook for hook functions which can take N_ARGS arguments.
3525 The default value for N_ARGS is 0.
3527 (See also scm_make_named_hook below.)
3529 *** New function: add-hook! HOOK PROC [APPEND_P]
3531 Put PROC at the beginning of the list of functions stored in HOOK.
3532 If APPEND_P is supplied, and non-false, put PROC at the end instead.
3534 PROC must be able to take the number of arguments specified when the
3537 If PROC already exists in HOOK, then remove it first.
3539 *** New function: remove-hook! HOOK PROC
3541 Remove PROC from the list of functions in HOOK.
3543 *** New function: reset-hook! HOOK
3545 Clear the list of hook functions stored in HOOK.
3547 *** New function: run-hook HOOK ARG1 ...
3549 Run all hook functions stored in HOOK with arguments ARG1 ... .
3550 The number of arguments supplied must correspond to the number given
3551 when the hook was created.
3553 ** The function `dynamic-link' now takes optional keyword arguments.
3554 The only keyword argument that is currently defined is `:global
3555 BOOL'. With it, you can control whether the shared library will be
3556 linked in global mode or not. In global mode, the symbols from the
3557 linked library can be used to resolve references from other
3558 dynamically linked libraries. In non-global mode, the linked
3559 library is essentially invisible and can only be accessed via
3560 `dynamic-func', etc. The default is now to link in global mode.
3561 Previously, the default has been non-global mode.
3563 The `#:global' keyword is only effective on platforms that support
3564 the dlopen family of functions.
3566 ** New function `provided?'
3568 - Function: provided? FEATURE
3569 Return true iff FEATURE is supported by this installation of
3570 Guile. FEATURE must be a symbol naming a feature; the global
3571 variable `*features*' is a list of available features.
3573 ** Changes to the module (ice-9 expect):
3575 *** The expect-strings macro now matches `$' in a regular expression
3576 only at a line-break or end-of-file by default. Previously it would
3577 match the end of the string accumulated so far. The old behaviour
3578 can be obtained by setting the variable `expect-strings-exec-flags'
3581 *** The expect-strings macro now uses a variable `expect-strings-exec-flags'
3582 for the regexp-exec flags. If `regexp/noteol' is included, then `$'
3583 in a regular expression will still match before a line-break or
3584 end-of-file. The default is `regexp/noteol'.
3586 *** The expect-strings macro now uses a variable
3587 `expect-strings-compile-flags' for the flags to be supplied to
3588 `make-regexp'. The default is `regexp/newline', which was previously
3591 *** The expect macro now supplies two arguments to a match procedure:
3592 the current accumulated string and a flag to indicate whether
3593 end-of-file has been reached. Previously only the string was supplied.
3594 If end-of-file is reached, the match procedure will be called an
3595 additional time with the same accumulated string as the previous call
3596 but with the flag set.
3598 ** New module (ice-9 format), implementing the Common Lisp `format' function.
3600 This code, and the documentation for it that appears here, was
3601 borrowed from SLIB, with minor adaptations for Guile.
3603 - Function: format DESTINATION FORMAT-STRING . ARGUMENTS
3604 An almost complete implementation of Common LISP format description
3605 according to the CL reference book `Common LISP' from Guy L.
3606 Steele, Digital Press. Backward compatible to most of the
3607 available Scheme format implementations.
3609 Returns `#t', `#f' or a string; has side effect of printing
3610 according to FORMAT-STRING. If DESTINATION is `#t', the output is
3611 to the current output port and `#t' is returned. If DESTINATION
3612 is `#f', a formatted string is returned as the result of the call.
3613 NEW: If DESTINATION is a string, DESTINATION is regarded as the
3614 format string; FORMAT-STRING is then the first argument and the
3615 output is returned as a string. If DESTINATION is a number, the
3616 output is to the current error port if available by the
3617 implementation. Otherwise DESTINATION must be an output port and
3620 FORMAT-STRING must be a string. In case of a formatting error
3621 format returns `#f' and prints a message on the current output or
3622 error port. Characters are output as if the string were output by
3623 the `display' function with the exception of those prefixed by a
3624 tilde (~). For a detailed description of the FORMAT-STRING syntax
3625 please consult a Common LISP format reference manual. For a test
3626 suite to verify this format implementation load `formatst.scm'.
3627 Please send bug reports to `lutzeb@cs.tu-berlin.de'.
3629 Note: `format' is not reentrant, i.e. only one `format'-call may
3630 be executed at a time.
3633 *** Format Specification (Format version 3.0)
3635 Please consult a Common LISP format reference manual for a detailed
3636 description of the format string syntax. For a demonstration of the
3637 implemented directives see `formatst.scm'.
3639 This implementation supports directive parameters and modifiers (`:'
3640 and `@' characters). Multiple parameters must be separated by a comma
3641 (`,'). Parameters can be numerical parameters (positive or negative),
3642 character parameters (prefixed by a quote character (`''), variable
3643 parameters (`v'), number of rest arguments parameter (`#'), empty and
3644 default parameters. Directive characters are case independent. The
3645 general form of a directive is:
3647 DIRECTIVE ::= ~{DIRECTIVE-PARAMETER,}[:][@]DIRECTIVE-CHARACTER
3649 DIRECTIVE-PARAMETER ::= [ [-|+]{0-9}+ | 'CHARACTER | v | # ]
3651 *** Implemented CL Format Control Directives
3653 Documentation syntax: Uppercase characters represent the
3654 corresponding control directive characters. Lowercase characters
3655 represent control directive parameter descriptions.
3658 Any (print as `display' does).
3662 `~MINCOL,COLINC,MINPAD,PADCHARA'
3666 S-expression (print as `write' does).
3670 `~MINCOL,COLINC,MINPAD,PADCHARS'
3676 print number sign always.
3679 print comma separated.
3681 `~MINCOL,PADCHAR,COMMACHARD'
3687 print number sign always.
3690 print comma separated.
3692 `~MINCOL,PADCHAR,COMMACHARX'
3698 print number sign always.
3701 print comma separated.
3703 `~MINCOL,PADCHAR,COMMACHARO'
3709 print number sign always.
3712 print comma separated.
3714 `~MINCOL,PADCHAR,COMMACHARB'
3719 `~N,MINCOL,PADCHAR,COMMACHARR'
3723 print a number as a Roman numeral.
3726 print a number as an "old fashioned" Roman numeral.
3729 print a number as an ordinal English number.
3732 print a number as a cardinal English number.
3737 prints `y' and `ies'.
3740 as `~P but jumps 1 argument backward.'
3743 as `~@P but jumps 1 argument backward.'
3748 prints a character as the reader can understand it (i.e. `#\'
3752 prints a character as emacs does (eg. `^C' for ASCII 03).
3755 Fixed-format floating-point (prints a flonum like MMM.NNN).
3756 `~WIDTH,DIGITS,SCALE,OVERFLOWCHAR,PADCHARF'
3758 If the number is positive a plus sign is printed.
3761 Exponential floating-point (prints a flonum like MMM.NNN`E'EE).
3762 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARE'
3764 If the number is positive a plus sign is printed.
3767 General floating-point (prints a flonum either fixed or
3769 `~WIDTH,DIGITS,EXPONENTDIGITS,SCALE,OVERFLOWCHAR,PADCHAR,EXPONENTCHARG'
3771 If the number is positive a plus sign is printed.
3774 Dollars floating-point (prints a flonum in fixed with signs
3776 `~DIGITS,SCALE,WIDTH,PADCHAR$'
3778 If the number is positive a plus sign is printed.
3781 A sign is always printed and appears before the padding.
3784 The sign appears before the padding.
3792 print newline if not at the beginning of the output line.
3794 prints `~&' and then N-1 newlines.
3799 print N page separators.
3809 newline is ignored, white space left.
3812 newline is left, white space ignored.
3817 relative tabulation.
3823 Indirection (expects indirect arguments as a list).
3825 extracts indirect arguments from format arguments.
3828 Case conversion (converts by `string-downcase').
3830 converts by `string-capitalize'.
3833 converts by `string-capitalize-first'.
3836 converts by `string-upcase'.
3839 Argument Jumping (jumps 1 argument forward).
3841 jumps N arguments forward.
3844 jumps 1 argument backward.
3847 jumps N arguments backward.
3850 jumps to the 0th argument.
3853 jumps to the Nth argument (beginning from 0)
3855 `~[STR0~;STR1~;...~;STRN~]'
3856 Conditional Expression (numerical clause conditional).
3858 take argument from N.
3861 true test conditional.
3864 if-else-then conditional.
3870 default clause follows.
3873 Iteration (args come from the next argument (a list)).
3875 at most N iterations.
3878 args from next arg (a list of lists).
3881 args from the rest of arguments.
3884 args from the rest args (lists).
3895 aborts if N <= M <= K
3897 *** Not Implemented CL Format Control Directives
3900 print `#f' as an empty list (see below).
3903 print `#f' as an empty list (see below).
3909 (sorry I don't understand its semantics completely)
3911 *** Extended, Replaced and Additional Control Directives
3913 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHD'
3914 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHX'
3915 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHO'
3916 `~MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHB'
3917 `~N,MINCOL,PADCHAR,COMMACHAR,COMMAWIDTHR'
3918 COMMAWIDTH is the number of characters between two comma
3922 print a R4RS complex number as `~F~@Fi' with passed parameters for
3926 Pretty print formatting of an argument for scheme code lists.
3932 Flushes the output if format DESTINATION is a port.
3935 Print a `#\space' character
3937 print N `#\space' characters.
3940 Print a `#\tab' character
3942 print N `#\tab' characters.
3945 Takes N as an integer representation for a character. No arguments
3946 are consumed. N is converted to a character by `integer->char'. N
3947 must be a positive decimal number.
3950 Print out readproof. Prints out internal objects represented as
3951 `#<...>' as strings `"#<...>"' so that the format output can always
3952 be processed by `read'.
3955 Print out readproof. Prints out internal objects represented as
3956 `#<...>' as strings `"#<...>"' so that the format output can always
3957 be processed by `read'.
3960 Prints information and a copyright notice on the format
3963 prints format version.
3966 may also print number strings, i.e. passing a number as a string
3967 and format it accordingly.
3969 *** Configuration Variables
3971 The format module exports some configuration variables to suit the
3972 systems and users needs. There should be no modification necessary for
3973 the configuration that comes with Guile. Format detects automatically
3974 if the running scheme system implements floating point numbers and
3977 format:symbol-case-conv
3978 Symbols are converted by `symbol->string' so the case type of the
3979 printed symbols is implementation dependent.
3980 `format:symbol-case-conv' is a one arg closure which is either
3981 `#f' (no conversion), `string-upcase', `string-downcase' or
3982 `string-capitalize'. (default `#f')
3984 format:iobj-case-conv
3985 As FORMAT:SYMBOL-CASE-CONV but applies for the representation of
3986 implementation internal objects. (default `#f')
3989 The character prefixing the exponent value in `~E' printing.
3992 *** Compatibility With Other Format Implementations
3998 Downward compatible except for padding support and `~A', `~S',
3999 `~P', `~X' uppercase printing. SLIB format 1.4 uses C-style
4000 `printf' padding support which is completely replaced by the CL
4001 `format' padding style.
4004 Downward compatible except for `~', which is not documented
4005 (ignores all characters inside the format string up to a newline
4006 character). (7.1 implements `~a', `~s', ~NEWLINE, `~~', `~%',
4007 numerical and variable parameters and `:/@' modifiers in the CL
4011 Downward compatible except for `~A' and `~S' which print in
4012 uppercase. (Elk implements `~a', `~s', `~~', and `~%' (no
4013 directive parameters or modifiers)).
4016 Downward compatible except for an optional destination parameter:
4017 S2C accepts a format call without a destination which returns a
4018 formatted string. This is equivalent to a #f destination in S2C.
4019 (S2C implements `~a', `~s', `~c', `~%', and `~~' (no directive
4020 parameters or modifiers)).
4023 ** Changes to string-handling functions.
4025 These functions were added to support the (ice-9 format) module, above.
4027 *** New function: string-upcase STRING
4028 *** New function: string-downcase STRING
4030 These are non-destructive versions of the existing string-upcase! and
4031 string-downcase! functions.
4033 *** New function: string-capitalize! STRING
4034 *** New function: string-capitalize STRING
4036 These functions convert the first letter of each word in the string to
4039 (string-capitalize "howdy there")
4042 As with the other functions, string-capitalize! modifies the string in
4043 place, while string-capitalize returns a modified copy of its argument.
4045 *** New function: string-ci->symbol STRING
4047 Return a symbol whose name is STRING, but having the same case as if
4048 the symbol had be read by `read'.
4050 Guile can be configured to be sensitive or insensitive to case
4051 differences in Scheme identifiers. If Guile is case-insensitive, all
4052 symbols are converted to lower case on input. The `string-ci->symbol'
4053 function returns a symbol whose name in STRING, transformed as Guile
4054 would if STRING were input.
4056 *** New function: substring-move! STRING1 START END STRING2 START
4058 Copy the substring of STRING1 from START (inclusive) to END
4059 (exclusive) to STRING2 at START. STRING1 and STRING2 may be the same
4060 string, and the source and destination areas may overlap; in all
4061 cases, the function behaves as if all the characters were copied
4064 *** Extended functions: substring-move-left! substring-move-right!
4066 These functions now correctly copy arbitrarily overlapping substrings;
4067 they are both synonyms for substring-move!.
4070 ** New module (ice-9 getopt-long), with the function `getopt-long'.
4072 getopt-long is a function for parsing command-line arguments in a
4073 manner consistent with other GNU programs.
4075 (getopt-long ARGS GRAMMAR)
4076 Parse the arguments ARGS according to the argument list grammar GRAMMAR.
4078 ARGS should be a list of strings. Its first element should be the
4079 name of the program; subsequent elements should be the arguments
4080 that were passed to the program on the command line. The
4081 `program-arguments' procedure returns a list of this form.
4083 GRAMMAR is a list of the form:
4084 ((OPTION (PROPERTY VALUE) ...) ...)
4086 Each OPTION should be a symbol. `getopt-long' will accept a
4087 command-line option named `--OPTION'.
4088 Each option can have the following (PROPERTY VALUE) pairs:
4090 (single-char CHAR) --- Accept `-CHAR' as a single-character
4091 equivalent to `--OPTION'. This is how to specify traditional
4093 (required? BOOL) --- If BOOL is true, the option is required.
4094 getopt-long will raise an error if it is not found in ARGS.
4095 (value BOOL) --- If BOOL is #t, the option accepts a value; if
4096 it is #f, it does not; and if it is the symbol
4097 `optional', the option may appear in ARGS with or
4099 (predicate FUNC) --- If the option accepts a value (i.e. you
4100 specified `(value #t)' for this option), then getopt
4101 will apply FUNC to the value, and throw an exception
4102 if it returns #f. FUNC should be a procedure which
4103 accepts a string and returns a boolean value; you may
4104 need to use quasiquotes to get it into GRAMMAR.
4106 The (PROPERTY VALUE) pairs may occur in any order, but each
4107 property may occur only once. By default, options do not have
4108 single-character equivalents, are not required, and do not take
4111 In ARGS, single-character options may be combined, in the usual
4112 Unix fashion: ("-x" "-y") is equivalent to ("-xy"). If an option
4113 accepts values, then it must be the last option in the
4114 combination; the value is the next argument. So, for example, using
4115 the following grammar:
4116 ((apples (single-char #\a))
4117 (blimps (single-char #\b) (value #t))
4118 (catalexis (single-char #\c) (value #t)))
4119 the following argument lists would be acceptable:
4120 ("-a" "-b" "bang" "-c" "couth") ("bang" and "couth" are the values
4121 for "blimps" and "catalexis")
4122 ("-ab" "bang" "-c" "couth") (same)
4123 ("-ac" "couth" "-b" "bang") (same)
4124 ("-abc" "couth" "bang") (an error, since `-b' is not the
4125 last option in its combination)
4127 If an option's value is optional, then `getopt-long' decides
4128 whether it has a value by looking at what follows it in ARGS. If
4129 the next element is a string, and it does not appear to be an
4130 option itself, then that string is the option's value.
4132 The value of a long option can appear as the next element in ARGS,
4133 or it can follow the option name, separated by an `=' character.
4134 Thus, using the same grammar as above, the following argument lists
4136 ("--apples" "Braeburn" "--blimps" "Goodyear")
4137 ("--apples=Braeburn" "--blimps" "Goodyear")
4138 ("--blimps" "Goodyear" "--apples=Braeburn")
4140 If the option "--" appears in ARGS, argument parsing stops there;
4141 subsequent arguments are returned as ordinary arguments, even if
4142 they resemble options. So, in the argument list:
4143 ("--apples" "Granny Smith" "--" "--blimp" "Goodyear")
4144 `getopt-long' will recognize the `apples' option as having the
4145 value "Granny Smith", but it will not recognize the `blimp'
4146 option; it will return the strings "--blimp" and "Goodyear" as
4147 ordinary argument strings.
4149 The `getopt-long' function returns the parsed argument list as an
4150 assocation list, mapping option names --- the symbols from GRAMMAR
4151 --- onto their values, or #t if the option does not accept a value.
4152 Unused options do not appear in the alist.
4154 All arguments that are not the value of any option are returned
4155 as a list, associated with the empty list.
4157 `getopt-long' throws an exception if:
4158 - it finds an unrecognized option in ARGS
4159 - a required option is omitted
4160 - an option that requires an argument doesn't get one
4161 - an option that doesn't accept an argument does get one (this can
4162 only happen using the long option `--opt=value' syntax)
4163 - an option predicate fails
4168 `((lockfile-dir (required? #t)
4171 (predicate ,file-is-directory?))
4172 (verbose (required? #f)
4175 (x-includes (single-char #\x))
4176 (rnet-server (single-char #\y)
4177 (predicate ,string?))))
4179 (getopt-long '("my-prog" "-vk" "/tmp" "foo1" "--x-includes=/usr/include"
4180 "--rnet-server=lamprod" "--" "-fred" "foo2" "foo3")
4182 => ((() "foo1" "-fred" "foo2" "foo3")
4183 (rnet-server . "lamprod")
4184 (x-includes . "/usr/include")
4185 (lockfile-dir . "/tmp")
4188 ** The (ice-9 getopt-gnu-style) module is obsolete; use (ice-9 getopt-long).
4190 It will be removed in a few releases.
4192 ** New syntax: lambda*
4193 ** New syntax: define*
4194 ** New syntax: define*-public
4195 ** New syntax: defmacro*
4196 ** New syntax: defmacro*-public
4197 Guile now supports optional arguments.
4199 `lambda*', `define*', `define*-public', `defmacro*' and
4200 `defmacro*-public' are identical to the non-* versions except that
4201 they use an extended type of parameter list that has the following BNF
4202 syntax (parentheses are literal, square brackets indicate grouping,
4203 and `*', `+' and `?' have the usual meaning):
4205 ext-param-list ::= ( [identifier]* [#&optional [ext-var-decl]+]?
4206 [#&key [ext-var-decl]+ [#&allow-other-keys]?]?
4207 [[#&rest identifier]|[. identifier]]? ) | [identifier]
4209 ext-var-decl ::= identifier | ( identifier expression )
4211 The semantics are best illustrated with the following documentation
4212 and examples for `lambda*':
4215 lambda extended for optional and keyword arguments
4217 lambda* creates a procedure that takes optional arguments. These
4218 are specified by putting them inside brackets at the end of the
4219 paramater list, but before any dotted rest argument. For example,
4220 (lambda* (a b #&optional c d . e) '())
4221 creates a procedure with fixed arguments a and b, optional arguments c
4222 and d, and rest argument e. If the optional arguments are omitted
4223 in a call, the variables for them are unbound in the procedure. This
4224 can be checked with the bound? macro.
4226 lambda* can also take keyword arguments. For example, a procedure
4228 (lambda* (#&key xyzzy larch) '())
4229 can be called with any of the argument lists (#:xyzzy 11)
4230 (#:larch 13) (#:larch 42 #:xyzzy 19) (). Whichever arguments
4231 are given as keywords are bound to values.
4233 Optional and keyword arguments can also be given default values
4234 which they take on when they are not present in a call, by giving a
4235 two-item list in place of an optional argument, for example in:
4236 (lambda* (foo #&optional (bar 42) #&key (baz 73)) (list foo bar baz))
4237 foo is a fixed argument, bar is an optional argument with default
4238 value 42, and baz is a keyword argument with default value 73.
4239 Default value expressions are not evaluated unless they are needed
4240 and until the procedure is called.
4242 lambda* now supports two more special parameter list keywords.
4244 lambda*-defined procedures now throw an error by default if a
4245 keyword other than one of those specified is found in the actual
4246 passed arguments. However, specifying #&allow-other-keys
4247 immediately after the kyword argument declarations restores the
4248 previous behavior of ignoring unknown keywords. lambda* also now
4249 guarantees that if the same keyword is passed more than once, the
4250 last one passed is the one that takes effect. For example,
4251 ((lambda* (#&key (heads 0) (tails 0)) (display (list heads tails)))
4252 #:heads 37 #:tails 42 #:heads 99)
4253 would result in (99 47) being displayed.
4255 #&rest is also now provided as a synonym for the dotted syntax rest
4256 argument. The argument lists (a . b) and (a #&rest b) are equivalent in
4257 all respects to lambda*. This is provided for more similarity to DSSSL,
4258 MIT-Scheme and Kawa among others, as well as for refugees from other
4261 Further documentation may be found in the optargs.scm file itself.
4263 The optional argument module also exports the macros `let-optional',
4264 `let-optional*', `let-keywords', `let-keywords*' and `bound?'. These
4265 are not documented here because they may be removed in the future, but
4266 full documentation is still available in optargs.scm.
4268 ** New syntax: and-let*
4269 Guile now supports the `and-let*' form, described in the draft SRFI-2.
4271 Syntax: (land* (<clause> ...) <body> ...)
4272 Each <clause> should have one of the following forms:
4273 (<variable> <expression>)
4276 Each <variable> or <bound-variable> should be an identifier. Each
4277 <expression> should be a valid expression. The <body> should be a
4278 possibly empty sequence of expressions, like the <body> of a
4281 Semantics: A LAND* expression is evaluated by evaluating the
4282 <expression> or <bound-variable> of each of the <clause>s from
4283 left to right. The value of the first <expression> or
4284 <bound-variable> that evaluates to a false value is returned; the
4285 remaining <expression>s and <bound-variable>s are not evaluated.
4286 The <body> forms are evaluated iff all the <expression>s and
4287 <bound-variable>s evaluate to true values.
4289 The <expression>s and the <body> are evaluated in an environment
4290 binding each <variable> of the preceding (<variable> <expression>)
4291 clauses to the value of the <expression>. Later bindings
4292 shadow earlier bindings.
4294 Guile's and-let* macro was contributed by Michael Livshin.
4296 ** New sorting functions
4298 *** New function: sorted? SEQUENCE LESS?
4299 Returns `#t' when the sequence argument is in non-decreasing order
4300 according to LESS? (that is, there is no adjacent pair `... x y
4301 ...' for which `(less? y x)').
4303 Returns `#f' when the sequence contains at least one out-of-order
4304 pair. It is an error if the sequence is neither a list nor a
4307 *** New function: merge LIST1 LIST2 LESS?
4308 LIST1 and LIST2 are sorted lists.
4309 Returns the sorted list of all elements in LIST1 and LIST2.
4311 Assume that the elements a and b1 in LIST1 and b2 in LIST2 are "equal"
4312 in the sense that (LESS? x y) --> #f for x, y in {a, b1, b2},
4313 and that a < b1 in LIST1. Then a < b1 < b2 in the result.
4314 (Here "<" should read "comes before".)
4316 *** New procedure: merge! LIST1 LIST2 LESS?
4317 Merges two lists, re-using the pairs of LIST1 and LIST2 to build
4318 the result. If the code is compiled, and LESS? constructs no new
4319 pairs, no pairs at all will be allocated. The first pair of the
4320 result will be either the first pair of LIST1 or the first pair of
4323 *** New function: sort SEQUENCE LESS?
4324 Accepts either a list or a vector, and returns a new sequence
4325 which is sorted. The new sequence is the same type as the input.
4326 Always `(sorted? (sort sequence less?) less?)'. The original
4327 sequence is not altered in any way. The new sequence shares its
4328 elements with the old one; no elements are copied.
4330 *** New procedure: sort! SEQUENCE LESS
4331 Returns its sorted result in the original boxes. No new storage is
4332 allocated at all. Proper usage: (set! slist (sort! slist <))
4334 *** New function: stable-sort SEQUENCE LESS?
4335 Similar to `sort' but stable. That is, if "equal" elements are
4336 ordered a < b in the original sequence, they will have the same order
4339 *** New function: stable-sort! SEQUENCE LESS?
4340 Similar to `sort!' but stable.
4341 Uses temporary storage when sorting vectors.
4343 *** New functions: sort-list, sort-list!
4344 Added for compatibility with scsh.
4346 ** New built-in random number support
4348 *** New function: random N [STATE]
4349 Accepts a positive integer or real N and returns a number of the
4350 same type between zero (inclusive) and N (exclusive). The values
4351 returned have a uniform distribution.
4353 The optional argument STATE must be of the type produced by
4354 `copy-random-state' or `seed->random-state'. It defaults to the value
4355 of the variable `*random-state*'. This object is used to maintain the
4356 state of the pseudo-random-number generator and is altered as a side
4357 effect of the `random' operation.
4359 *** New variable: *random-state*
4360 Holds a data structure that encodes the internal state of the
4361 random-number generator that `random' uses by default. The nature
4362 of this data structure is implementation-dependent. It may be
4363 printed out and successfully read back in, but may or may not
4364 function correctly as a random-number state object in another
4367 *** New function: copy-random-state [STATE]
4368 Returns a new object of type suitable for use as the value of the
4369 variable `*random-state*' and as a second argument to `random'.
4370 If argument STATE is given, a copy of it is returned. Otherwise a
4371 copy of `*random-state*' is returned.
4373 *** New function: seed->random-state SEED
4374 Returns a new object of type suitable for use as the value of the
4375 variable `*random-state*' and as a second argument to `random'.
4376 SEED is a string or a number. A new state is generated and
4377 initialized using SEED.
4379 *** New function: random:uniform [STATE]
4380 Returns an uniformly distributed inexact real random number in the
4381 range between 0 and 1.
4383 *** New procedure: random:solid-sphere! VECT [STATE]
4384 Fills VECT with inexact real random numbers the sum of whose
4385 squares is less than 1.0. Thinking of VECT as coordinates in
4386 space of dimension N = `(vector-length VECT)', the coordinates are
4387 uniformly distributed within the unit N-shere. The sum of the
4388 squares of the numbers is returned. VECT can be either a vector
4389 or a uniform vector of doubles.
4391 *** New procedure: random:hollow-sphere! VECT [STATE]
4392 Fills VECT with inexact real random numbers the sum of whose squares
4393 is equal to 1.0. Thinking of VECT as coordinates in space of
4394 dimension n = `(vector-length VECT)', the coordinates are uniformly
4395 distributed over the surface of the unit n-shere. VECT can be either
4396 a vector or a uniform vector of doubles.
4398 *** New function: random:normal [STATE]
4399 Returns an inexact real in a normal distribution with mean 0 and
4400 standard deviation 1. For a normal distribution with mean M and
4401 standard deviation D use `(+ M (* D (random:normal)))'.
4403 *** New procedure: random:normal-vector! VECT [STATE]
4404 Fills VECT with inexact real random numbers which are independent and
4405 standard normally distributed (i.e., with mean 0 and variance 1).
4406 VECT can be either a vector or a uniform vector of doubles.
4408 *** New function: random:exp STATE
4409 Returns an inexact real in an exponential distribution with mean 1.
4410 For an exponential distribution with mean U use (* U (random:exp)).
4412 ** The range of logand, logior, logxor, logtest, and logbit? have changed.
4414 These functions now operate on numbers in the range of a C unsigned
4417 These functions used to operate on numbers in the range of a C signed
4418 long; however, this seems inappropriate, because Guile integers don't
4421 ** New function: make-guardian
4422 This is an implementation of guardians as described in
4423 R. Kent Dybvig, Carl Bruggeman, and David Eby (1993) "Guardians in a
4424 Generation-Based Garbage Collector" ACM SIGPLAN Conference on
4425 Programming Language Design and Implementation, June 1993
4426 ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/guardians.ps.gz
4428 ** New functions: delq1!, delv1!, delete1!
4429 These procedures behave similar to delq! and friends but delete only
4430 one object if at all.
4432 ** New function: unread-string STRING PORT
4433 Unread STRING to PORT, that is, push it back onto the port so that
4434 next read operation will work on the pushed back characters.
4436 ** unread-char can now be called multiple times
4437 If unread-char is called multiple times, the unread characters will be
4438 read again in last-in first-out order.
4440 ** the procedures uniform-array-read! and uniform-array-write! now
4441 work on any kind of port, not just ports which are open on a file.
4443 ** Now 'l' in a port mode requests line buffering.
4445 ** The procedure truncate-file now works on string ports as well
4446 as file ports. If the size argument is omitted, the current
4447 file position is used.
4449 ** new procedure: seek PORT/FDES OFFSET WHENCE
4450 The arguments are the same as for the old fseek procedure, but it
4451 works on string ports as well as random-access file ports.
4453 ** the fseek procedure now works on string ports, since it has been
4454 redefined using seek.
4456 ** the setvbuf procedure now uses a default size if mode is _IOFBF and
4457 size is not supplied.
4459 ** the newline procedure no longer flushes the port if it's not
4460 line-buffered: previously it did if it was the current output port.
4462 ** open-pipe and close-pipe are no longer primitive procedures, but
4463 an emulation can be obtained using `(use-modules (ice-9 popen))'.
4465 ** the freopen procedure has been removed.
4467 ** new procedure: drain-input PORT
4468 Drains PORT's read buffers (including any pushed-back characters)
4469 and returns the contents as a single string.
4471 ** New function: map-in-order PROC LIST1 LIST2 ...
4472 Version of `map' which guarantees that the procedure is applied to the
4473 lists in serial order.
4475 ** Renamed `serial-array-copy!' and `serial-array-map!' to
4476 `array-copy-in-order!' and `array-map-in-order!'. The old names are
4477 now obsolete and will go away in release 1.5.
4479 ** New syntax: collect BODY1 ...
4480 Version of `begin' which returns a list of the results of the body
4481 forms instead of the result of the last body form. In contrast to
4482 `begin', `collect' allows an empty body.
4484 ** New functions: read-history FILENAME, write-history FILENAME
4485 Read/write command line history from/to file. Returns #t on success
4486 and #f if an error occured.
4488 ** `ls' and `lls' in module (ice-9 ls) now handle no arguments.
4490 These procedures return a list of definitions available in the specified
4491 argument, a relative module reference. In the case of no argument,
4492 `(current-module)' is now consulted for definitions to return, instead
4493 of simply returning #f, the former behavior.
4495 ** The #/ syntax for lists is no longer supported.
4497 Earlier versions of Scheme accepted this syntax, but printed a
4500 ** Guile no longer consults the SCHEME_LOAD_PATH environment variable.
4502 Instead, you should set GUILE_LOAD_PATH to tell Guile where to find
4505 * Changes to the gh_ interface
4509 Now takes a second argument which is the result array. If this
4510 pointer is NULL, a new array is malloced (the old behaviour).
4512 ** gh_chars2byvect, gh_shorts2svect, gh_floats2fvect, gh_scm2chars,
4513 gh_scm2shorts, gh_scm2longs, gh_scm2floats
4517 * Changes to the scm_ interface
4519 ** Function: scm_make_named_hook (char* name, int n_args)
4521 Creates a hook in the same way as make-hook above but also
4522 binds a variable named NAME to it.
4524 This is the typical way of creating a hook from C code.
4526 Currently, the variable is created in the "current" module. This
4527 might change when we get the new module system.
4529 ** The smob interface
4531 The interface for creating smobs has changed. For documentation, see
4532 data-rep.info (made from guile-core/doc/data-rep.texi).
4534 *** Deprecated function: SCM scm_newsmob (scm_smobfuns *)
4536 >>> This function will be removed in 1.3.4. <<<
4540 *** Function: SCM scm_make_smob_type (const char *name, scm_sizet size)
4541 This function adds a new smob type, named NAME, with instance size
4542 SIZE to the system. The return value is a tag that is used in
4543 creating instances of the type. If SIZE is 0, then no memory will
4544 be allocated when instances of the smob are created, and nothing
4545 will be freed by the default free function.
4547 *** Function: void scm_set_smob_mark (long tc, SCM (*mark) (SCM))
4548 This function sets the smob marking procedure for the smob type
4549 specified by the tag TC. TC is the tag returned by
4550 `scm_make_smob_type'.
4552 *** Function: void scm_set_smob_free (long tc, SCM (*mark) (SCM))
4553 This function sets the smob freeing procedure for the smob type
4554 specified by the tag TC. TC is the tag returned by
4555 `scm_make_smob_type'.
4557 *** Function: void scm_set_smob_print (tc, print)
4559 - Function: void scm_set_smob_print (long tc,
4560 scm_sizet (*print) (SCM,
4564 This function sets the smob printing procedure for the smob type
4565 specified by the tag TC. TC is the tag returned by
4566 `scm_make_smob_type'.
4568 *** Function: void scm_set_smob_equalp (long tc, SCM (*equalp) (SCM, SCM))
4569 This function sets the smob equality-testing predicate for the
4570 smob type specified by the tag TC. TC is the tag returned by
4571 `scm_make_smob_type'.
4573 *** Macro: void SCM_NEWSMOB (SCM var, long tc, void *data)
4574 Make VALUE contain a smob instance of the type with type code TC and
4575 smob data DATA. VALUE must be previously declared as C type `SCM'.
4577 *** Macro: fn_returns SCM_RETURN_NEWSMOB (long tc, void *data)
4578 This macro expands to a block of code that creates a smob instance
4579 of the type with type code TC and smob data DATA, and returns that
4580 `SCM' value. It should be the last piece of code in a block.
4582 ** The interfaces for using I/O ports and implementing port types
4583 (ptobs) have changed significantly. The new interface is based on
4584 shared access to buffers and a new set of ptob procedures.
4586 *** scm_newptob has been removed
4590 *** Function: SCM scm_make_port_type (type_name, fill_buffer, write_flush)
4592 - Function: SCM scm_make_port_type (char *type_name,
4593 int (*fill_buffer) (SCM port),
4594 void (*write_flush) (SCM port));
4596 Similarly to the new smob interface, there is a set of function
4597 setters by which the user can customize the behaviour of his port
4598 type. See ports.h (scm_set_port_XXX).
4600 ** scm_strport_to_string: New function: creates a new string from
4601 a string port's buffer.
4603 ** Plug in interface for random number generators
4604 The variable `scm_the_rng' in random.c contains a value and three
4605 function pointers which together define the current random number
4606 generator being used by the Scheme level interface and the random
4607 number library functions.
4609 The user is free to replace the default generator with the generator
4612 *** Variable: size_t scm_the_rng.rstate_size
4613 The size of the random state type used by the current RNG
4616 *** Function: unsigned long scm_the_rng.random_bits (scm_rstate *STATE)
4617 Given the random STATE, return 32 random bits.
4619 *** Function: void scm_the_rng.init_rstate (scm_rstate *STATE, chars *S, int N)
4620 Seed random state STATE using string S of length N.
4622 *** Function: scm_rstate *scm_the_rng.copy_rstate (scm_rstate *STATE)
4623 Given random state STATE, return a malloced copy.
4626 The default RNG is the MWC (Multiply With Carry) random number
4627 generator described by George Marsaglia at the Department of
4628 Statistics and Supercomputer Computations Research Institute, The
4629 Florida State University (http://stat.fsu.edu/~geo).
4631 It uses 64 bits, has a period of 4578426017172946943 (4.6e18), and
4632 passes all tests in the DIEHARD test suite
4633 (http://stat.fsu.edu/~geo/diehard.html). The generation of 32 bits
4634 costs one multiply and one add on platforms which either supports long
4635 longs (gcc does this on most systems) or have 64 bit longs. The cost
4636 is four multiply on other systems but this can be optimized by writing
4637 scm_i_uniform32 in assembler.
4639 These functions are provided through the scm_the_rng interface for use
4640 by libguile and the application.
4642 *** Function: unsigned long scm_i_uniform32 (scm_i_rstate *STATE)
4643 Given the random STATE, return 32 random bits.
4644 Don't use this function directly. Instead go through the plugin
4645 interface (see "Plug in interface" above).
4647 *** Function: void scm_i_init_rstate (scm_i_rstate *STATE, char *SEED, int N)
4648 Initialize STATE using SEED of length N.
4650 *** Function: scm_i_rstate *scm_i_copy_rstate (scm_i_rstate *STATE)
4651 Return a malloc:ed copy of STATE. This function can easily be re-used
4652 in the interfaces to other RNGs.
4654 ** Random number library functions
4655 These functions use the current RNG through the scm_the_rng interface.
4656 It might be a good idea to use these functions from your C code so
4657 that only one random generator is used by all code in your program.
4659 The default random state is stored in:
4661 *** Variable: SCM scm_var_random_state
4662 Contains the vcell of the Scheme variable "*random-state*" which is
4663 used as default state by all random number functions in the Scheme
4668 double x = scm_c_uniform01 (SCM_RSTATE (SCM_CDR (scm_var_random_state)));
4670 *** Function: scm_rstate *scm_c_default_rstate (void)
4671 This is a convenience function which returns the value of
4672 scm_var_random_state. An error message is generated if this value
4673 isn't a random state.
4675 *** Function: scm_rstate *scm_c_make_rstate (char *SEED, int LENGTH)
4676 Make a new random state from the string SEED of length LENGTH.
4678 It is generally not a good idea to use multiple random states in a
4679 program. While subsequent random numbers generated from one random
4680 state are guaranteed to be reasonably independent, there is no such
4681 guarantee for numbers generated from different random states.
4683 *** Macro: unsigned long scm_c_uniform32 (scm_rstate *STATE)
4684 Return 32 random bits.
4686 *** Function: double scm_c_uniform01 (scm_rstate *STATE)
4687 Return a sample from the uniform(0,1) distribution.
4689 *** Function: double scm_c_normal01 (scm_rstate *STATE)
4690 Return a sample from the normal(0,1) distribution.
4692 *** Function: double scm_c_exp1 (scm_rstate *STATE)
4693 Return a sample from the exp(1) distribution.
4695 *** Function: unsigned long scm_c_random (scm_rstate *STATE, unsigned long M)
4696 Return a sample from the discrete uniform(0,M) distribution.
4698 *** Function: SCM scm_c_random_bignum (scm_rstate *STATE, SCM M)
4699 Return a sample from the discrete uniform(0,M) distribution.
4700 M must be a bignum object. The returned value may be an INUM.
4704 Changes in Guile 1.3 (released Monday, October 19, 1998):
4706 * Changes to the distribution
4708 ** We renamed the SCHEME_LOAD_PATH environment variable to GUILE_LOAD_PATH.
4709 To avoid conflicts, programs should name environment variables after
4710 themselves, except when there's a common practice establishing some
4713 For now, Guile supports both GUILE_LOAD_PATH and SCHEME_LOAD_PATH,
4714 giving the former precedence, and printing a warning message if the
4715 latter is set. Guile 1.4 will not recognize SCHEME_LOAD_PATH at all.
4717 ** The header files related to multi-byte characters have been removed.
4718 They were: libguile/extchrs.h and libguile/mbstrings.h. Any C code
4719 which referred to these explicitly will probably need to be rewritten,
4720 since the support for the variant string types has been removed; see
4723 ** The header files append.h and sequences.h have been removed. These
4724 files implemented non-R4RS operations which would encourage
4725 non-portable programming style and less easy-to-read code.
4727 * Changes to the stand-alone interpreter
4729 ** New procedures have been added to implement a "batch mode":
4731 *** Function: batch-mode?
4733 Returns a boolean indicating whether the interpreter is in batch
4736 *** Function: set-batch-mode?! ARG
4738 If ARG is true, switches the interpreter to batch mode. The `#f'
4739 case has not been implemented.
4741 ** Guile now provides full command-line editing, when run interactively.
4742 To use this feature, you must have the readline library installed.
4743 The Guile build process will notice it, and automatically include
4746 The readline library is available via anonymous FTP from any GNU
4747 mirror site; the canonical location is "ftp://prep.ai.mit.edu/pub/gnu".
4749 ** the-last-stack is now a fluid.
4751 * Changes to the procedure for linking libguile with your programs
4753 ** You can now use the `guile-config' utility to build programs that use Guile.
4755 Guile now includes a command-line utility called `guile-config', which
4756 can provide information about how to compile and link programs that
4759 *** `guile-config compile' prints any C compiler flags needed to use Guile.
4760 You should include this command's output on the command line you use
4761 to compile C or C++ code that #includes the Guile header files. It's
4762 usually just a `-I' flag to help the compiler find the Guile headers.
4765 *** `guile-config link' prints any linker flags necessary to link with Guile.
4767 This command writes to its standard output a list of flags which you
4768 must pass to the linker to link your code against the Guile library.
4769 The flags include '-lguile' itself, any other libraries the Guile
4770 library depends upon, and any `-L' flags needed to help the linker
4771 find those libraries.
4773 For example, here is a Makefile rule that builds a program named 'foo'
4774 from the object files ${FOO_OBJECTS}, and links them against Guile:
4777 ${CC} ${CFLAGS} ${FOO_OBJECTS} `guile-config link` -o foo
4779 Previous Guile releases recommended that you use autoconf to detect
4780 which of a predefined set of libraries were present on your system.
4781 It is more robust to use `guile-config', since it records exactly which
4782 libraries the installed Guile library requires.
4784 This was originally called `build-guile', but was renamed to
4785 `guile-config' before Guile 1.3 was released, to be consistent with
4786 the analogous script for the GTK+ GUI toolkit, which is called
4790 ** Use the GUILE_FLAGS macro in your configure.in file to find Guile.
4792 If you are using the GNU autoconf package to configure your program,
4793 you can use the GUILE_FLAGS autoconf macro to call `guile-config'
4794 (described above) and gather the necessary values for use in your
4797 The GUILE_FLAGS macro expands to configure script code which runs the
4798 `guile-config' script, to find out where Guile's header files and
4799 libraries are installed. It sets two variables, marked for
4800 substitution, as by AC_SUBST.
4802 GUILE_CFLAGS --- flags to pass to a C or C++ compiler to build
4803 code that uses Guile header files. This is almost always just a
4806 GUILE_LDFLAGS --- flags to pass to the linker to link a
4807 program against Guile. This includes `-lguile' for the Guile
4808 library itself, any libraries that Guile itself requires (like
4809 -lqthreads), and so on. It may also include a -L flag to tell the
4810 compiler where to find the libraries.
4812 GUILE_FLAGS is defined in the file guile.m4, in the top-level
4813 directory of the Guile distribution. You can copy it into your
4814 package's aclocal.m4 file, and then use it in your configure.in file.
4816 If you are using the `aclocal' program, distributed with GNU automake,
4817 to maintain your aclocal.m4 file, the Guile installation process
4818 installs guile.m4 where aclocal will find it. All you need to do is
4819 use GUILE_FLAGS in your configure.in file, and then run `aclocal';
4820 this will copy the definition of GUILE_FLAGS into your aclocal.m4
4824 * Changes to Scheme functions and syntax
4826 ** Multi-byte strings have been removed, as have multi-byte and wide
4827 ports. We felt that these were the wrong approach to
4828 internationalization support.
4830 ** New function: readline [PROMPT]
4831 Read a line from the terminal, and allow the user to edit it,
4832 prompting with PROMPT. READLINE provides a large set of Emacs-like
4833 editing commands, lets the user recall previously typed lines, and
4834 works on almost every kind of terminal, including dumb terminals.
4836 READLINE assumes that the cursor is at the beginning of the line when
4837 it is invoked. Thus, you can't print a prompt yourself, and then call
4838 READLINE; you need to package up your prompt as a string, pass it to
4839 the function, and let READLINE print the prompt itself. This is
4840 because READLINE needs to know the prompt's screen width.
4842 For Guile to provide this function, you must have the readline
4843 library, version 2.1 or later, installed on your system. Readline is
4844 available via anonymous FTP from prep.ai.mit.edu in pub/gnu, or from
4845 any GNU mirror site.
4847 See also ADD-HISTORY function.
4849 ** New function: add-history STRING
4850 Add STRING as the most recent line in the history used by the READLINE
4851 command. READLINE does not add lines to the history itself; you must
4852 call ADD-HISTORY to make previous input available to the user.
4854 ** The behavior of the read-line function has changed.
4856 This function now uses standard C library functions to read the line,
4857 for speed. This means that it doesn not respect the value of
4858 scm-line-incrementors; it assumes that lines are delimited with
4861 (Note that this is read-line, the function that reads a line of text
4862 from a port, not readline, the function that reads a line from a
4863 terminal, providing full editing capabilities.)
4865 ** New module (ice-9 getopt-gnu-style): Parse command-line arguments.
4867 This module provides some simple argument parsing. It exports one
4870 Function: getopt-gnu-style ARG-LS
4871 Parse a list of program arguments into an alist of option
4874 Each item in the list of program arguments is examined to see if
4875 it meets the syntax of a GNU long-named option. An argument like
4876 `--MUMBLE' produces an element of the form (MUMBLE . #t) in the
4877 returned alist, where MUMBLE is a keyword object with the same
4878 name as the argument. An argument like `--MUMBLE=FROB' produces
4879 an element of the form (MUMBLE . FROB), where FROB is a string.
4881 As a special case, the returned alist also contains a pair whose
4882 car is the symbol `rest'. The cdr of this pair is a list
4883 containing all the items in the argument list that are not options
4884 of the form mentioned above.
4886 The argument `--' is treated specially: all items in the argument
4887 list appearing after such an argument are not examined, and are
4888 returned in the special `rest' list.
4890 This function does not parse normal single-character switches.
4891 You will need to parse them out of the `rest' list yourself.
4893 ** The read syntax for byte vectors and short vectors has changed.
4895 Instead of #bytes(...), write #y(...).
4897 Instead of #short(...), write #h(...).
4899 This may seem nutty, but, like the other uniform vectors, byte vectors
4900 and short vectors want to have the same print and read syntax (and,
4901 more basic, want to have read syntax!). Changing the read syntax to
4902 use multiple characters after the hash sign breaks with the
4903 conventions used in R5RS and the conventions used for the other
4904 uniform vectors. It also introduces complexity in the current reader,
4905 both on the C and Scheme levels. (The Right solution is probably to
4906 change the syntax and prototypes for uniform vectors entirely.)
4909 ** The new module (ice-9 session) provides useful interactive functions.
4911 *** New procedure: (apropos REGEXP OPTION ...)
4913 Display a list of top-level variables whose names match REGEXP, and
4914 the modules they are imported from. Each OPTION should be one of the
4917 value --- Show the value of each matching variable.
4918 shadow --- Show bindings shadowed by subsequently imported modules.
4919 full --- Same as both `shadow' and `value'.
4923 guile> (apropos "trace" 'full)
4924 debug: trace #<procedure trace args>
4925 debug: untrace #<procedure untrace args>
4926 the-scm-module: display-backtrace #<compiled-closure #<primitive-procedure gsubr-apply>>
4927 the-scm-module: before-backtrace-hook ()
4928 the-scm-module: backtrace #<primitive-procedure backtrace>
4929 the-scm-module: after-backtrace-hook ()
4930 the-scm-module: has-shown-backtrace-hint? #f
4933 ** There are new functions and syntax for working with macros.
4935 Guile implements macros as a special object type. Any variable whose
4936 top-level binding is a macro object acts as a macro. The macro object
4937 specifies how the expression should be transformed before evaluation.
4939 *** Macro objects now print in a reasonable way, resembling procedures.
4941 *** New function: (macro? OBJ)
4942 True iff OBJ is a macro object.
4944 *** New function: (primitive-macro? OBJ)
4945 Like (macro? OBJ), but true only if OBJ is one of the Guile primitive
4946 macro transformers, implemented in eval.c rather than Scheme code.
4948 Why do we have this function?
4949 - For symmetry with procedure? and primitive-procedure?,
4950 - to allow custom print procedures to tell whether a macro is
4951 primitive, and display it differently, and
4952 - to allow compilers and user-written evaluators to distinguish
4953 builtin special forms from user-defined ones, which could be
4956 *** New function: (macro-type OBJ)
4957 Return a value indicating what kind of macro OBJ is. Possible return
4960 The symbol `syntax' --- a macro created by procedure->syntax.
4961 The symbol `macro' --- a macro created by procedure->macro.
4962 The symbol `macro!' --- a macro created by procedure->memoizing-macro.
4963 The boolean #f --- if OBJ is not a macro object.
4965 *** New function: (macro-name MACRO)
4966 Return the name of the macro object MACRO's procedure, as returned by
4969 *** New function: (macro-transformer MACRO)
4970 Return the transformer procedure for MACRO.
4972 *** New syntax: (use-syntax MODULE ... TRANSFORMER)
4974 Specify a new macro expander to use in the current module. Each
4975 MODULE is a module name, with the same meaning as in the `use-modules'
4976 form; each named module's exported bindings are added to the current
4977 top-level environment. TRANSFORMER is an expression evaluated in the
4978 resulting environment which must yield a procedure to use as the
4979 module's eval transformer: every expression evaluated in this module
4980 is passed to this function, and the result passed to the Guile
4983 *** macro-eval! is removed. Use local-eval instead.
4985 ** Some magic has been added to the printer to better handle user
4986 written printing routines (like record printers, closure printers).
4988 The problem is that these user written routines must have access to
4989 the current `print-state' to be able to handle fancy things like
4990 detection of circular references. These print-states have to be
4991 passed to the builtin printing routines (display, write, etc) to
4992 properly continue the print chain.
4994 We didn't want to change all existing print code so that it
4995 explicitly passes thru a print state in addition to a port. Instead,
4996 we extented the possible values that the builtin printing routines
4997 accept as a `port'. In addition to a normal port, they now also take
4998 a pair of a normal port and a print-state. Printing will go to the
4999 port and the print-state will be used to control the detection of
5000 circular references, etc. If the builtin function does not care for a
5001 print-state, it is simply ignored.
5003 User written callbacks are now called with such a pair as their
5004 `port', but because every function now accepts this pair as a PORT
5005 argument, you don't have to worry about that. In fact, it is probably
5006 safest to not check for these pairs.
5008 However, it is sometimes necessary to continue a print chain on a
5009 different port, for example to get a intermediate string
5010 representation of the printed value, mangle that string somehow, and
5011 then to finally print the mangled string. Use the new function
5013 inherit-print-state OLD-PORT NEW-PORT
5015 for this. It constructs a new `port' that prints to NEW-PORT but
5016 inherits the print-state of OLD-PORT.
5018 ** struct-vtable-offset renamed to vtable-offset-user
5020 ** New constants: vtable-index-layout, vtable-index-vtable, vtable-index-printer
5022 ** There is now a third optional argument to make-vtable-vtable
5023 (and fourth to make-struct) when constructing new types (vtables).
5024 This argument initializes field vtable-index-printer of the vtable.
5026 ** The detection of circular references has been extended to structs.
5027 That is, a structure that -- in the process of being printed -- prints
5028 itself does not lead to infinite recursion.
5030 ** There is now some basic support for fluids. Please read
5031 "libguile/fluid.h" to find out more. It is accessible from Scheme with
5032 the following functions and macros:
5034 Function: make-fluid
5036 Create a new fluid object. Fluids are not special variables or
5037 some other extension to the semantics of Scheme, but rather
5038 ordinary Scheme objects. You can store them into variables (that
5039 are still lexically scoped, of course) or into any other place you
5040 like. Every fluid has a initial value of `#f'.
5042 Function: fluid? OBJ
5044 Test whether OBJ is a fluid.
5046 Function: fluid-ref FLUID
5047 Function: fluid-set! FLUID VAL
5049 Access/modify the fluid FLUID. Modifications are only visible
5050 within the current dynamic root (that includes threads).
5052 Function: with-fluids* FLUIDS VALUES THUNK
5054 FLUIDS is a list of fluids and VALUES a corresponding list of
5055 values for these fluids. Before THUNK gets called the values are
5056 installed in the fluids and the old values of the fluids are
5057 saved in the VALUES list. When the flow of control leaves THUNK
5058 or reenters it, the values get swapped again. You might think of
5059 this as a `safe-fluid-excursion'. Note that the VALUES list is
5060 modified by `with-fluids*'.
5062 Macro: with-fluids ((FLUID VALUE) ...) FORM ...
5064 The same as `with-fluids*' but with a different syntax. It looks
5065 just like `let', but both FLUID and VALUE are evaluated. Remember,
5066 fluids are not special variables but ordinary objects. FLUID
5067 should evaluate to a fluid.
5069 ** Changes to system call interfaces:
5071 *** close-port, close-input-port and close-output-port now return a
5072 boolean instead of an `unspecified' object. #t means that the port
5073 was successfully closed, while #f means it was already closed. It is
5074 also now possible for these procedures to raise an exception if an
5075 error occurs (some errors from write can be delayed until close.)
5077 *** the first argument to chmod, fcntl, ftell and fseek can now be a
5080 *** the third argument to fcntl is now optional.
5082 *** the first argument to chown can now be a file descriptor or a port.
5084 *** the argument to stat can now be a port.
5086 *** The following new procedures have been added (most use scsh
5089 *** procedure: close PORT/FD
5090 Similar to close-port (*note close-port: Closing Ports.), but also
5091 works on file descriptors. A side effect of closing a file
5092 descriptor is that any ports using that file descriptor are moved
5093 to a different file descriptor and have their revealed counts set
5096 *** procedure: port->fdes PORT
5097 Returns the integer file descriptor underlying PORT. As a side
5098 effect the revealed count of PORT is incremented.
5100 *** procedure: fdes->ports FDES
5101 Returns a list of existing ports which have FDES as an underlying
5102 file descriptor, without changing their revealed counts.
5104 *** procedure: fdes->inport FDES
5105 Returns an existing input port which has FDES as its underlying
5106 file descriptor, if one exists, and increments its revealed count.
5107 Otherwise, returns a new input port with a revealed count of 1.
5109 *** procedure: fdes->outport FDES
5110 Returns an existing output port which has FDES as its underlying
5111 file descriptor, if one exists, and increments its revealed count.
5112 Otherwise, returns a new output port with a revealed count of 1.
5114 The next group of procedures perform a `dup2' system call, if NEWFD
5115 (an integer) is supplied, otherwise a `dup'. The file descriptor to be
5116 duplicated can be supplied as an integer or contained in a port. The
5117 type of value returned varies depending on which procedure is used.
5119 All procedures also have the side effect when performing `dup2' that
5120 any ports using NEWFD are moved to a different file descriptor and have
5121 their revealed counts set to zero.
5123 *** procedure: dup->fdes PORT/FD [NEWFD]
5124 Returns an integer file descriptor.
5126 *** procedure: dup->inport PORT/FD [NEWFD]
5127 Returns a new input port using the new file descriptor.
5129 *** procedure: dup->outport PORT/FD [NEWFD]
5130 Returns a new output port using the new file descriptor.
5132 *** procedure: dup PORT/FD [NEWFD]
5133 Returns a new port if PORT/FD is a port, with the same mode as the
5134 supplied port, otherwise returns an integer file descriptor.
5136 *** procedure: dup->port PORT/FD MODE [NEWFD]
5137 Returns a new port using the new file descriptor. MODE supplies a
5138 mode string for the port (*note open-file: File Ports.).
5140 *** procedure: setenv NAME VALUE
5141 Modifies the environment of the current process, which is also the
5142 default environment inherited by child processes.
5144 If VALUE is `#f', then NAME is removed from the environment.
5145 Otherwise, the string NAME=VALUE is added to the environment,
5146 replacing any existing string with name matching NAME.
5148 The return value is unspecified.
5150 *** procedure: truncate-file OBJ SIZE
5151 Truncates the file referred to by OBJ to at most SIZE bytes. OBJ
5152 can be a string containing a file name or an integer file
5153 descriptor or port open for output on the file. The underlying
5154 system calls are `truncate' and `ftruncate'.
5156 The return value is unspecified.
5158 *** procedure: setvbuf PORT MODE [SIZE]
5159 Set the buffering mode for PORT. MODE can be:
5167 block buffered, using a newly allocated buffer of SIZE bytes.
5168 However if SIZE is zero or unspecified, the port will be made
5171 This procedure should not be used after I/O has been performed with
5174 Ports are usually block buffered by default, with a default buffer
5175 size. Procedures e.g., *Note open-file: File Ports, which accept a
5176 mode string allow `0' to be added to request an unbuffered port.
5178 *** procedure: fsync PORT/FD
5179 Copies any unwritten data for the specified output file descriptor
5180 to disk. If PORT/FD is a port, its buffer is flushed before the
5181 underlying file descriptor is fsync'd. The return value is
5184 *** procedure: open-fdes PATH FLAGS [MODES]
5185 Similar to `open' but returns a file descriptor instead of a port.
5187 *** procedure: execle PATH ENV [ARG] ...
5188 Similar to `execl', but the environment of the new process is
5189 specified by ENV, which must be a list of strings as returned by
5190 the `environ' procedure.
5192 This procedure is currently implemented using the `execve' system
5193 call, but we call it `execle' because of its Scheme calling
5196 *** procedure: strerror ERRNO
5197 Returns the Unix error message corresponding to ERRNO, an integer.
5199 *** procedure: primitive-exit [STATUS]
5200 Terminate the current process without unwinding the Scheme stack.
5201 This is would typically be useful after a fork. The exit status
5202 is STATUS if supplied, otherwise zero.
5204 *** procedure: times
5205 Returns an object with information about real and processor time.
5206 The following procedures accept such an object as an argument and
5207 return a selected component:
5210 The current real time, expressed as time units relative to an
5214 The CPU time units used by the calling process.
5217 The CPU time units used by the system on behalf of the
5221 The CPU time units used by terminated child processes of the
5222 calling process, whose status has been collected (e.g., using
5226 Similarly, the CPU times units used by the system on behalf of
5227 terminated child processes.
5229 ** Removed: list-length
5230 ** Removed: list-append, list-append!
5231 ** Removed: list-reverse, list-reverse!
5233 ** array-map renamed to array-map!
5235 ** serial-array-map renamed to serial-array-map!
5237 ** catch doesn't take #f as first argument any longer
5239 Previously, it was possible to pass #f instead of a key to `catch'.
5240 That would cause `catch' to pass a jump buffer object to the procedure
5241 passed as second argument. The procedure could then use this jump
5242 buffer objekt as an argument to throw.
5244 This mechanism has been removed since its utility doesn't motivate the
5245 extra complexity it introduces.
5247 ** The `#/' notation for lists now provokes a warning message from Guile.
5248 This syntax will be removed from Guile in the near future.
5250 To disable the warning message, set the GUILE_HUSH environment
5251 variable to any non-empty value.
5253 ** The newline character now prints as `#\newline', following the
5254 normal Scheme notation, not `#\nl'.
5256 * Changes to the gh_ interface
5258 ** The gh_enter function now takes care of loading the Guile startup files.
5259 gh_enter works by calling scm_boot_guile; see the remarks below.
5261 ** Function: void gh_write (SCM x)
5263 Write the printed representation of the scheme object x to the current
5264 output port. Corresponds to the scheme level `write'.
5266 ** gh_list_length renamed to gh_length.
5268 ** vector handling routines
5270 Several major changes. In particular, gh_vector() now resembles
5271 (vector ...) (with a caveat -- see manual), and gh_make_vector() now
5272 exists and behaves like (make-vector ...). gh_vset() and gh_vref()
5273 have been renamed gh_vector_set_x() and gh_vector_ref(). Some missing
5274 vector-related gh_ functions have been implemented.
5276 ** pair and list routines
5278 Implemented several of the R4RS pair and list functions that were
5281 ** gh_scm2doubles, gh_doubles2scm, gh_doubles2dvect
5283 New function. Converts double arrays back and forth between Scheme
5286 * Changes to the scm_ interface
5288 ** The function scm_boot_guile now takes care of loading the startup files.
5290 Guile's primary initialization function, scm_boot_guile, now takes
5291 care of loading `boot-9.scm', in the `ice-9' module, to initialize
5292 Guile, define the module system, and put together some standard
5293 bindings. It also loads `init.scm', which is intended to hold
5294 site-specific initialization code.
5296 Since Guile cannot operate properly until boot-9.scm is loaded, there
5297 is no reason to separate loading boot-9.scm from Guile's other
5298 initialization processes.
5300 This job used to be done by scm_compile_shell_switches, which didn't
5301 make much sense; in particular, it meant that people using Guile for
5302 non-shell-like applications had to jump through hoops to get Guile
5303 initialized properly.
5305 ** The function scm_compile_shell_switches no longer loads the startup files.
5306 Now, Guile always loads the startup files, whenever it is initialized;
5307 see the notes above for scm_boot_guile and scm_load_startup_files.
5309 ** Function: scm_load_startup_files
5310 This new function takes care of loading Guile's initialization file
5311 (`boot-9.scm'), and the site initialization file, `init.scm'. Since
5312 this is always called by the Guile initialization process, it's
5313 probably not too useful to call this yourself, but it's there anyway.
5315 ** The semantics of smob marking have changed slightly.
5317 The smob marking function (the `mark' member of the scm_smobfuns
5318 structure) is no longer responsible for setting the mark bit on the
5319 smob. The generic smob handling code in the garbage collector will
5320 set this bit. The mark function need only ensure that any other
5321 objects the smob refers to get marked.
5323 Note that this change means that the smob's GC8MARK bit is typically
5324 already set upon entry to the mark function. Thus, marking functions
5325 which look like this:
5328 if (SCM_GC8MARKP (ptr))
5330 SCM_SETGC8MARK (ptr);
5331 ... mark objects to which the smob refers ...
5334 are now incorrect, since they will return early, and fail to mark any
5335 other objects the smob refers to. Some code in the Guile library used
5338 ** The semantics of the I/O port functions in scm_ptobfuns have changed.
5340 If you have implemented your own I/O port type, by writing the
5341 functions required by the scm_ptobfuns and then calling scm_newptob,
5342 you will need to change your functions slightly.
5344 The functions in a scm_ptobfuns structure now expect the port itself
5345 as their argument; they used to expect the `stream' member of the
5346 port's scm_port_table structure. This allows functions in an
5347 scm_ptobfuns structure to easily access the port's cell (and any flags
5348 it its CAR), and the port's scm_port_table structure.
5350 Guile now passes the I/O port itself as the `port' argument in the
5351 following scm_ptobfuns functions:
5353 int (*free) (SCM port);
5354 int (*fputc) (int, SCM port);
5355 int (*fputs) (char *, SCM port);
5356 scm_sizet (*fwrite) SCM_P ((char *ptr,
5360 int (*fflush) (SCM port);
5361 int (*fgetc) (SCM port);
5362 int (*fclose) (SCM port);
5364 The interfaces to the `mark', `print', `equalp', and `fgets' methods
5367 If you have existing code which defines its own port types, it is easy
5368 to convert your code to the new interface; simply apply SCM_STREAM to
5369 the port argument to yield the value you code used to expect.
5371 Note that since both the port and the stream have the same type in the
5372 C code --- they are both SCM values --- the C compiler will not remind
5373 you if you forget to update your scm_ptobfuns functions.
5376 ** Function: int scm_internal_select (int fds,
5380 struct timeval *timeout);
5382 This is a replacement for the `select' function provided by the OS.
5383 It enables I/O blocking and sleeping to happen for one cooperative
5384 thread without blocking other threads. It also avoids busy-loops in
5385 these situations. It is intended that all I/O blocking and sleeping
5386 will finally go through this function. Currently, this function is
5387 only available on systems providing `gettimeofday' and `select'.
5389 ** Function: SCM scm_internal_stack_catch (SCM tag,
5390 scm_catch_body_t body,
5392 scm_catch_handler_t handler,
5395 A new sibling to the other two C level `catch' functions
5396 scm_internal_catch and scm_internal_lazy_catch. Use it if you want
5397 the stack to be saved automatically into the variable `the-last-stack'
5398 (scm_the_last_stack_var) on error. This is necessary if you want to
5399 use advanced error reporting, such as calling scm_display_error and
5400 scm_display_backtrace. (They both take a stack object as argument.)
5402 ** Function: SCM scm_spawn_thread (scm_catch_body_t body,
5404 scm_catch_handler_t handler,
5407 Spawns a new thread. It does a job similar to
5408 scm_call_with_new_thread but takes arguments more suitable when
5409 spawning threads from application C code.
5411 ** The hook scm_error_callback has been removed. It was originally
5412 intended as a way for the user to install his own error handler. But
5413 that method works badly since it intervenes between throw and catch,
5414 thereby changing the semantics of expressions like (catch #t ...).
5415 The correct way to do it is to use one of the C level catch functions
5416 in throw.c: scm_internal_catch/lazy_catch/stack_catch.
5418 ** Removed functions:
5420 scm_obj_length, scm_list_length, scm_list_append, scm_list_append_x,
5421 scm_list_reverse, scm_list_reverse_x
5423 ** New macros: SCM_LISTn where n is one of the integers 0-9.
5425 These can be used for pretty list creation from C. The idea is taken
5426 from Erick Gallesio's STk.
5428 ** scm_array_map renamed to scm_array_map_x
5430 ** mbstrings are now removed
5432 This means that the type codes scm_tc7_mb_string and
5433 scm_tc7_mb_substring has been removed.
5435 ** scm_gen_putc, scm_gen_puts, scm_gen_write, and scm_gen_getc have changed.
5437 Since we no longer support multi-byte strings, these I/O functions
5438 have been simplified, and renamed. Here are their old names, and
5439 their new names and arguments:
5441 scm_gen_putc -> void scm_putc (int c, SCM port);
5442 scm_gen_puts -> void scm_puts (char *s, SCM port);
5443 scm_gen_write -> void scm_lfwrite (char *ptr, scm_sizet size, SCM port);
5444 scm_gen_getc -> void scm_getc (SCM port);
5447 ** The macros SCM_TYP7D and SCM_TYP7SD has been removed.
5449 ** The macro SCM_TYP7S has taken the role of the old SCM_TYP7D
5451 SCM_TYP7S now masks away the bit which distinguishes substrings from
5454 ** scm_catch_body_t: Backward incompatible change!
5456 Body functions to scm_internal_catch and friends do not any longer
5457 take a second argument. This is because it is no longer possible to
5458 pass a #f arg to catch.
5460 ** Calls to scm_protect_object and scm_unprotect now nest properly.
5462 The function scm_protect_object protects its argument from being freed
5463 by the garbage collector. scm_unprotect_object removes that
5466 These functions now nest properly. That is, for every object O, there
5467 is a counter which scm_protect_object(O) increments and
5468 scm_unprotect_object(O) decrements, if the counter is greater than
5469 zero. Every object's counter is zero when it is first created. If an
5470 object's counter is greater than zero, the garbage collector will not
5471 reclaim its storage.
5473 This allows you to use scm_protect_object in your code without
5474 worrying that some other function you call will call
5475 scm_unprotect_object, and allow it to be freed. Assuming that the
5476 functions you call are well-behaved, and unprotect only those objects
5477 they protect, you can follow the same rule and have confidence that
5478 objects will be freed only at appropriate times.
5481 Changes in Guile 1.2 (released Tuesday, June 24 1997):
5483 * Changes to the distribution
5485 ** Nightly snapshots are now available from ftp.red-bean.com.
5486 The old server, ftp.cyclic.com, has been relinquished to its rightful
5489 Nightly snapshots of the Guile development sources are now available via
5490 anonymous FTP from ftp.red-bean.com, as /pub/guile/guile-snap.tar.gz.
5492 Via the web, that's: ftp://ftp.red-bean.com/pub/guile/guile-snap.tar.gz
5493 For getit, that's: ftp.red-bean.com:/pub/guile/guile-snap.tar.gz
5495 ** To run Guile without installing it, the procedure has changed a bit.
5497 If you used a separate build directory to compile Guile, you'll need
5498 to include the build directory in SCHEME_LOAD_PATH, as well as the
5499 source directory. See the `INSTALL' file for examples.
5501 * Changes to the procedure for linking libguile with your programs
5503 ** The standard Guile load path for Scheme code now includes
5504 $(datadir)/guile (usually /usr/local/share/guile). This means that
5505 you can install your own Scheme files there, and Guile will find them.
5506 (Previous versions of Guile only checked a directory whose name
5507 contained the Guile version number, so you had to re-install or move
5508 your Scheme sources each time you installed a fresh version of Guile.)
5510 The load path also includes $(datadir)/guile/site; we recommend
5511 putting individual Scheme files there. If you want to install a
5512 package with multiple source files, create a directory for them under
5515 ** Guile 1.2 will now use the Rx regular expression library, if it is
5516 installed on your system. When you are linking libguile into your own
5517 programs, this means you will have to link against -lguile, -lqt (if
5518 you configured Guile with thread support), and -lrx.
5520 If you are using autoconf to generate configuration scripts for your
5521 application, the following lines should suffice to add the appropriate
5522 libraries to your link command:
5524 ### Find Rx, quickthreads and libguile.
5525 AC_CHECK_LIB(rx, main)
5526 AC_CHECK_LIB(qt, main)
5527 AC_CHECK_LIB(guile, scm_shell)
5529 The Guile 1.2 distribution does not contain sources for the Rx
5530 library, as Guile 1.0 did. If you want to use Rx, you'll need to
5531 retrieve it from a GNU FTP site and install it separately.
5533 * Changes to Scheme functions and syntax
5535 ** The dynamic linking features of Guile are now enabled by default.
5536 You can disable them by giving the `--disable-dynamic-linking' option
5539 (dynamic-link FILENAME)
5541 Find the object file denoted by FILENAME (a string) and link it
5542 into the running Guile application. When everything works out,
5543 return a Scheme object suitable for representing the linked object
5544 file. Otherwise an error is thrown. How object files are
5545 searched is system dependent.
5547 (dynamic-object? VAL)
5549 Determine whether VAL represents a dynamically linked object file.
5551 (dynamic-unlink DYNOBJ)
5553 Unlink the indicated object file from the application. DYNOBJ
5554 should be one of the values returned by `dynamic-link'.
5556 (dynamic-func FUNCTION DYNOBJ)
5558 Search the C function indicated by FUNCTION (a string or symbol)
5559 in DYNOBJ and return some Scheme object that can later be used
5560 with `dynamic-call' to actually call this function. Right now,
5561 these Scheme objects are formed by casting the address of the
5562 function to `long' and converting this number to its Scheme
5565 (dynamic-call FUNCTION DYNOBJ)
5567 Call the C function indicated by FUNCTION and DYNOBJ. The
5568 function is passed no arguments and its return value is ignored.
5569 When FUNCTION is something returned by `dynamic-func', call that
5570 function and ignore DYNOBJ. When FUNCTION is a string (or symbol,
5571 etc.), look it up in DYNOBJ; this is equivalent to
5573 (dynamic-call (dynamic-func FUNCTION DYNOBJ) #f)
5575 Interrupts are deferred while the C function is executing (with
5576 SCM_DEFER_INTS/SCM_ALLOW_INTS).
5578 (dynamic-args-call FUNCTION DYNOBJ ARGS)
5580 Call the C function indicated by FUNCTION and DYNOBJ, but pass it
5581 some arguments and return its return value. The C function is
5582 expected to take two arguments and return an `int', just like
5585 int c_func (int argc, char **argv);
5587 ARGS must be a list of strings and is converted into an array of
5588 `char *'. The array is passed in ARGV and its size in ARGC. The
5589 return value is converted to a Scheme number and returned from the
5590 call to `dynamic-args-call'.
5592 When dynamic linking is disabled or not supported on your system,
5593 the above functions throw errors, but they are still available.
5595 Here is a small example that works on GNU/Linux:
5597 (define libc-obj (dynamic-link "libc.so"))
5598 (dynamic-args-call 'rand libc-obj '())
5600 See the file `libguile/DYNAMIC-LINKING' for additional comments.
5602 ** The #/ syntax for module names is depreciated, and will be removed
5603 in a future version of Guile. Instead of
5611 The latter syntax is more consistent with existing Lisp practice.
5613 ** Guile now does fancier printing of structures. Structures are the
5614 underlying implementation for records, which in turn are used to
5615 implement modules, so all of these object now print differently and in
5616 a more informative way.
5618 The Scheme printer will examine the builtin variable *struct-printer*
5619 whenever it needs to print a structure object. When this variable is
5620 not `#f' it is deemed to be a procedure and will be applied to the
5621 structure object and the output port. When *struct-printer* is `#f'
5622 or the procedure return `#f' the structure object will be printed in
5623 the boring #<struct 80458270> form.
5625 This hook is used by some routines in ice-9/boot-9.scm to implement
5626 type specific printing routines. Please read the comments there about
5629 One of the more specific uses of structs are records. The printing
5630 procedure that could be passed to MAKE-RECORD-TYPE is now actually
5631 called. It should behave like a *struct-printer* procedure (described
5634 ** Guile now supports a new R4RS-compliant syntax for keywords. A
5635 token of the form #:NAME, where NAME has the same syntax as a Scheme
5636 symbol, is the external representation of the keyword named NAME.
5637 Keyword objects print using this syntax as well, so values containing
5638 keyword objects can be read back into Guile. When used in an
5639 expression, keywords are self-quoting objects.
5641 Guile suports this read syntax, and uses this print syntax, regardless
5642 of the current setting of the `keyword' read option. The `keyword'
5643 read option only controls whether Guile recognizes the `:NAME' syntax,
5644 which is incompatible with R4RS. (R4RS says such token represent
5647 ** Guile has regular expression support again. Guile 1.0 included
5648 functions for matching regular expressions, based on the Rx library.
5649 In Guile 1.1, the Guile/Rx interface was removed to simplify the
5650 distribution, and thus Guile had no regular expression support. Guile
5651 1.2 again supports the most commonly used functions, and supports all
5652 of SCSH's regular expression functions.
5654 If your system does not include a POSIX regular expression library,
5655 and you have not linked Guile with a third-party regexp library such as
5656 Rx, these functions will not be available. You can tell whether your
5657 Guile installation includes regular expression support by checking
5658 whether the `*features*' list includes the `regex' symbol.
5660 *** regexp functions
5662 By default, Guile supports POSIX extended regular expressions. That
5663 means that the characters `(', `)', `+' and `?' are special, and must
5664 be escaped if you wish to match the literal characters.
5666 This regular expression interface was modeled after that implemented
5667 by SCSH, the Scheme Shell. It is intended to be upwardly compatible
5668 with SCSH regular expressions.
5670 **** Function: string-match PATTERN STR [START]
5671 Compile the string PATTERN into a regular expression and compare
5672 it with STR. The optional numeric argument START specifies the
5673 position of STR at which to begin matching.
5675 `string-match' returns a "match structure" which describes what,
5676 if anything, was matched by the regular expression. *Note Match
5677 Structures::. If STR does not match PATTERN at all,
5678 `string-match' returns `#f'.
5680 Each time `string-match' is called, it must compile its PATTERN
5681 argument into a regular expression structure. This operation is
5682 expensive, which makes `string-match' inefficient if the same regular
5683 expression is used several times (for example, in a loop). For better
5684 performance, you can compile a regular expression in advance and then
5685 match strings against the compiled regexp.
5687 **** Function: make-regexp STR [FLAGS]
5688 Compile the regular expression described by STR, and return the
5689 compiled regexp structure. If STR does not describe a legal
5690 regular expression, `make-regexp' throws a
5691 `regular-expression-syntax' error.
5693 FLAGS may be the bitwise-or of one or more of the following:
5695 **** Constant: regexp/extended
5696 Use POSIX Extended Regular Expression syntax when interpreting
5697 STR. If not set, POSIX Basic Regular Expression syntax is used.
5698 If the FLAGS argument is omitted, we assume regexp/extended.
5700 **** Constant: regexp/icase
5701 Do not differentiate case. Subsequent searches using the
5702 returned regular expression will be case insensitive.
5704 **** Constant: regexp/newline
5705 Match-any-character operators don't match a newline.
5707 A non-matching list ([^...]) not containing a newline matches a
5710 Match-beginning-of-line operator (^) matches the empty string
5711 immediately after a newline, regardless of whether the FLAGS
5712 passed to regexp-exec contain regexp/notbol.
5714 Match-end-of-line operator ($) matches the empty string
5715 immediately before a newline, regardless of whether the FLAGS
5716 passed to regexp-exec contain regexp/noteol.
5718 **** Function: regexp-exec REGEXP STR [START [FLAGS]]
5719 Match the compiled regular expression REGEXP against `str'. If
5720 the optional integer START argument is provided, begin matching
5721 from that position in the string. Return a match structure
5722 describing the results of the match, or `#f' if no match could be
5725 FLAGS may be the bitwise-or of one or more of the following:
5727 **** Constant: regexp/notbol
5728 The match-beginning-of-line operator always fails to match (but
5729 see the compilation flag regexp/newline above) This flag may be
5730 used when different portions of a string are passed to
5731 regexp-exec and the beginning of the string should not be
5732 interpreted as the beginning of the line.
5734 **** Constant: regexp/noteol
5735 The match-end-of-line operator always fails to match (but see the
5736 compilation flag regexp/newline above)
5738 **** Function: regexp? OBJ
5739 Return `#t' if OBJ is a compiled regular expression, or `#f'
5742 Regular expressions are commonly used to find patterns in one string
5743 and replace them with the contents of another string.
5745 **** Function: regexp-substitute PORT MATCH [ITEM...]
5746 Write to the output port PORT selected contents of the match
5747 structure MATCH. Each ITEM specifies what should be written, and
5748 may be one of the following arguments:
5750 * A string. String arguments are written out verbatim.
5752 * An integer. The submatch with that number is written.
5754 * The symbol `pre'. The portion of the matched string preceding
5755 the regexp match is written.
5757 * The symbol `post'. The portion of the matched string
5758 following the regexp match is written.
5760 PORT may be `#f', in which case nothing is written; instead,
5761 `regexp-substitute' constructs a string from the specified ITEMs
5764 **** Function: regexp-substitute/global PORT REGEXP TARGET [ITEM...]
5765 Similar to `regexp-substitute', but can be used to perform global
5766 substitutions on STR. Instead of taking a match structure as an
5767 argument, `regexp-substitute/global' takes two string arguments: a
5768 REGEXP string describing a regular expression, and a TARGET string
5769 which should be matched against this regular expression.
5771 Each ITEM behaves as in REGEXP-SUBSTITUTE, with the following
5774 * A function may be supplied. When this function is called, it
5775 will be passed one argument: a match structure for a given
5776 regular expression match. It should return a string to be
5777 written out to PORT.
5779 * The `post' symbol causes `regexp-substitute/global' to recurse
5780 on the unmatched portion of STR. This *must* be supplied in
5781 order to perform global search-and-replace on STR; if it is
5782 not present among the ITEMs, then `regexp-substitute/global'
5783 will return after processing a single match.
5785 *** Match Structures
5787 A "match structure" is the object returned by `string-match' and
5788 `regexp-exec'. It describes which portion of a string, if any, matched
5789 the given regular expression. Match structures include: a reference to
5790 the string that was checked for matches; the starting and ending
5791 positions of the regexp match; and, if the regexp included any
5792 parenthesized subexpressions, the starting and ending positions of each
5795 In each of the regexp match functions described below, the `match'
5796 argument must be a match structure returned by a previous call to
5797 `string-match' or `regexp-exec'. Most of these functions return some
5798 information about the original target string that was matched against a
5799 regular expression; we will call that string TARGET for easy reference.
5801 **** Function: regexp-match? OBJ
5802 Return `#t' if OBJ is a match structure returned by a previous
5803 call to `regexp-exec', or `#f' otherwise.
5805 **** Function: match:substring MATCH [N]
5806 Return the portion of TARGET matched by subexpression number N.
5807 Submatch 0 (the default) represents the entire regexp match. If
5808 the regular expression as a whole matched, but the subexpression
5809 number N did not match, return `#f'.
5811 **** Function: match:start MATCH [N]
5812 Return the starting position of submatch number N.
5814 **** Function: match:end MATCH [N]
5815 Return the ending position of submatch number N.
5817 **** Function: match:prefix MATCH
5818 Return the unmatched portion of TARGET preceding the regexp match.
5820 **** Function: match:suffix MATCH
5821 Return the unmatched portion of TARGET following the regexp match.
5823 **** Function: match:count MATCH
5824 Return the number of parenthesized subexpressions from MATCH.
5825 Note that the entire regular expression match itself counts as a
5826 subexpression, and failed submatches are included in the count.
5828 **** Function: match:string MATCH
5829 Return the original TARGET string.
5831 *** Backslash Escapes
5833 Sometimes you will want a regexp to match characters like `*' or `$'
5834 exactly. For example, to check whether a particular string represents
5835 a menu entry from an Info node, it would be useful to match it against
5836 a regexp like `^* [^:]*::'. However, this won't work; because the
5837 asterisk is a metacharacter, it won't match the `*' at the beginning of
5838 the string. In this case, we want to make the first asterisk un-magic.
5840 You can do this by preceding the metacharacter with a backslash
5841 character `\'. (This is also called "quoting" the metacharacter, and
5842 is known as a "backslash escape".) When Guile sees a backslash in a
5843 regular expression, it considers the following glyph to be an ordinary
5844 character, no matter what special meaning it would ordinarily have.
5845 Therefore, we can make the above example work by changing the regexp to
5846 `^\* [^:]*::'. The `\*' sequence tells the regular expression engine
5847 to match only a single asterisk in the target string.
5849 Since the backslash is itself a metacharacter, you may force a
5850 regexp to match a backslash in the target string by preceding the
5851 backslash with itself. For example, to find variable references in a
5852 TeX program, you might want to find occurrences of the string `\let\'
5853 followed by any number of alphabetic characters. The regular expression
5854 `\\let\\[A-Za-z]*' would do this: the double backslashes in the regexp
5855 each match a single backslash in the target string.
5857 **** Function: regexp-quote STR
5858 Quote each special character found in STR with a backslash, and
5859 return the resulting string.
5861 *Very important:* Using backslash escapes in Guile source code (as
5862 in Emacs Lisp or C) can be tricky, because the backslash character has
5863 special meaning for the Guile reader. For example, if Guile encounters
5864 the character sequence `\n' in the middle of a string while processing
5865 Scheme code, it replaces those characters with a newline character.
5866 Similarly, the character sequence `\t' is replaced by a horizontal tab.
5867 Several of these "escape sequences" are processed by the Guile reader
5868 before your code is executed. Unrecognized escape sequences are
5869 ignored: if the characters `\*' appear in a string, they will be
5870 translated to the single character `*'.
5872 This translation is obviously undesirable for regular expressions,
5873 since we want to be able to include backslashes in a string in order to
5874 escape regexp metacharacters. Therefore, to make sure that a backslash
5875 is preserved in a string in your Guile program, you must use *two*
5876 consecutive backslashes:
5878 (define Info-menu-entry-pattern (make-regexp "^\\* [^:]*"))
5880 The string in this example is preprocessed by the Guile reader before
5881 any code is executed. The resulting argument to `make-regexp' is the
5882 string `^\* [^:]*', which is what we really want.
5884 This also means that in order to write a regular expression that
5885 matches a single backslash character, the regular expression string in
5886 the source code must include *four* backslashes. Each consecutive pair
5887 of backslashes gets translated by the Guile reader to a single
5888 backslash, and the resulting double-backslash is interpreted by the
5889 regexp engine as matching a single backslash character. Hence:
5891 (define tex-variable-pattern (make-regexp "\\\\let\\\\=[A-Za-z]*"))
5893 The reason for the unwieldiness of this syntax is historical. Both
5894 regular expression pattern matchers and Unix string processing systems
5895 have traditionally used backslashes with the special meanings described
5896 above. The POSIX regular expression specification and ANSI C standard
5897 both require these semantics. Attempting to abandon either convention
5898 would cause other kinds of compatibility problems, possibly more severe
5899 ones. Therefore, without extending the Scheme reader to support
5900 strings with different quoting conventions (an ungainly and confusing
5901 extension when implemented in other languages), we must adhere to this
5902 cumbersome escape syntax.
5904 * Changes to the gh_ interface
5906 * Changes to the scm_ interface
5908 * Changes to system call interfaces:
5910 ** The value returned by `raise' is now unspecified. It throws an exception
5913 *** A new procedure `sigaction' can be used to install signal handlers
5915 (sigaction signum [action] [flags])
5917 signum is the signal number, which can be specified using the value
5920 If action is omitted, sigaction returns a pair: the CAR is the current
5921 signal hander, which will be either an integer with the value SIG_DFL
5922 (default action) or SIG_IGN (ignore), or the Scheme procedure which
5923 handles the signal, or #f if a non-Scheme procedure handles the
5924 signal. The CDR contains the current sigaction flags for the handler.
5926 If action is provided, it is installed as the new handler for signum.
5927 action can be a Scheme procedure taking one argument, or the value of
5928 SIG_DFL (default action) or SIG_IGN (ignore), or #f to restore
5929 whatever signal handler was installed before sigaction was first used.
5930 Flags can optionally be specified for the new handler (SA_RESTART is
5931 always used if the system provides it, so need not be specified.) The
5932 return value is a pair with information about the old handler as
5935 This interface does not provide access to the "signal blocking"
5936 facility. Maybe this is not needed, since the thread support may
5937 provide solutions to the problem of consistent access to data
5940 *** A new procedure `flush-all-ports' is equivalent to running
5941 `force-output' on every port open for output.
5943 ** Guile now provides information on how it was built, via the new
5944 global variable, %guile-build-info. This variable records the values
5945 of the standard GNU makefile directory variables as an assocation
5946 list, mapping variable names (symbols) onto directory paths (strings).
5947 For example, to find out where the Guile link libraries were
5948 installed, you can say:
5950 guile -c "(display (assq-ref %guile-build-info 'libdir)) (newline)"
5953 * Changes to the scm_ interface
5955 ** The new function scm_handle_by_message_noexit is just like the
5956 existing scm_handle_by_message function, except that it doesn't call
5957 exit to terminate the process. Instead, it prints a message and just
5958 returns #f. This might be a more appropriate catch-all handler for
5959 new dynamic roots and threads.
5962 Changes in Guile 1.1 (released Friday, May 16 1997):
5964 * Changes to the distribution.
5966 The Guile 1.0 distribution has been split up into several smaller
5968 guile-core --- the Guile interpreter itself.
5969 guile-tcltk --- the interface between the Guile interpreter and
5970 Tcl/Tk; Tcl is an interpreter for a stringy language, and Tk
5971 is a toolkit for building graphical user interfaces.
5972 guile-rgx-ctax --- the interface between Guile and the Rx regular
5973 expression matcher, and the translator for the Ctax
5974 programming language. These are packaged together because the
5975 Ctax translator uses Rx to parse Ctax source code.
5977 This NEWS file describes the changes made to guile-core since the 1.0
5980 We no longer distribute the documentation, since it was either out of
5981 date, or incomplete. As soon as we have current documentation, we
5986 * Changes to the stand-alone interpreter
5988 ** guile now accepts command-line arguments compatible with SCSH, Olin
5989 Shivers' Scheme Shell.
5991 In general, arguments are evaluated from left to right, but there are
5992 exceptions. The following switches stop argument processing, and
5993 stash all remaining command-line arguments as the value returned by
5994 the (command-line) function.
5995 -s SCRIPT load Scheme source code from FILE, and exit
5996 -c EXPR evalute Scheme expression EXPR, and exit
5997 -- stop scanning arguments; run interactively
5999 The switches below are processed as they are encountered.
6000 -l FILE load Scheme source code from FILE
6001 -e FUNCTION after reading script, apply FUNCTION to
6002 command line arguments
6003 -ds do -s script at this point
6004 --emacs enable Emacs protocol (experimental)
6005 -h, --help display this help and exit
6006 -v, --version display version information and exit
6007 \ read arguments from following script lines
6009 So, for example, here is a Guile script named `ekko' (thanks, Olin)
6010 which re-implements the traditional "echo" command:
6012 #!/usr/local/bin/guile -s
6015 (map (lambda (arg) (display arg) (display " "))
6019 (main (command-line))
6021 Suppose we invoke this script as follows:
6023 ekko a speckled gecko
6025 Through the magic of Unix script processing (triggered by the `#!'
6026 token at the top of the file), /usr/local/bin/guile receives the
6027 following list of command-line arguments:
6029 ("-s" "./ekko" "a" "speckled" "gecko")
6031 Unix inserts the name of the script after the argument specified on
6032 the first line of the file (in this case, "-s"), and then follows that
6033 with the arguments given to the script. Guile loads the script, which
6034 defines the `main' function, and then applies it to the list of
6035 remaining command-line arguments, ("a" "speckled" "gecko").
6037 In Unix, the first line of a script file must take the following form:
6039 #!INTERPRETER ARGUMENT
6041 where INTERPRETER is the absolute filename of the interpreter
6042 executable, and ARGUMENT is a single command-line argument to pass to
6045 You may only pass one argument to the interpreter, and its length is
6046 limited. These restrictions can be annoying to work around, so Guile
6047 provides a general mechanism (borrowed from, and compatible with,
6048 SCSH) for circumventing them.
6050 If the ARGUMENT in a Guile script is a single backslash character,
6051 `\', Guile will open the script file, parse arguments from its second
6052 and subsequent lines, and replace the `\' with them. So, for example,
6053 here is another implementation of the `ekko' script:
6055 #!/usr/local/bin/guile \
6059 (for-each (lambda (arg) (display arg) (display " "))
6063 If the user invokes this script as follows:
6065 ekko a speckled gecko
6067 Unix expands this into
6069 /usr/local/bin/guile \ ekko a speckled gecko
6071 When Guile sees the `\' argument, it replaces it with the arguments
6072 read from the second line of the script, producing:
6074 /usr/local/bin/guile -e main -s ekko a speckled gecko
6076 This tells Guile to load the `ekko' script, and apply the function
6077 `main' to the argument list ("a" "speckled" "gecko").
6079 Here is how Guile parses the command-line arguments:
6080 - Each space character terminates an argument. This means that two
6081 spaces in a row introduce an empty-string argument.
6082 - The tab character is not permitted (unless you quote it with the
6083 backslash character, as described below), to avoid confusion.
6084 - The newline character terminates the sequence of arguments, and will
6085 also terminate a final non-empty argument. (However, a newline
6086 following a space will not introduce a final empty-string argument;
6087 it only terminates the argument list.)
6088 - The backslash character is the escape character. It escapes
6089 backslash, space, tab, and newline. The ANSI C escape sequences
6090 like \n and \t are also supported. These produce argument
6091 constituents; the two-character combination \n doesn't act like a
6092 terminating newline. The escape sequence \NNN for exactly three
6093 octal digits reads as the character whose ASCII code is NNN. As
6094 above, characters produced this way are argument constituents.
6095 Backslash followed by other characters is not allowed.
6097 * Changes to the procedure for linking libguile with your programs
6099 ** Guile now builds and installs a shared guile library, if your
6100 system support shared libraries. (It still builds a static library on
6101 all systems.) Guile automatically detects whether your system
6102 supports shared libraries. To prevent Guile from buildisg shared
6103 libraries, pass the `--disable-shared' flag to the configure script.
6105 Guile takes longer to compile when it builds shared libraries, because
6106 it must compile every file twice --- once to produce position-
6107 independent object code, and once to produce normal object code.
6109 ** The libthreads library has been merged into libguile.
6111 To link a program against Guile, you now need only link against
6112 -lguile and -lqt; -lthreads is no longer needed. If you are using
6113 autoconf to generate configuration scripts for your application, the
6114 following lines should suffice to add the appropriate libraries to
6117 ### Find quickthreads and libguile.
6118 AC_CHECK_LIB(qt, main)
6119 AC_CHECK_LIB(guile, scm_shell)
6121 * Changes to Scheme functions
6123 ** Guile Scheme's special syntax for keyword objects is now optional,
6124 and disabled by default.
6126 The syntax variation from R4RS made it difficult to port some
6127 interesting packages to Guile. The routines which accepted keyword
6128 arguments (mostly in the module system) have been modified to also
6129 accept symbols whose names begin with `:'.
6131 To change the keyword syntax, you must first import the (ice-9 debug)
6133 (use-modules (ice-9 debug))
6135 Then you can enable the keyword syntax as follows:
6136 (read-set! keywords 'prefix)
6138 To disable keyword syntax, do this:
6139 (read-set! keywords #f)
6141 ** Many more primitive functions accept shared substrings as
6142 arguments. In the past, these functions required normal, mutable
6143 strings as arguments, although they never made use of this
6146 ** The uniform array functions now operate on byte vectors. These
6147 functions are `array-fill!', `serial-array-copy!', `array-copy!',
6148 `serial-array-map', `array-map', `array-for-each', and
6151 ** The new functions `trace' and `untrace' implement simple debugging
6152 support for Scheme functions.
6154 The `trace' function accepts any number of procedures as arguments,
6155 and tells the Guile interpreter to display each procedure's name and
6156 arguments each time the procedure is invoked. When invoked with no
6157 arguments, `trace' returns the list of procedures currently being
6160 The `untrace' function accepts any number of procedures as arguments,
6161 and tells the Guile interpreter not to trace them any more. When
6162 invoked with no arguments, `untrace' untraces all curretly traced
6165 The tracing in Guile has an advantage over most other systems: we
6166 don't create new procedure objects, but mark the procedure objects
6167 themselves. This means that anonymous and internal procedures can be
6170 ** The function `assert-repl-prompt' has been renamed to
6171 `set-repl-prompt!'. It takes one argument, PROMPT.
6172 - If PROMPT is #f, the Guile read-eval-print loop will not prompt.
6173 - If PROMPT is a string, we use it as a prompt.
6174 - If PROMPT is a procedure accepting no arguments, we call it, and
6175 display the result as a prompt.
6176 - Otherwise, we display "> ".
6178 ** The new function `eval-string' reads Scheme expressions from a
6179 string and evaluates them, returning the value of the last expression
6180 in the string. If the string contains no expressions, it returns an
6183 ** The new function `thunk?' returns true iff its argument is a
6184 procedure of zero arguments.
6186 ** `defined?' is now a builtin function, instead of syntax. This
6187 means that its argument should be quoted. It returns #t iff its
6188 argument is bound in the current module.
6190 ** The new syntax `use-modules' allows you to add new modules to your
6191 environment without re-typing a complete `define-module' form. It
6192 accepts any number of module names as arguments, and imports their
6193 public bindings into the current module.
6195 ** The new function (module-defined? NAME MODULE) returns true iff
6196 NAME, a symbol, is defined in MODULE, a module object.
6198 ** The new function `builtin-bindings' creates and returns a hash
6199 table containing copies of all the root module's bindings.
6201 ** The new function `builtin-weak-bindings' does the same as
6202 `builtin-bindings', but creates a doubly-weak hash table.
6204 ** The `equal?' function now considers variable objects to be
6205 equivalent if they have the same name and the same value.
6207 ** The new function `command-line' returns the command-line arguments
6208 given to Guile, as a list of strings.
6210 When using guile as a script interpreter, `command-line' returns the
6211 script's arguments; those processed by the interpreter (like `-s' or
6212 `-c') are omitted. (In other words, you get the normal, expected
6213 behavior.) Any application that uses scm_shell to process its
6214 command-line arguments gets this behavior as well.
6216 ** The new function `load-user-init' looks for a file called `.guile'
6217 in the user's home directory, and loads it if it exists. This is
6218 mostly for use by the code generated by scm_compile_shell_switches,
6219 but we thought it might also be useful in other circumstances.
6221 ** The new function `log10' returns the base-10 logarithm of its
6224 ** Changes to I/O functions
6226 *** The functions `read', `primitive-load', `read-and-eval!', and
6227 `primitive-load-path' no longer take optional arguments controlling
6228 case insensitivity and a `#' parser.
6230 Case sensitivity is now controlled by a read option called
6231 `case-insensitive'. The user can add new `#' syntaxes with the
6232 `read-hash-extend' function (see below).
6234 *** The new function `read-hash-extend' allows the user to change the
6235 syntax of Guile Scheme in a somewhat controlled way.
6237 (read-hash-extend CHAR PROC)
6238 When parsing S-expressions, if we read a `#' character followed by
6239 the character CHAR, use PROC to parse an object from the stream.
6240 If PROC is #f, remove any parsing procedure registered for CHAR.
6242 The reader applies PROC to two arguments: CHAR and an input port.
6244 *** The new functions read-delimited and read-delimited! provide a
6245 general mechanism for doing delimited input on streams.
6247 (read-delimited DELIMS [PORT HANDLE-DELIM])
6248 Read until we encounter one of the characters in DELIMS (a string),
6249 or end-of-file. PORT is the input port to read from; it defaults to
6250 the current input port. The HANDLE-DELIM parameter determines how
6251 the terminating character is handled; it should be one of the
6254 'trim omit delimiter from result
6255 'peek leave delimiter character in input stream
6256 'concat append delimiter character to returned value
6257 'split return a pair: (RESULT . TERMINATOR)
6259 HANDLE-DELIM defaults to 'peek.
6261 (read-delimited! DELIMS BUF [PORT HANDLE-DELIM START END])
6262 A side-effecting variant of `read-delimited'.
6264 The data is written into the string BUF at the indices in the
6265 half-open interval [START, END); the default interval is the whole
6266 string: START = 0 and END = (string-length BUF). The values of
6267 START and END must specify a well-defined interval in BUF, i.e.
6268 0 <= START <= END <= (string-length BUF).
6270 It returns NBYTES, the number of bytes read. If the buffer filled
6271 up without a delimiter character being found, it returns #f. If the
6272 port is at EOF when the read starts, it returns the EOF object.
6274 If an integer is returned (i.e., the read is successfully terminated
6275 by reading a delimiter character), then the HANDLE-DELIM parameter
6276 determines how to handle the terminating character. It is described
6277 above, and defaults to 'peek.
6279 (The descriptions of these functions were borrowed from the SCSH
6280 manual, by Olin Shivers and Brian Carlstrom.)
6282 *** The `%read-delimited!' function is the primitive used to implement
6283 `read-delimited' and `read-delimited!'.
6285 (%read-delimited! DELIMS BUF GOBBLE? [PORT START END])
6287 This returns a pair of values: (TERMINATOR . NUM-READ).
6288 - TERMINATOR describes why the read was terminated. If it is a
6289 character or the eof object, then that is the value that terminated
6290 the read. If it is #f, the function filled the buffer without finding
6291 a delimiting character.
6292 - NUM-READ is the number of characters read into BUF.
6294 If the read is successfully terminated by reading a delimiter
6295 character, then the gobble? parameter determines what to do with the
6296 terminating character. If true, the character is removed from the
6297 input stream; if false, the character is left in the input stream
6298 where a subsequent read operation will retrieve it. In either case,
6299 the character is also the first value returned by the procedure call.
6301 (The descriptions of this function was borrowed from the SCSH manual,
6302 by Olin Shivers and Brian Carlstrom.)
6304 *** The `read-line' and `read-line!' functions have changed; they now
6305 trim the terminator by default; previously they appended it to the
6306 returned string. For the old behavior, use (read-line PORT 'concat).
6308 *** The functions `uniform-array-read!' and `uniform-array-write!' now
6309 take new optional START and END arguments, specifying the region of
6310 the array to read and write.
6312 *** The `ungetc-char-ready?' function has been removed. We feel it's
6313 inappropriate for an interface to expose implementation details this
6316 ** Changes to the Unix library and system call interface
6318 *** The new fcntl function provides access to the Unix `fcntl' system
6321 (fcntl PORT COMMAND VALUE)
6322 Apply COMMAND to PORT's file descriptor, with VALUE as an argument.
6323 Values for COMMAND are:
6325 F_DUPFD duplicate a file descriptor
6326 F_GETFD read the descriptor's close-on-exec flag
6327 F_SETFD set the descriptor's close-on-exec flag to VALUE
6328 F_GETFL read the descriptor's flags, as set on open
6329 F_SETFL set the descriptor's flags, as set on open to VALUE
6330 F_GETOWN return the process ID of a socket's owner, for SIGIO
6331 F_SETOWN set the process that owns a socket to VALUE, for SIGIO
6332 FD_CLOEXEC not sure what this is
6334 For details, see the documentation for the fcntl system call.
6336 *** The arguments to `select' have changed, for compatibility with
6337 SCSH. The TIMEOUT parameter may now be non-integral, yielding the
6338 expected behavior. The MILLISECONDS parameter has been changed to
6339 MICROSECONDS, to more closely resemble the underlying system call.
6340 The RVEC, WVEC, and EVEC arguments can now be vectors; the type of the
6341 corresponding return set will be the same.
6343 *** The arguments to the `mknod' system call have changed. They are
6346 (mknod PATH TYPE PERMS DEV)
6347 Create a new file (`node') in the file system. PATH is the name of
6348 the file to create. TYPE is the kind of file to create; it should
6349 be 'fifo, 'block-special, or 'char-special. PERMS specifies the
6350 permission bits to give the newly created file. If TYPE is
6351 'block-special or 'char-special, DEV specifies which device the
6352 special file refers to; its interpretation depends on the kind of
6353 special file being created.
6355 *** The `fork' function has been renamed to `primitive-fork', to avoid
6356 clashing with various SCSH forks.
6358 *** The `recv' and `recvfrom' functions have been renamed to `recv!'
6359 and `recvfrom!'. They no longer accept a size for a second argument;
6360 you must pass a string to hold the received value. They no longer
6361 return the buffer. Instead, `recv' returns the length of the message
6362 received, and `recvfrom' returns a pair containing the packet's length
6363 and originating address.
6365 *** The file descriptor datatype has been removed, as have the
6366 `read-fd', `write-fd', `close', `lseek', and `dup' functions.
6367 We plan to replace these functions with a SCSH-compatible interface.
6369 *** The `create' function has been removed; it's just a special case
6372 *** There are new functions to break down process termination status
6373 values. In the descriptions below, STATUS is a value returned by
6376 (status:exit-val STATUS)
6377 If the child process exited normally, this function returns the exit
6378 code for the child process (i.e., the value passed to exit, or
6379 returned from main). If the child process did not exit normally,
6380 this function returns #f.
6382 (status:stop-sig STATUS)
6383 If the child process was suspended by a signal, this function
6384 returns the signal that suspended the child. Otherwise, it returns
6387 (status:term-sig STATUS)
6388 If the child process terminated abnormally, this function returns
6389 the signal that terminated the child. Otherwise, this function
6392 POSIX promises that exactly one of these functions will return true on
6393 a valid STATUS value.
6395 These functions are compatible with SCSH.
6397 *** There are new accessors and setters for the broken-out time vectors
6398 returned by `localtime', `gmtime', and that ilk. They are:
6400 Component Accessor Setter
6401 ========================= ============ ============
6402 seconds tm:sec set-tm:sec
6403 minutes tm:min set-tm:min
6404 hours tm:hour set-tm:hour
6405 day of the month tm:mday set-tm:mday
6406 month tm:mon set-tm:mon
6407 year tm:year set-tm:year
6408 day of the week tm:wday set-tm:wday
6409 day in the year tm:yday set-tm:yday
6410 daylight saving time tm:isdst set-tm:isdst
6411 GMT offset, seconds tm:gmtoff set-tm:gmtoff
6412 name of time zone tm:zone set-tm:zone
6414 *** There are new accessors for the vectors returned by `uname',
6415 describing the host system:
6418 ============================================== ================
6419 name of the operating system implementation utsname:sysname
6420 network name of this machine utsname:nodename
6421 release level of the operating system utsname:release
6422 version level of the operating system utsname:version
6423 machine hardware platform utsname:machine
6425 *** There are new accessors for the vectors returned by `getpw',
6426 `getpwnam', `getpwuid', and `getpwent', describing entries from the
6427 system's user database:
6430 ====================== =================
6431 user name passwd:name
6432 user password passwd:passwd
6435 real name passwd:gecos
6436 home directory passwd:dir
6437 shell program passwd:shell
6439 *** There are new accessors for the vectors returned by `getgr',
6440 `getgrnam', `getgrgid', and `getgrent', describing entries from the
6441 system's group database:
6444 ======================= ============
6445 group name group:name
6446 group password group:passwd
6448 group members group:mem
6450 *** There are new accessors for the vectors returned by `gethost',
6451 `gethostbyaddr', `gethostbyname', and `gethostent', describing
6455 ========================= ===============
6456 official name of host hostent:name
6457 alias list hostent:aliases
6458 host address type hostent:addrtype
6459 length of address hostent:length
6460 list of addresses hostent:addr-list
6462 *** There are new accessors for the vectors returned by `getnet',
6463 `getnetbyaddr', `getnetbyname', and `getnetent', describing internet
6467 ========================= ===============
6468 official name of net netent:name
6469 alias list netent:aliases
6470 net number type netent:addrtype
6471 net number netent:net
6473 *** There are new accessors for the vectors returned by `getproto',
6474 `getprotobyname', `getprotobynumber', and `getprotoent', describing
6478 ========================= ===============
6479 official protocol name protoent:name
6480 alias list protoent:aliases
6481 protocol number protoent:proto
6483 *** There are new accessors for the vectors returned by `getserv',
6484 `getservbyname', `getservbyport', and `getservent', describing
6488 ========================= ===============
6489 official service name servent:name
6490 alias list servent:aliases
6491 port number servent:port
6492 protocol to use servent:proto
6494 *** There are new accessors for the sockaddr structures returned by
6495 `accept', `getsockname', `getpeername', `recvfrom!':
6498 ======================================== ===============
6499 address format (`family') sockaddr:fam
6500 path, for file domain addresses sockaddr:path
6501 address, for internet domain addresses sockaddr:addr
6502 TCP or UDP port, for internet sockaddr:port
6504 *** The `getpwent', `getgrent', `gethostent', `getnetent',
6505 `getprotoent', and `getservent' functions now return #f at the end of
6506 the user database. (They used to throw an exception.)
6508 Note that calling MUMBLEent function is equivalent to calling the
6509 corresponding MUMBLE function with no arguments.
6511 *** The `setpwent', `setgrent', `sethostent', `setnetent',
6512 `setprotoent', and `setservent' routines now take no arguments.
6514 *** The `gethost', `getproto', `getnet', and `getserv' functions now
6515 provide more useful information when they throw an exception.
6517 *** The `lnaof' function has been renamed to `inet-lnaof'.
6519 *** Guile now claims to have the `current-time' feature.
6521 *** The `mktime' function now takes an optional second argument ZONE,
6522 giving the time zone to use for the conversion. ZONE should be a
6523 string, in the same format as expected for the "TZ" environment variable.
6525 *** The `strptime' function now returns a pair (TIME . COUNT), where
6526 TIME is the parsed time as a vector, and COUNT is the number of
6527 characters from the string left unparsed. This function used to
6528 return the remaining characters as a string.
6530 *** The `gettimeofday' function has replaced the old `time+ticks' function.
6531 The return value is now (SECONDS . MICROSECONDS); the fractional
6532 component is no longer expressed in "ticks".
6534 *** The `ticks/sec' constant has been removed, in light of the above change.
6536 * Changes to the gh_ interface
6538 ** gh_eval_str() now returns an SCM object which is the result of the
6541 ** gh_scm2str() now copies the Scheme data to a caller-provided C
6544 ** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
6545 and returns the array
6547 ** gh_scm2str0() is gone: there is no need to distinguish
6548 null-terminated from non-null-terminated, since gh_scm2newstr() allows
6549 the user to interpret the data both ways.
6551 * Changes to the scm_ interface
6553 ** The new function scm_symbol_value0 provides an easy way to get a
6554 symbol's value from C code:
6556 SCM scm_symbol_value0 (char *NAME)
6557 Return the value of the symbol named by the null-terminated string
6558 NAME in the current module. If the symbol named NAME is unbound in
6559 the current module, return SCM_UNDEFINED.
6561 ** The new function scm_sysintern0 creates new top-level variables,
6562 without assigning them a value.
6564 SCM scm_sysintern0 (char *NAME)
6565 Create a new Scheme top-level variable named NAME. NAME is a
6566 null-terminated string. Return the variable's value cell.
6568 ** The function scm_internal_catch is the guts of catch. It handles
6569 all the mechanics of setting up a catch target, invoking the catch
6570 body, and perhaps invoking the handler if the body does a throw.
6572 The function is designed to be usable from C code, but is general
6573 enough to implement all the semantics Guile Scheme expects from throw.
6575 TAG is the catch tag. Typically, this is a symbol, but this function
6576 doesn't actually care about that.
6578 BODY is a pointer to a C function which runs the body of the catch;
6579 this is the code you can throw from. We call it like this:
6580 BODY (BODY_DATA, JMPBUF)
6582 BODY_DATA is just the BODY_DATA argument we received; we pass it
6583 through to BODY as its first argument. The caller can make
6584 BODY_DATA point to anything useful that BODY might need.
6585 JMPBUF is the Scheme jmpbuf object corresponding to this catch,
6586 which we have just created and initialized.
6588 HANDLER is a pointer to a C function to deal with a throw to TAG,
6589 should one occur. We call it like this:
6590 HANDLER (HANDLER_DATA, THROWN_TAG, THROW_ARGS)
6592 HANDLER_DATA is the HANDLER_DATA argument we recevied; it's the
6593 same idea as BODY_DATA above.
6594 THROWN_TAG is the tag that the user threw to; usually this is
6595 TAG, but it could be something else if TAG was #t (i.e., a
6596 catch-all), or the user threw to a jmpbuf.
6597 THROW_ARGS is the list of arguments the user passed to the THROW
6600 BODY_DATA is just a pointer we pass through to BODY. HANDLER_DATA
6601 is just a pointer we pass through to HANDLER. We don't actually
6602 use either of those pointers otherwise ourselves. The idea is
6603 that, if our caller wants to communicate something to BODY or
6604 HANDLER, it can pass a pointer to it as MUMBLE_DATA, which BODY and
6605 HANDLER can then use. Think of it as a way to make BODY and
6606 HANDLER closures, not just functions; MUMBLE_DATA points to the
6609 Of course, it's up to the caller to make sure that any data a
6610 MUMBLE_DATA needs is protected from GC. A common way to do this is
6611 to make MUMBLE_DATA a pointer to data stored in an automatic
6612 structure variable; since the collector must scan the stack for
6613 references anyway, this assures that any references in MUMBLE_DATA
6616 ** The new function scm_internal_lazy_catch is exactly like
6617 scm_internal_catch, except:
6619 - It does not unwind the stack (this is the major difference).
6620 - If handler returns, its value is returned from the throw.
6621 - BODY always receives #f as its JMPBUF argument (since there's no
6622 jmpbuf associated with a lazy catch, because we don't unwind the
6625 ** scm_body_thunk is a new body function you can pass to
6626 scm_internal_catch if you want the body to be like Scheme's `catch'
6627 --- a thunk, or a function of one argument if the tag is #f.
6629 BODY_DATA is a pointer to a scm_body_thunk_data structure, which
6630 contains the Scheme procedure to invoke as the body, and the tag
6631 we're catching. If the tag is #f, then we pass JMPBUF (created by
6632 scm_internal_catch) to the body procedure; otherwise, the body gets
6635 ** scm_handle_by_proc is a new handler function you can pass to
6636 scm_internal_catch if you want the handler to act like Scheme's catch
6637 --- call a procedure with the tag and the throw arguments.
6639 If the user does a throw to this catch, this function runs a handler
6640 procedure written in Scheme. HANDLER_DATA is a pointer to an SCM
6641 variable holding the Scheme procedure object to invoke. It ought to
6642 be a pointer to an automatic variable (i.e., one living on the stack),
6643 or the procedure object should be otherwise protected from GC.
6645 ** scm_handle_by_message is a new handler function to use with
6646 `scm_internal_catch' if you want Guile to print a message and die.
6647 It's useful for dealing with throws to uncaught keys at the top level.
6649 HANDLER_DATA, if non-zero, is assumed to be a char * pointing to a
6650 message header to print; if zero, we use "guile" instead. That
6651 text is followed by a colon, then the message described by ARGS.
6653 ** The return type of scm_boot_guile is now void; the function does
6654 not return a value, and indeed, never returns at all.
6656 ** The new function scm_shell makes it easy for user applications to
6657 process command-line arguments in a way that is compatible with the
6658 stand-alone guile interpreter (which is in turn compatible with SCSH,
6661 To use the scm_shell function, first initialize any guile modules
6662 linked into your application, and then call scm_shell with the values
6663 of ARGC and ARGV your `main' function received. scm_shell will add
6664 any SCSH-style meta-arguments from the top of the script file to the
6665 argument vector, and then process the command-line arguments. This
6666 generally means loading a script file or starting up an interactive
6667 command interpreter. For details, see "Changes to the stand-alone
6670 ** The new functions scm_get_meta_args and scm_count_argv help you
6671 implement the SCSH-style meta-argument, `\'.
6673 char **scm_get_meta_args (int ARGC, char **ARGV)
6674 If the second element of ARGV is a string consisting of a single
6675 backslash character (i.e. "\\" in Scheme notation), open the file
6676 named by the following argument, parse arguments from it, and return
6677 the spliced command line. The returned array is terminated by a
6680 For details of argument parsing, see above, under "guile now accepts
6681 command-line arguments compatible with SCSH..."
6683 int scm_count_argv (char **ARGV)
6684 Count the arguments in ARGV, assuming it is terminated by a null
6687 For an example of how these functions might be used, see the source
6688 code for the function scm_shell in libguile/script.c.
6690 You will usually want to use scm_shell instead of calling this
6693 ** The new function scm_compile_shell_switches turns an array of
6694 command-line arguments into Scheme code to carry out the actions they
6695 describe. Given ARGC and ARGV, it returns a Scheme expression to
6696 evaluate, and calls scm_set_program_arguments to make any remaining
6697 command-line arguments available to the Scheme code. For example,
6698 given the following arguments:
6700 -e main -s ekko a speckled gecko
6702 scm_set_program_arguments will return the following expression:
6704 (begin (load "ekko") (main (command-line)) (quit))
6706 You will usually want to use scm_shell instead of calling this
6709 ** The function scm_shell_usage prints a usage message appropriate for
6710 an interpreter that uses scm_compile_shell_switches to handle its
6711 command-line arguments.
6713 void scm_shell_usage (int FATAL, char *MESSAGE)
6714 Print a usage message to the standard error output. If MESSAGE is
6715 non-zero, write it before the usage message, followed by a newline.
6716 If FATAL is non-zero, exit the process, using FATAL as the
6717 termination status. (If you want to be compatible with Guile,
6718 always use 1 as the exit status when terminating due to command-line
6721 You will usually want to use scm_shell instead of calling this
6724 ** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
6725 expressions. It used to return SCM_EOL. Earth-shattering.
6727 ** The macros for declaring scheme objects in C code have been
6728 rearranged slightly. They are now:
6730 SCM_SYMBOL (C_NAME, SCHEME_NAME)
6731 Declare a static SCM variable named C_NAME, and initialize it to
6732 point to the Scheme symbol whose name is SCHEME_NAME. C_NAME should
6733 be a C identifier, and SCHEME_NAME should be a C string.
6735 SCM_GLOBAL_SYMBOL (C_NAME, SCHEME_NAME)
6736 Just like SCM_SYMBOL, but make C_NAME globally visible.
6738 SCM_VCELL (C_NAME, SCHEME_NAME)
6739 Create a global variable at the Scheme level named SCHEME_NAME.
6740 Declare a static SCM variable named C_NAME, and initialize it to
6741 point to the Scheme variable's value cell.
6743 SCM_GLOBAL_VCELL (C_NAME, SCHEME_NAME)
6744 Just like SCM_VCELL, but make C_NAME globally visible.
6746 The `guile-snarf' script writes initialization code for these macros
6747 to its standard output, given C source code as input.
6749 The SCM_GLOBAL macro is gone.
6751 ** The scm_read_line and scm_read_line_x functions have been replaced
6752 by Scheme code based on the %read-delimited! procedure (known to C
6753 code as scm_read_delimited_x). See its description above for more
6756 ** The function scm_sys_open has been renamed to scm_open. It now
6757 returns a port instead of an FD object.
6759 * The dynamic linking support has changed. For more information, see
6760 libguile/DYNAMIC-LINKING.
6765 User-visible changes from Thursday, September 5, 1996 until Guile 1.0
6768 * Changes to the 'guile' program:
6770 ** Guile now loads some new files when it starts up. Guile first
6771 searches the load path for init.scm, and loads it if found. Then, if
6772 Guile is not being used to execute a script, and the user's home
6773 directory contains a file named `.guile', Guile loads that.
6775 ** You can now use Guile as a shell script interpreter.
6777 To paraphrase the SCSH manual:
6779 When Unix tries to execute an executable file whose first two
6780 characters are the `#!', it treats the file not as machine code to
6781 be directly executed by the native processor, but as source code
6782 to be executed by some interpreter. The interpreter to use is
6783 specified immediately after the #! sequence on the first line of
6784 the source file. The kernel reads in the name of the interpreter,
6785 and executes that instead. It passes the interpreter the source
6786 filename as its first argument, with the original arguments
6787 following. Consult the Unix man page for the `exec' system call
6788 for more information.
6790 Now you can use Guile as an interpreter, using a mechanism which is a
6791 compatible subset of that provided by SCSH.
6793 Guile now recognizes a '-s' command line switch, whose argument is the
6794 name of a file of Scheme code to load. It also treats the two
6795 characters `#!' as the start of a comment, terminated by `!#'. Thus,
6796 to make a file of Scheme code directly executable by Unix, insert the
6797 following two lines at the top of the file:
6799 #!/usr/local/bin/guile -s
6802 Guile treats the argument of the `-s' command-line switch as the name
6803 of a file of Scheme code to load, and treats the sequence `#!' as the
6804 start of a block comment, terminated by `!#'.
6806 For example, here's a version of 'echo' written in Scheme:
6808 #!/usr/local/bin/guile -s
6810 (let loop ((args (cdr (program-arguments))))
6813 (display (car args))
6814 (if (pair? (cdr args))
6816 (loop (cdr args)))))
6819 Why does `#!' start a block comment terminated by `!#', instead of the
6820 end of the line? That is the notation SCSH uses, and although we
6821 don't yet support the other SCSH features that motivate that choice,
6822 we would like to be backward-compatible with any existing Guile
6823 scripts once we do. Furthermore, if the path to Guile on your system
6824 is too long for your kernel, you can start the script with this
6828 exec /really/long/path/to/guile -s "$0" ${1+"$@"}
6831 Note that some very old Unix systems don't support the `#!' syntax.
6834 ** You can now run Guile without installing it.
6836 Previous versions of the interactive Guile interpreter (`guile')
6837 couldn't start up unless Guile's Scheme library had been installed;
6838 they used the value of the environment variable `SCHEME_LOAD_PATH'
6839 later on in the startup process, but not to find the startup code
6840 itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
6843 To run Guile without installing it, build it in the normal way, and
6844 then set the environment variable `SCHEME_LOAD_PATH' to a
6845 colon-separated list of directories, including the top-level directory
6846 of the Guile sources. For example, if you unpacked Guile so that the
6847 full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
6850 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
6853 ** Guile's read-eval-print loop no longer prints #<unspecified>
6854 results. If the user wants to see this, she can evaluate the
6855 expression (assert-repl-print-unspecified #t), perhaps in her startup
6858 ** Guile no longer shows backtraces by default when an error occurs;
6859 however, it does display a message saying how to get one, and how to
6860 request that they be displayed by default. After an error, evaluate
6862 to see a backtrace, and
6863 (debug-enable 'backtrace)
6864 to see them by default.
6868 * Changes to Guile Scheme:
6870 ** Guile now distinguishes between #f and the empty list.
6872 This is for compatibility with the IEEE standard, the (possibly)
6873 upcoming Revised^5 Report on Scheme, and many extant Scheme
6876 Guile used to have #f and '() denote the same object, to make Scheme's
6877 type system more compatible with Emacs Lisp's. However, the change
6878 caused too much trouble for Scheme programmers, and we found another
6879 way to reconcile Emacs Lisp with Scheme that didn't require this.
6882 ** Guile's delq, delv, delete functions, and their destructive
6883 counterparts, delq!, delv!, and delete!, now remove all matching
6884 elements from the list, not just the first. This matches the behavior
6885 of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
6886 functions which inspired them.
6888 I recognize that this change may break code in subtle ways, but it
6889 seems best to make the change before the FSF's first Guile release,
6893 ** The compiled-library-path function has been deleted from libguile.
6895 ** The facilities for loading Scheme source files have changed.
6897 *** The variable %load-path now tells Guile which directories to search
6898 for Scheme code. Its value is a list of strings, each of which names
6901 *** The variable %load-extensions now tells Guile which extensions to
6902 try appending to a filename when searching the load path. Its value
6903 is a list of strings. Its default value is ("" ".scm").
6905 *** (%search-load-path FILENAME) searches the directories listed in the
6906 value of the %load-path variable for a Scheme file named FILENAME,
6907 with all the extensions listed in %load-extensions. If it finds a
6908 match, then it returns its full filename. If FILENAME is absolute, it
6909 returns it unchanged. Otherwise, it returns #f.
6911 %search-load-path will not return matches that refer to directories.
6913 *** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
6914 uses %seach-load-path to find a file named FILENAME, and loads it if
6915 it finds it. If it can't read FILENAME for any reason, it throws an
6918 The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
6921 *** load uses the same searching semantics as primitive-load.
6923 *** The functions %try-load, try-load-with-path, %load, load-with-path,
6924 basic-try-load-with-path, basic-load-with-path, try-load-module-with-
6925 path, and load-module-with-path have been deleted. The functions
6926 above should serve their purposes.
6928 *** If the value of the variable %load-hook is a procedure,
6929 `primitive-load' applies its value to the name of the file being
6930 loaded (without the load path directory name prepended). If its value
6931 is #f, it is ignored. Otherwise, an error occurs.
6933 This is mostly useful for printing load notification messages.
6936 ** The function `eval!' is no longer accessible from the scheme level.
6937 We can't allow operations which introduce glocs into the scheme level,
6938 because Guile's type system can't handle these as data. Use `eval' or
6939 `read-and-eval!' (see below) as replacement.
6941 ** The new function read-and-eval! reads an expression from PORT,
6942 evaluates it, and returns the result. This is more efficient than
6943 simply calling `read' and `eval', since it is not necessary to make a
6944 copy of the expression for the evaluator to munge.
6946 Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
6947 for the `read' function.
6950 ** The function `int?' has been removed; its definition was identical
6951 to that of `integer?'.
6953 ** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
6954 use the R4RS names for these functions.
6956 ** The function object-properties no longer returns the hash handle;
6957 it simply returns the object's property list.
6959 ** Many functions have been changed to throw errors, instead of
6960 returning #f on failure. The point of providing exception handling in
6961 the language is to simplify the logic of user code, but this is less
6962 useful if Guile's primitives don't throw exceptions.
6964 ** The function `fileno' has been renamed from `%fileno'.
6966 ** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
6969 * Changes to Guile's C interface:
6971 ** The library's initialization procedure has been simplified.
6972 scm_boot_guile now has the prototype:
6974 void scm_boot_guile (int ARGC,
6976 void (*main_func) (),
6979 scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
6980 MAIN_FUNC should do all the work of the program (initializing other
6981 packages, reading user input, etc.) before returning. When MAIN_FUNC
6982 returns, call exit (0); this function never returns. If you want some
6983 other exit value, MAIN_FUNC may call exit itself.
6985 scm_boot_guile arranges for program-arguments to return the strings
6986 given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
6987 scm_set_program_arguments with the final list, so Scheme code will
6988 know which arguments have been processed.
6990 scm_boot_guile establishes a catch-all catch handler which prints an
6991 error message and exits the process. This means that Guile exits in a
6992 coherent way when system errors occur and the user isn't prepared to
6993 handle it. If the user doesn't like this behavior, they can establish
6994 their own universal catcher in MAIN_FUNC to shadow this one.
6996 Why must the caller do all the real work from MAIN_FUNC? The garbage
6997 collector assumes that all local variables of type SCM will be above
6998 scm_boot_guile's stack frame on the stack. If you try to manipulate
6999 SCM values after this function returns, it's the luck of the draw
7000 whether the GC will be able to find the objects you allocate. So,
7001 scm_boot_guile function exits, rather than returning, to discourage
7002 people from making that mistake.
7004 The IN, OUT, and ERR arguments were removed; there are other
7005 convenient ways to override these when desired.
7007 The RESULT argument was deleted; this function should never return.
7009 The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
7013 ** Guile's header files should no longer conflict with your system's
7016 In order to compile code which #included <libguile.h>, previous
7017 versions of Guile required you to add a directory containing all the
7018 Guile header files to your #include path. This was a problem, since
7019 Guile's header files have names which conflict with many systems'
7022 Now only <libguile.h> need appear in your #include path; you must
7023 refer to all Guile's other header files as <libguile/mumble.h>.
7024 Guile's installation procedure puts libguile.h in $(includedir), and
7025 the rest in $(includedir)/libguile.
7028 ** Two new C functions, scm_protect_object and scm_unprotect_object,
7029 have been added to the Guile library.
7031 scm_protect_object (OBJ) protects OBJ from the garbage collector.
7032 OBJ will not be freed, even if all other references are dropped,
7033 until someone does scm_unprotect_object (OBJ). Both functions
7036 Note that calls to scm_protect_object do not nest. You can call
7037 scm_protect_object any number of times on a given object, and the
7038 next call to scm_unprotect_object will unprotect it completely.
7040 Basically, scm_protect_object and scm_unprotect_object just
7041 maintain a list of references to things. Since the GC knows about
7042 this list, all objects it mentions stay alive. scm_protect_object
7043 adds its argument to the list; scm_unprotect_object remove its
7044 argument from the list.
7047 ** scm_eval_0str now returns the value of the last expression
7050 ** The new function scm_read_0str reads an s-expression from a
7051 null-terminated string, and returns it.
7053 ** The new function `scm_stdio_to_port' converts a STDIO file pointer
7054 to a Scheme port object.
7056 ** The new function `scm_set_program_arguments' allows C code to set
7057 the value returned by the Scheme `program-arguments' function.
7062 * Guile no longer includes sophisticated Tcl/Tk support.
7064 The old Tcl/Tk support was unsatisfying to us, because it required the
7065 user to link against the Tcl library, as well as Tk and Guile. The
7066 interface was also un-lispy, in that it preserved Tcl/Tk's practice of
7067 referring to widgets by names, rather than exporting widgets to Scheme
7068 code as a special datatype.
7070 In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
7071 maintainers described some very interesting changes in progress to the
7072 Tcl/Tk internals, which would facilitate clean interfaces between lone
7073 Tk and other interpreters --- even for garbage-collected languages
7074 like Scheme. They expected the new Tk to be publicly available in the
7077 Since it seems that Guile might soon have a new, cleaner interface to
7078 lone Tk, and that the old Guile/Tk glue code would probably need to be
7079 completely rewritten, we (Jim Blandy and Richard Stallman) have
7080 decided not to support the old code. We'll spend the time instead on
7081 a good interface to the newer Tk, as soon as it is available.
7083 Until then, gtcltk-lib provides trivial, low-maintenance functionality.
7086 Copyright information:
7088 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
7090 Permission is granted to anyone to make or distribute verbatim copies
7091 of this document as received, in any medium, provided that the
7092 copyright notice and this permission notice are preserved,
7093 thus giving the recipient permission to redistribute in turn.
7095 Permission is granted to distribute modified versions
7096 of this document, or of portions of it,
7097 under the above conditions, provided also that they
7098 carry prominent notices stating who last changed them.
7103 paragraph-separate: "[
\f]*$"