source: project/chicken/branches/release/manual/Parameters @ 7276

Last change on this file since 7276 was 5945, checked in by felix winkelmann, 12 years ago

renamed some tools in misc/; apply hack fix on x86-64 (again); re-added manual

File size: 3.9 KB
Line 
1[[tags: manual]]
2[[toc:]]
3
4== Parameters
5
6Certain behavior of the interpreter and compiled programs can be
7customized via 'parameters', where a parameter is a procedure of
8zero or one arguments. To retrieve the value of a parameter call the
9parameter-procedure with zero arguments. To change the setting of the
10parameter, call the parameter-procedure with the new value as argument:
11
12<enscript highlight=scheme>
13(define foo (make-parameter 123))
14(foo)                             ==> 123
15(foo 99)
16(foo)                             ==> 99
17</enscript>
18
19Parameters are fully thread-local, each thread of execution
20owns a local copy of a parameters' value.
21
22CHICKEN implements [[http://srfi.schemers.org/srfi-39/srfi-39.html|SRFI-39]].
23
24
25
26=== make-parameter
27
28 [procedure] (make-parameter VALUE [GUARD])
29
30Returns a procedure that accepts zero or one argument. Invoking the
31procedure with zero arguments returns {{VALUE}}. Invoking the
32procedure with one argument changes its value to the value of that
33argument (subsequent invocations with zero parameters return the new
34value). {{GUARD}} should be a procedure of a single argument. Any
35new values of the parameter (even the initial value) are passed to this
36procedure. The guard procedure should check the value and/or convert it
37to an appropriate form.
38
39=== case-sensitive
40If true, then {{read}} reads symbols and identifiers in
41case-sensitive mode and uppercase characters in symbols are printed
42escaped. Defaults to {{#t}}.
43
44
45=== dynamic-load-libraries
46A list of strings containing shared libraries that should be checked
47for explicitly loaded library units (this facility is not available on
48all platforms). See {{load-library}}.
49
50
51=== command-line-arguments
52Contains the list of arguments passed to this program, with the name of
53the program and any runtime options (all options starting with {{-:}})
54removed.
55
56
57
58=== current-read-table
59A read-table object that holds read-procedures for special non-standard
60read-syntax (see {{set-read-syntax!}} for more information).
61
62
63=== exit-handler
64A procedure of a single optional argument. When {{exit}} is called,
65then this procedure will be invoked with the exit-code as argument. The
66default behavior is to terminate the program.
67
68
69=== eval-handler
70A procedure of one or two arguments. When {{eval}} is invoked, it
71calls the value of this parameter with the same arguments. The default
72behavior is to evaluate the argument expression and to ignore the
73second parameter.
74
75
76=== force-finalizers
77If true, force and execute all pending finalizers before exiting the
78program (either explicitly by {{exit}} or implicitly when the last
79toplevel expression has been executed). Default is {{#t}}.
80
81
82=== implicit-exit-handler
83A procedure of no arguments. When the last toplevel expression of the
84program has executed, then the value of this parameter is called. The
85default behaviour is to invoke all pending finalizers.
86
87
88=== keyword-style
89Enables alternative keyword syntax, where {{STYLE}} may be either
90{{#:prefix}} (as in Common Lisp) or {{#:suffix}} (as in DSSSL).
91Any other value disables the alternative syntaxes.
92
93
94=== load-verbose
95A boolean indicating whether loading of source files, compiled code
96(if available) and compiled libraries should display a message.
97
98
99=== program-name
100The name of the currently executing program. This is equivalent to
101{{(car (argv))}} for compiled programs or the filename following the
102{{-script}} option in interpreted scripts.
103
104
105=== repl-prompt
106A procedure that should evaluate to a string that will be printed before reading
107interactive input from the user in a read-eval-print loop. Defaults to
108{{(lambda () "#;N> ")}}.
109
110
111=== reset-handler
112A procedure of zero arguments that is called via {{reset}}. The
113default behavior in compiled code is to invoke the value of
114{{(exit-handler)}}. The default behavior in the interpreter is to
115abort the current computation and to restart the read-eval-print loop.
116
117
118Previous: [[Declarations]]
119
120Next: [[Unit library]]
Note: See TracBrowser for help on using the repository browser.