Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc
[bpt/guile.git] / doc / ref / api-options.texi
1 @c -*-texinfo-*-
2 @c This is part of the GNU Guile Reference Manual.
3 @c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008
4 @c Free Software Foundation, Inc.
5 @c See the file guile.texi for copying conditions.
6
7 @page
8 @node Options and Config
9 @section Configuration, Features and Runtime Options
10
11 Why is my Guile different from your Guile? There are three kinds of
12 possible variation:
13
14 @itemize @bullet
15 @item
16 build differences --- different versions of the Guile source code,
17 installation directories, configuration flags that control pieces of
18 functionality being included or left out, etc.
19
20 @item
21 differences in dynamically loaded code --- behaviour and features
22 provided by modules that can be dynamically loaded into a running Guile
23
24 @item
25 different runtime options --- some of the options that are provided for
26 controlling Guile's behaviour may be set differently.
27 @end itemize
28
29 Guile provides ``introspective'' variables and procedures to query all
30 of these possible variations at runtime. For runtime options, it also
31 provides procedures to change the settings of options and to obtain
32 documentation on what the options mean.
33
34 @menu
35 * Build Config:: Build and installation configuration.
36 * Feature Tracking:: Available features in the Guile process.
37 * Runtime Options:: Controlling Guile's runtime behaviour.
38 @end menu
39
40
41 @node Build Config
42 @subsection Configuration, Build and Installation
43
44 The following procedures and variables provide information about how
45 Guile was configured, built and installed on your system.
46
47 @deffn {Scheme Procedure} version
48 @deffnx {Scheme Procedure} effective-version
49 @deffnx {Scheme Procedure} major-version
50 @deffnx {Scheme Procedure} minor-version
51 @deffnx {Scheme Procedure} micro-version
52 @deffnx {C Function} scm_version ()
53 @deffnx {C Function} scm_effective_version ()
54 @deffnx {C Function} scm_major_version ()
55 @deffnx {C Function} scm_minor_version ()
56 @deffnx {C Function} scm_micro_version ()
57 Return a string describing Guile's full version number, effective
58 version number, major, minor or micro version number, respectively.
59 The @code{effective-version} function returns the version name that
60 should remain unchanged during a stable series. Currently that means
61 that it omits the micro version. The effective version should be used
62 for items like the versioned share directory name
63 i.e. @file{/usr/share/guile/1.6/}
64
65 @lisp
66 (version) @result{} "1.6.0"
67 (effective-version) @result{} "1.6"
68 (major-version) @result{} "1"
69 (minor-version) @result{} "6"
70 (micro-version) @result{} "0"
71 @end lisp
72 @end deffn
73
74 @deffn {Scheme Procedure} %package-data-dir
75 @deffnx {C Function} scm_sys_package_data_dir ()
76 Return the name of the directory under which Guile Scheme files in
77 general are stored. On Unix-like systems, this is usually
78 @file{/usr/local/share/guile} or @file{/usr/share/guile}.
79 @end deffn
80
81 @deffn {Scheme Procedure} %library-dir
82 @deffnx {C Function} scm_sys_library_dir ()
83 Return the name of the directory where the Guile Scheme files that
84 belong to the core Guile installation (as opposed to files from a 3rd
85 party package) are installed. On Unix-like systems this is usually
86 @file{/usr/local/share/guile/<GUILE_EFFECTIVE_VERSION>} or
87 @file{/usr/share/guile/<GUILE_EFFECTIVE_VERSION>};
88
89 @noindent for example @file{/usr/local/share/guile/1.6}.
90 @end deffn
91
92 @deffn {Scheme Procedure} %site-dir
93 @deffnx {C Function} scm_sys_site_dir ()
94 Return the name of the directory where Guile Scheme files specific to
95 your site should be installed. On Unix-like systems, this is usually
96 @file{/usr/local/share/guile/site} or @file{/usr/share/guile/site}.
97 @end deffn
98
99 @cindex GUILE_LOAD_PATH
100 @defvar %load-path
101 List of directories which should be searched for Scheme modules and
102 libraries. @code{%load-path} is initialized when Guile starts up to
103 @code{(list (%site-dir) (%library-dir) (%package-data-dir))},
104 prepended with the contents of the GUILE_LOAD_PATH environment variable,
105 if it is set.
106 @end defvar
107
108 @deffn {Scheme Procedure} parse-path path [tail]
109 @deffnx {C Function} scm_parse_path (path, tail)
110 Parse @var{path}, which is expected to be a colon-separated
111 string, into a list and return the resulting list with
112 @var{tail} appended. If @var{path} is @code{#f}, @var{tail}
113 is returned.
114 @end deffn
115
116 @deffn {Scheme Procedure} search-path path filename [extensions]
117 @deffnx {C Function} scm_search_path (path, filename, extensions)
118 Search @var{path} for a directory containing a file named
119 @var{filename}. The file must be readable, and not a directory.
120 If we find one, return its full filename; otherwise, return
121 @code{#f}. If @var{filename} is absolute, return it unchanged.
122 If given, @var{extensions} is a list of strings; for each
123 directory in @var{path}, we search for @var{filename}
124 concatenated with each @var{extension}.
125 @end deffn
126
127 @defvar %guile-build-info
128 Alist of information collected during the building of a particular
129 Guile. Entries can be grouped into one of several categories:
130 directories, env vars, and versioning info.
131
132 Briefly, here are the keys in @code{%guile-build-info}, by group:
133
134 @cindex @code{srcdir}
135 @cindex @code{top_srcdir}
136 @cindex @code{prefix}
137 @cindex @code{exec_prefix}
138 @cindex @code{bindir}
139 @cindex @code{sbindir}
140 @cindex @code{libexecdir}
141 @cindex @code{datadir}
142 @cindex @code{sysconfdir}
143 @cindex @code{sharedstatedir}
144 @cindex @code{localstatedir}
145 @cindex @code{libdir}
146 @cindex @code{infodir}
147 @cindex @code{mandir}
148 @cindex @code{includedir}
149 @cindex @code{pkgdatadir}
150 @cindex @code{pkglibdir}
151 @cindex @code{pkgincludedir}
152 @table @asis
153 @item directories
154 srcdir, top_srcdir, prefix, exec_prefix, bindir, sbindir, libexecdir,
155 datadir, sysconfdir, sharedstatedir, localstatedir, libdir, infodir,
156 mandir, includedir, pkgdatadir, pkglibdir, pkgincludedir
157 @cindex @code{LIBS}
158 @item env vars
159 LIBS
160 @cindex @code{guileversion}
161 @cindex @code{libguileinterface}
162 @cindex @code{buildstamp}
163 @item versioning info
164 guileversion, libguileinterface, buildstamp
165 @end table
166
167 Values are all strings. The value for @code{LIBS} is typically found
168 also as a part of "guile-config link" output. The value for
169 @code{guileversion} has form X.Y.Z, and should be the same as returned
170 by @code{(version)}. The value for @code{libguileinterface} is
171 libtool compatible and has form CURRENT:REVISION:AGE
172 (@pxref{Versioning,, Library interface versions, libtool, GNU
173 Libtool}). The value for @code{buildstamp} is the output of the
174 date(1) command.
175
176 In the source, @code{%guile-build-info} is initialized from
177 libguile/libpath.h, which is completely generated, so deleting this file
178 before a build guarantees up-to-date values for that build.
179 @end defvar
180
181
182 @node Feature Tracking
183 @subsection Feature Tracking
184
185 Guile has a Scheme level variable @code{*features*} that keeps track to
186 some extent of the features that are available in a running Guile.
187 @code{*features*} is a list of symbols, for example @code{threads}, each
188 of which describes a feature of the running Guile process.
189
190 @defvar *features*
191 A list of symbols describing available features of the Guile process.
192 @end defvar
193
194 You shouldn't modify the @code{*features*} variable directly using
195 @code{set!}. Instead, see the procedures that are provided for this
196 purpose in the following subsection.
197
198 @menu
199 * Feature Manipulation:: Checking for and advertising features.
200 * Common Feature Symbols:: Commonly available features.
201 @end menu
202
203
204 @node Feature Manipulation
205 @subsubsection Feature Manipulation
206
207 To check whether a particular feature is available, use the
208 @code{provided?} procedure:
209
210 @deffn {Scheme Procedure} provided? feature
211 @deffnx {Deprecated Scheme Procedure} feature? feature
212 Return @code{#t} if the specified @var{feature} is available, otherwise
213 @code{#f}.
214 @end deffn
215
216 To advertise a feature from your own Scheme code, you can use the
217 @code{provide} procedure:
218
219 @deffn {Scheme Procedure} provide feature
220 Add @var{feature} to the list of available features in this Guile
221 process.
222 @end deffn
223
224 For C code, the equivalent function takes its feature name as a
225 @code{char *} argument for convenience:
226
227 @deftypefn {C Function} void scm_add_feature (const char *str)
228 Add a symbol with name @var{str} to the list of available features in
229 this Guile process.
230 @end deftypefn
231
232
233 @node Common Feature Symbols
234 @subsubsection Common Feature Symbols
235
236 In general, a particular feature may be available for one of two
237 reasons. Either because the Guile library was configured and compiled
238 with that feature enabled --- i.e. the feature is built into the library
239 on your system. Or because some C or Scheme code that was dynamically
240 loaded by Guile has added that feature to the list.
241
242 In the first category, here are the features that the current version of
243 Guile may define (depending on how it is built), and what they mean.
244
245 @table @code
246 @item array
247 Indicates support for arrays (@pxref{Arrays}).
248
249 @item array-for-each
250 Indicates availability of @code{array-for-each} and other array mapping
251 procedures (@pxref{Arrays}).
252
253 @item char-ready?
254 Indicates that the @code{char-ready?} function is available
255 (@pxref{Reading}).
256
257 @item complex
258 Indicates support for complex numbers.
259
260 @item current-time
261 Indicates availability of time-related functions: @code{times},
262 @code{get-internal-run-time} and so on (@pxref{Time}).
263
264 @item debug-extensions
265 Indicates that the debugging evaluator is available, together with the
266 options for controlling it.
267
268 @item delay
269 Indicates support for promises (@pxref{Delayed Evaluation}).
270
271 @item EIDs
272 Indicates that the @code{geteuid} and @code{getegid} really return
273 effective user and group IDs (@pxref{Processes}).
274
275 @item inexact
276 Indicates support for inexact numbers.
277
278 @item i/o-extensions
279 Indicates availability of the following extended I/O procedures:
280 @code{ftell}, @code{redirect-port}, @code{dup->fdes}, @code{dup2},
281 @code{fileno}, @code{isatty?}, @code{fdopen},
282 @code{primitive-move->fdes} and @code{fdes->ports} (@pxref{Ports and
283 File Descriptors}).
284
285 @item net-db
286 Indicates availability of network database functions:
287 @code{scm_gethost}, @code{scm_getnet}, @code{scm_getproto},
288 @code{scm_getserv}, @code{scm_sethost}, @code{scm_setnet}, @code{scm_setproto},
289 @code{scm_setserv}, and their `byXXX' variants (@pxref{Network
290 Databases}).
291
292 @item posix
293 Indicates support for POSIX functions: @code{pipe}, @code{getgroups},
294 @code{kill}, @code{execl} and so on (@pxref{POSIX}).
295
296 @item random
297 Indicates availability of random number generation functions:
298 @code{random}, @code{copy-random-state}, @code{random-uniform} and so on
299 (@pxref{Random}).
300
301 @item reckless
302 Indicates that Guile was built with important checks omitted --- you
303 should never see this!
304
305 @item regex
306 Indicates support for POSIX regular expressions using
307 @code{make-regexp}, @code{regexp-exec} and friends (@pxref{Regexp
308 Functions}).
309
310 @item socket
311 Indicates availability of socket-related functions: @code{socket},
312 @code{bind}, @code{connect} and so on (@pxref{Network Sockets and
313 Communication}).
314
315 @item sort
316 Indicates availability of sorting and merging functions
317 (@pxref{Sorting}).
318
319 @item system
320 Indicates that the @code{system} function is available
321 (@pxref{Processes}).
322
323 @item threads
324 Indicates support for multithreading (@pxref{Threads}).
325
326 @item values
327 Indicates support for multiple return values using @code{values} and
328 @code{call-with-values} (@pxref{Multiple Values}).
329 @end table
330
331 Available features in the second category depend, by definition, on what
332 additional code your Guile process has loaded in. The following table
333 lists features that you might encounter for this reason.
334
335 @table @code
336 @item defmacro
337 Indicates that the @code{defmacro} macro is available (@pxref{Macros}).
338
339 @item describe
340 Indicates that the @code{(oop goops describe)} module has been loaded,
341 which provides a procedure for describing the contents of GOOPS
342 instances.
343
344 @item readline
345 Indicates that Guile has loaded in Readline support, for command line
346 editing (@pxref{Readline Support}).
347
348 @item record
349 Indicates support for record definition using @code{make-record-type}
350 and friends (@pxref{Records}).
351 @end table
352
353 Although these tables may seem exhaustive, it is probably unwise in
354 practice to rely on them, as the correspondences between feature symbols
355 and available procedures/behaviour are not strictly defined. If you are
356 writing code that needs to check for the existence of some procedure, it
357 is probably safer to do so directly using the @code{defined?} procedure
358 than to test for the corresponding feature using @code{provided?}.
359
360
361 @node Runtime Options
362 @subsection Runtime Options
363
364 Guile's runtime behaviour can be modified by setting options. For
365 example, is the language that Guile accepts case sensitive, or should
366 the debugger automatically show a backtrace on error?
367
368 Guile has two levels of interface for managing options: a low-level
369 control interface, and a user-level interface which allows the enabling
370 or disabling of options.
371
372 Moreover, the options are classified in groups according to whether they
373 configure @emph{reading}, @emph{printing}, @emph{debugging} or
374 @emph{evaluating}.
375
376 @menu
377 * Low level options interfaces::
378 * User level options interfaces::
379 * Reader options::
380 * Printing options::
381 * Debugger options::
382 * Evaluator options::
383 * Evaluator trap options::
384 * Examples of option use::
385 @end menu
386
387
388 @node Low level options interfaces
389 @subsubsection Low Level Options Interfaces
390
391 @deffn {Scheme Procedure} read-options-interface [setting]
392 @deffnx {Scheme Procedure} eval-options-interface [setting]
393 @deffnx {Scheme Procedure} print-options-interface [setting]
394 @deffnx {Scheme Procedure} debug-options-interface [setting]
395 @deffnx {Scheme Procedure} evaluator-traps-interface [setting]
396 @deffnx {C Function} scm_read_options (setting)
397 @deffnx {C Function} scm_eval_options_interface (setting)
398 @deffnx {C Function} scm_print_options (setting)
399 @deffnx {C Function} scm_debug_options (setting)
400 @deffnx {C Function} scm_evaluator_traps (setting)
401 If one of these procedures is called with no arguments (or with
402 @code{setting == SCM_UNDEFINED} in C code), it returns a list describing
403 the current setting of the read, eval, print, debug or evaluator traps
404 options respectively. The setting of a boolean option is indicated
405 simply by the presence or absence of the option symbol in the list. The
406 setting of a non-boolean option is indicated by the presence of the
407 option symbol immediately followed by the option's current value.
408
409 If called with a list argument, these procedures interpret the list as
410 an option setting and modify the relevant options accordingly. [FIXME
411 --- this glosses over a lot of details!]
412
413 If called with any other argument, such as @code{'help}, these
414 procedures return a list of entries like @code{(@var{OPTION-SYMBOL}
415 @var{DEFAULT-VALUE} @var{DOC-STRING})}, with each entry giving the
416 default value and documentation for each option symbol in the relevant
417 set of options.
418 @end deffn
419
420
421 @node User level options interfaces
422 @subsubsection User Level Options Interfaces
423
424 @c @deftp {Data type} scm_option
425 @c @code{scm_option} is used to represent run time options. It can be a
426 @c @emph{boolean} type, in which case the option will be set by the strings
427 @c @code{"yes"} and @code{"no"}. It can be a
428 @c @end deftp
429
430 @c NJFIXME
431 @deffn {Scheme Procedure} <group>-options [arg]
432 @deffnx {Scheme Procedure} read-options [arg]
433 @deffnx {Scheme Procedure} print-options [arg]
434 @deffnx {Scheme Procedure} debug-options [arg]
435 @deffnx {Scheme Procedure} traps [arg]
436 These functions list the options in their group. The optional argument
437 @var{arg} is a symbol which modifies the form in which the options are
438 presented.
439
440 With no arguments, @code{<group>-options} returns the values of the
441 options in that particular group. If @var{arg} is @code{'help}, a
442 description of each option is given. If @var{arg} is @code{'full},
443 programmers' options are also shown.
444
445 @var{arg} can also be a list representing the state of all options. In
446 this case, the list contains single symbols (for enabled boolean
447 options) and symbols followed by values.
448 @end deffn
449 [FIXME: I don't think 'full is ever any different from 'help. What's
450 up?]
451
452 @c NJFIXME
453 @deffn {Scheme Procedure} <group>-enable option-symbol
454 @deffnx {Scheme Procedure} read-enable option-symbol
455 @deffnx {Scheme Procedure} print-enable option-symbol
456 @deffnx {Scheme Procedure} debug-enable option-symbol
457 @deffnx {Scheme Procedure} trap-enable option-symbol
458 These functions set the specified @var{option-symbol} in their options
459 group. They only work if the option is boolean, and throw an error
460 otherwise.
461 @end deffn
462
463 @c NJFIXME
464 @deffn {Scheme Procedure} <group>-disable option-symbol
465 @deffnx {Scheme Procedure} read-disable option-symbol
466 @deffnx {Scheme Procedure} print-disable option-symbol
467 @deffnx {Scheme Procedure} debug-disable option-symbol
468 @deffnx {Scheme Procedure} trap-disable option-symbol
469 These functions turn off the specified @var{option-symbol} in their
470 options group. They only work if the option is boolean, and throw an
471 error otherwise.
472 @end deffn
473
474 @c NJFIXME
475 @deffn syntax <group>-set! option-symbol value
476 @deffnx syntax read-set! option-symbol value
477 @deffnx syntax print-set! option-symbol value
478 @deffnx syntax debug-set! option-symbol value
479 @deffnx syntax trap-set! option-symbol value
480 These functions set a non-boolean @var{option-symbol} to the specified
481 @var{value}.
482 @end deffn
483
484
485 @node Reader options
486 @subsubsection Reader options
487 @cindex options - read
488 @cindex read options
489
490 Here is the list of reader options generated by typing
491 @code{(read-options 'full)} in Guile. You can also see the default
492 values.
493
494 @smalllisp
495 keywords #f Style of keyword recognition: #f, 'prefix or 'postfix
496 case-insensitive no Convert symbols to lower case.
497 positions yes Record positions of source code expressions.
498 copy no Copy source code expressions.
499 @end smalllisp
500
501 Notice that while Standard Scheme is case insensitive, to ease
502 translation of other Lisp dialects, notably Emacs Lisp, into Guile,
503 Guile is case-sensitive by default.
504
505 To make Guile case insensitive, you can type
506
507 @lisp
508 (read-enable 'case-insensitive)
509 @end lisp
510
511 @node Printing options
512 @subsubsection Printing options
513
514 Here is the list of print options generated by typing
515 @code{(print-options 'full)} in Guile. You can also see the default
516 values.
517
518 @smallexample
519 quote-keywordish-symbols reader How to print symbols that have a colon
520 as their first or last character. The
521 value '#f' does not quote the colons;
522 '#t' quotes them; 'reader' quotes
523 them when the reader option
524 'keywords' is not '#f'.
525
526 highlight-prefix @{ The string to print before highlighted values.
527 highlight-suffix @} The string to print after highlighted values.
528
529 source no Print closures with source.
530 closure-hook #f Hook for printing closures.
531 @end smallexample
532
533
534 @node Evaluator options
535 @subsubsection Evaluator options
536
537 These are the evaluator options with their default values, as they are
538 printed by typing @code{(eval-options 'full)} in Guile.
539
540 @smallexample
541 stack 22000 Size of thread stacks (in machine words).
542 @end smallexample
543
544
545 @node Evaluator trap options
546 @subsubsection Evaluator trap options
547 [FIXME: These flags, together with their corresponding handlers, are not
548 user level options. Probably this entire section should be moved to the
549 documentation about the low-level programmer debugging interface.]
550
551 Here is the list of evaluator trap options generated by typing
552 @code{(traps 'full)} in Guile. You can also see the default values.
553
554 @smallexample
555 exit-frame no Trap when exiting eval or apply.
556 apply-frame no Trap when entering apply.
557 enter-frame no Trap when eval enters new frame.
558 memoize-symbol no Trap when eval memoizes a symbol's value
559 traps yes Enable evaluator traps.
560 @end smallexample
561
562 @deffn apply-frame-handler key cont tailp
563 Called when a procedure is being applied.
564
565 Called if:
566
567 @itemize @bullet
568 @item
569 evaluator traps are enabled [traps interface], and
570 @item
571 either
572 @itemize @minus
573 @item
574 @code{apply-frame} is enabled [traps interface], or
575 @item
576 trace mode is on [debug-options interface], and the procedure being
577 called has the trace property enabled.
578 @end itemize
579 @end itemize
580
581 @var{cont} is a ``debug object'', which means that it can be passed to
582 @code{make-stack} to discover the stack at the point of the trap. The
583 apply frame handler's code can capture a restartable continuation if it
584 wants to by using @code{call-with-current-continuation} in the usual way.
585
586 @var{tailp} is true if this is a tail call
587 @end deffn
588
589 @deffn exit-frame-handler key cont retval
590 Called when a value is returned from a procedure.
591
592 Called if:
593
594 @itemize @bullet
595 @item
596 evaluator traps are enabled [traps interface], and
597 @item
598 either
599 @itemize @minus
600 @item
601 @code{exit-frame} is enabled [traps interface], or
602 @item
603 trace mode is on [debug-options interface], and the procedure being
604 called has the trace property enabled.
605 @end itemize
606 @end itemize
607
608 @var{cont} is a ``debug object'', which means that it can be passed to
609 @code{make-stack} to discover the stack at the point of the trap. The
610 exit frame handler's code can capture a restartable continuation if it
611 wants to by using @code{call-with-current-continuation} in the usual
612 way.
613
614 @var{retval} is the return value.
615 @end deffn
616
617 @deffn memoize-symbol-handler key cont expression env
618 Called when the evaluator memoizes the value of a procedure symbol
619
620 @var{cont} is a ``debug object'', which means that it can be passed to
621 @code{make-stack} to discover the stack at the point of the trap. The
622 exit frame handler's code can capture a restartable continuation if it
623 wants to by using @code{call-with-current-continuation} in the usual
624 way.
625
626 @var{retval} is the return value.
627 @end deffn
628
629 @deffn {Scheme Procedure} with-traps thunk
630 @deffnx {C Function} scm_with_traps (thunk)
631 Call @var{thunk} with traps enabled.
632 @end deffn
633
634 @deffn {Scheme Procedure} debug-object? obj
635 @deffnx {C Function} scm_debug_object_p (obj)
636 Return @code{#t} if @var{obj} is a debug object.
637 @end deffn
638
639
640 @node Debugger options
641 @subsubsection Debugger options
642
643 Here is the list of print options generated by typing
644 @code{(debug-options 'full)} in Guile. You can also see the default
645 values.
646
647 @smallexample
648 stack 20000 Stack size limit (0 = no check).
649 debug yes Use the debugging evaluator.
650 backtrace no Show backtrace on error.
651 depth 20 Maximal length of printed backtrace.
652 maxdepth 1000 Maximal number of stored backtrace frames.
653 frames 3 Maximum number of tail-recursive frames in backtrace.
654 indent 10 Maximal indentation in backtrace.
655 backwards no Display backtrace in anti-chronological order.
656 procnames yes Record procedure names at definition.
657 trace no *Trace mode.
658 breakpoints no *Check for breakpoints.
659 cheap yes *This option is now obsolete. Setting it has no effect.
660 @end smallexample
661
662 @subsubheading Stack overflow
663
664 @cindex overflow, stack
665 @cindex stack overflow
666 Stack overflow errors are caused by a computation trying to use more
667 stack space than has been enabled by the @code{stack} option. They are
668 reported like this:
669
670 @lisp
671 (non-tail-recursive-factorial 500)
672 @print{}
673 ERROR: Stack overflow
674 ABORT: (stack-overflow)
675 @end lisp
676
677 If you get an error like this, you can either try rewriting your code to
678 use less stack space, or increase the maximum stack size. To increase
679 the maximum stack size, use @code{debug-set!}, for example:
680
681 @lisp
682 (debug-set! stack 200000)
683 @result{}
684 (show-file-name #t stack 200000 debug backtrace depth 20
685 maxdepth 1000 frames 3 indent 10 width 79 procnames cheap)
686
687 (non-tail-recursive-factorial 500)
688 @result{}
689 122013682599111006870123878542304692625357434@dots{}
690 @end lisp
691
692 If you prefer to try rewriting your code, you may be able to save stack
693 space by making some of your procedures @dfn{tail recursive}
694 (@pxref{Tail Calls}).
695
696
697 @node Examples of option use
698 @subsubsection Examples of option use
699
700 Here is an example of a session in which some read and debug option
701 handling procedures are used. In this example, the user
702
703 @enumerate
704 @item
705 Notices that the symbols @code{abc} and @code{aBc} are not the same
706 @item
707 Examines the @code{read-options}, and sees that @code{case-insensitive}
708 is set to ``no''.
709 @item
710 Enables @code{case-insensitive}
711 @item
712 Verifies that now @code{aBc} and @code{abc} are the same
713 @item
714 Disables @code{case-insensitive} and enables debugging @code{backtrace}
715 @item
716 Reproduces the error of displaying @code{aBc} with backtracing enabled
717 [FIXME: this last example is lame because there is no depth in the
718 backtrace. Need to give a better example, possibly putting debugging
719 option examples in a separate session.]
720 @end enumerate
721
722 @smalllisp
723 guile> (define abc "hello")
724 guile> abc
725 "hello"
726 guile> aBc
727 ERROR: In expression aBc:
728 ERROR: Unbound variable: aBc
729 ABORT: (misc-error)
730
731 Type "(backtrace)" to get more information.
732 guile> (read-options 'help)
733 keywords #f Style of keyword recognition: #f, 'prefix or 'postfix
734 case-insensitive no Convert symbols to lower case.
735 positions yes Record positions of source code expressions.
736 copy no Copy source code expressions.
737 guile> (debug-options 'help)
738 stack 20000 Stack size limit (0 = no check).
739 debug yes Use the debugging evaluator.
740 backtrace no Show backtrace on error.
741 depth 20 Maximal length of printed backtrace.
742 maxdepth 1000 Maximal number of stored backtrace frames.
743 frames 3 Maximum number of tail-recursive frames in backtrace.
744 indent 10 Maximal indentation in backtrace.
745 backwards no Display backtrace in anti-chronological order.
746 procnames yes Record procedure names at definition.
747 trace no *Trace mode.
748 breakpoints no *Check for breakpoints.
749 cheap yes *This option is now obsolete. Setting it has no effect.
750 guile> (read-enable 'case-insensitive)
751 (keywords #f case-insensitive positions)
752 guile> aBc
753 "hello"
754 guile> (read-disable 'case-insensitive)
755 (keywords #f positions)
756 guile> (debug-enable 'backtrace)
757 (stack 20000 debug backtrace depth 20 maxdepth 1000 frames 3 indent 10 procnames cheap)
758 guile> aBc
759
760 Backtrace:
761 0* aBc
762
763 ERROR: In expression aBc:
764 ERROR: Unbound variable: aBc
765 ABORT: (misc-error)
766 guile>
767 @end smalllisp
768
769
770 @c Local Variables:
771 @c TeX-master: "guile.texi"
772 @c End: