little stuff on manual
[bpt/guile.git] / NEWS
CommitLineData
f7b47737
JB
1Guile NEWS --- history of user-visible changes. -*- text -*-
2Copyright (C) 1996, 1997 Free Software Foundation, Inc.
5c54da76
JB
3See the end for copying conditions.
4
16f2ebea 5Please send Guile bug reports to bug-guile@prep.ai.mit.edu.
5c54da76 6\f
f7b47737 7Changes since Guile 1.0 (Sun 5 Jan 1997):
6685dc83 8
f7b47737
JB
9\f
10Guile 1.0b3
3065a62a 11
f7b47737 12User-visible changes from Thursday, September 5, 1996 until Guile 1.0:
3065a62a 13
4b521edb 14* Changes to the 'guile' program:
3065a62a 15
4b521edb
JB
16** Guile now loads some new files when it starts up. Guile first
17searches the load path for init.scm, and loads it if found. Then, if
18Guile is not being used to execute a script, and the user's home
19directory contains a file named `.guile', Guile loads that.
c6486f8a 20
4b521edb 21** You can now use Guile as a shell script interpreter.
3065a62a
JB
22
23To paraphrase the SCSH manual:
24
25 When Unix tries to execute an executable file whose first two
26 characters are the `#!', it treats the file not as machine code to
27 be directly executed by the native processor, but as source code
28 to be executed by some interpreter. The interpreter to use is
29 specified immediately after the #! sequence on the first line of
30 the source file. The kernel reads in the name of the interpreter,
31 and executes that instead. It passes the interpreter the source
32 filename as its first argument, with the original arguments
33 following. Consult the Unix man page for the `exec' system call
34 for more information.
35
1a1945be
JB
36Now you can use Guile as an interpreter, using a mechanism which is a
37compatible subset of that provided by SCSH.
38
3065a62a
JB
39Guile now recognizes a '-s' command line switch, whose argument is the
40name of a file of Scheme code to load. It also treats the two
41characters `#!' as the start of a comment, terminated by `!#'. Thus,
42to make a file of Scheme code directly executable by Unix, insert the
43following two lines at the top of the file:
44
45#!/usr/local/bin/guile -s
46!#
47
48Guile treats the argument of the `-s' command-line switch as the name
49of a file of Scheme code to load, and treats the sequence `#!' as the
50start of a block comment, terminated by `!#'.
51
52For example, here's a version of 'echo' written in Scheme:
53
54#!/usr/local/bin/guile -s
55!#
56(let loop ((args (cdr (program-arguments))))
57 (if (pair? args)
58 (begin
59 (display (car args))
60 (if (pair? (cdr args))
61 (display " "))
62 (loop (cdr args)))))
63(newline)
64
65Why does `#!' start a block comment terminated by `!#', instead of the
66end of the line? That is the notation SCSH uses, and although we
67don't yet support the other SCSH features that motivate that choice,
68we would like to be backward-compatible with any existing Guile
3763761c
JB
69scripts once we do. Furthermore, if the path to Guile on your system
70is too long for your kernel, you can start the script with this
71horrible hack:
72
73#!/bin/sh
74exec /really/long/path/to/guile -s "$0" ${1+"$@"}
75!#
3065a62a
JB
76
77Note that some very old Unix systems don't support the `#!' syntax.
78
c6486f8a 79
4b521edb 80** You can now run Guile without installing it.
6685dc83
JB
81
82Previous versions of the interactive Guile interpreter (`guile')
83couldn't start up unless Guile's Scheme library had been installed;
84they used the value of the environment variable `SCHEME_LOAD_PATH'
85later on in the startup process, but not to find the startup code
86itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
87code.
88
89To run Guile without installing it, build it in the normal way, and
90then set the environment variable `SCHEME_LOAD_PATH' to a
91colon-separated list of directories, including the top-level directory
92of the Guile sources. For example, if you unpacked Guile so that the
93full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
94you might say
95
96 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
97
c6486f8a 98
4b521edb
JB
99** Guile's read-eval-print loop no longer prints #<unspecified>
100results. If the user wants to see this, she can evaluate the
101expression (assert-repl-print-unspecified #t), perhaps in her startup
102file.
6685dc83 103
4b521edb
JB
104** Guile no longer shows backtraces by default when an error occurs;
105however, it does display a message saying how to get one, and how to
106request that they be displayed by default. After an error, evaluate
107 (backtrace)
108to see a backtrace, and
109 (debug-enable 'backtrace)
110to see them by default.
6685dc83 111
6685dc83 112
d9fb83d9 113
4b521edb
JB
114* Changes to Guile Scheme:
115
116** Guile now distinguishes between #f and the empty list.
117
118This is for compatibility with the IEEE standard, the (possibly)
119upcoming Revised^5 Report on Scheme, and many extant Scheme
120implementations.
121
122Guile used to have #f and '() denote the same object, to make Scheme's
123type system more compatible with Emacs Lisp's. However, the change
124caused too much trouble for Scheme programmers, and we found another
125way to reconcile Emacs Lisp with Scheme that didn't require this.
126
127
128** Guile's delq, delv, delete functions, and their destructive
c6486f8a
JB
129counterparts, delq!, delv!, and delete!, now remove all matching
130elements from the list, not just the first. This matches the behavior
131of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
132functions which inspired them.
133
134I recognize that this change may break code in subtle ways, but it
135seems best to make the change before the FSF's first Guile release,
136rather than after.
137
138
4b521edb 139** The compiled-library-path function has been deleted from libguile.
6685dc83 140
4b521edb 141** The facilities for loading Scheme source files have changed.
c6486f8a 142
4b521edb 143*** The variable %load-path now tells Guile which directories to search
6685dc83
JB
144for Scheme code. Its value is a list of strings, each of which names
145a directory.
146
4b521edb
JB
147*** The variable %load-extensions now tells Guile which extensions to
148try appending to a filename when searching the load path. Its value
149is a list of strings. Its default value is ("" ".scm").
150
151*** (%search-load-path FILENAME) searches the directories listed in the
152value of the %load-path variable for a Scheme file named FILENAME,
153with all the extensions listed in %load-extensions. If it finds a
154match, then it returns its full filename. If FILENAME is absolute, it
155returns it unchanged. Otherwise, it returns #f.
6685dc83 156
4b521edb
JB
157%search-load-path will not return matches that refer to directories.
158
159*** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
160uses %seach-load-path to find a file named FILENAME, and loads it if
161it finds it. If it can't read FILENAME for any reason, it throws an
162error.
6685dc83
JB
163
164The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4b521edb
JB
165`read' function.
166
167*** load uses the same searching semantics as primitive-load.
168
169*** The functions %try-load, try-load-with-path, %load, load-with-path,
170basic-try-load-with-path, basic-load-with-path, try-load-module-with-
171path, and load-module-with-path have been deleted. The functions
172above should serve their purposes.
173
174*** If the value of the variable %load-hook is a procedure,
175`primitive-load' applies its value to the name of the file being
176loaded (without the load path directory name prepended). If its value
177is #f, it is ignored. Otherwise, an error occurs.
178
179This is mostly useful for printing load notification messages.
180
181
182** The function `eval!' is no longer accessible from the scheme level.
183We can't allow operations which introduce glocs into the scheme level,
184because Guile's type system can't handle these as data. Use `eval' or
185`read-and-eval!' (see below) as replacement.
186
187** The new function read-and-eval! reads an expression from PORT,
188evaluates it, and returns the result. This is more efficient than
189simply calling `read' and `eval', since it is not necessary to make a
190copy of the expression for the evaluator to munge.
191
192Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
193for the `read' function.
194
195
196** The function `int?' has been removed; its definition was identical
197to that of `integer?'.
198
199** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
200use the R4RS names for these functions.
201
202** The function object-properties no longer returns the hash handle;
203it simply returns the object's property list.
204
205** Many functions have been changed to throw errors, instead of
206returning #f on failure. The point of providing exception handling in
207the language is to simplify the logic of user code, but this is less
208useful if Guile's primitives don't throw exceptions.
209
210** The function `fileno' has been renamed from `%fileno'.
211
212** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
213
214
215* Changes to Guile's C interface:
216
217** The library's initialization procedure has been simplified.
218scm_boot_guile now has the prototype:
219
220void scm_boot_guile (int ARGC,
221 char **ARGV,
222 void (*main_func) (),
223 void *closure);
224
225scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
226MAIN_FUNC should do all the work of the program (initializing other
227packages, reading user input, etc.) before returning. When MAIN_FUNC
228returns, call exit (0); this function never returns. If you want some
229other exit value, MAIN_FUNC may call exit itself.
230
231scm_boot_guile arranges for program-arguments to return the strings
232given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
233scm_set_program_arguments with the final list, so Scheme code will
234know which arguments have been processed.
235
236scm_boot_guile establishes a catch-all catch handler which prints an
237error message and exits the process. This means that Guile exits in a
238coherent way when system errors occur and the user isn't prepared to
239handle it. If the user doesn't like this behavior, they can establish
240their own universal catcher in MAIN_FUNC to shadow this one.
241
242Why must the caller do all the real work from MAIN_FUNC? The garbage
243collector assumes that all local variables of type SCM will be above
244scm_boot_guile's stack frame on the stack. If you try to manipulate
245SCM values after this function returns, it's the luck of the draw
246whether the GC will be able to find the objects you allocate. So,
247scm_boot_guile function exits, rather than returning, to discourage
248people from making that mistake.
249
250The IN, OUT, and ERR arguments were removed; there are other
251convenient ways to override these when desired.
252
253The RESULT argument was deleted; this function should never return.
254
255The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
256general.
257
258
259** Guile's header files should no longer conflict with your system's
260header files.
261
262In order to compile code which #included <libguile.h>, previous
263versions of Guile required you to add a directory containing all the
264Guile header files to your #include path. This was a problem, since
265Guile's header files have names which conflict with many systems'
266header files.
267
268Now only <libguile.h> need appear in your #include path; you must
269refer to all Guile's other header files as <libguile/mumble.h>.
270Guile's installation procedure puts libguile.h in $(includedir), and
271the rest in $(includedir)/libguile.
272
273
274** Two new C functions, scm_protect_object and scm_unprotect_object,
275have been added to the Guile library.
276
277scm_protect_object (OBJ) protects OBJ from the garbage collector.
278OBJ will not be freed, even if all other references are dropped,
279until someone does scm_unprotect_object (OBJ). Both functions
280return OBJ.
281
282Note that calls to scm_protect_object do not nest. You can call
283scm_protect_object any number of times on a given object, and the
284next call to scm_unprotect_object will unprotect it completely.
285
286Basically, scm_protect_object and scm_unprotect_object just
287maintain a list of references to things. Since the GC knows about
288this list, all objects it mentions stay alive. scm_protect_object
289adds its argument to the list; scm_unprotect_object remove its
290argument from the list.
291
292
293** scm_eval_0str now returns the value of the last expression
294evaluated.
295
296** The new function scm_read_0str reads an s-expression from a
297null-terminated string, and returns it.
298
299** The new function `scm_stdio_to_port' converts a STDIO file pointer
300to a Scheme port object.
301
302** The new function `scm_set_program_arguments' allows C code to set
303the value teruturned by the Scheme `program-arguments' function.
6685dc83 304
6685dc83 305\f
1a1945be
JB
306Older changes:
307
308* Guile no longer includes sophisticated Tcl/Tk support.
309
310The old Tcl/Tk support was unsatisfying to us, because it required the
311user to link against the Tcl library, as well as Tk and Guile. The
312interface was also un-lispy, in that it preserved Tcl/Tk's practice of
313referring to widgets by names, rather than exporting widgets to Scheme
314code as a special datatype.
315
316In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
317maintainers described some very interesting changes in progress to the
318Tcl/Tk internals, which would facilitate clean interfaces between lone
319Tk and other interpreters --- even for garbage-collected languages
320like Scheme. They expected the new Tk to be publicly available in the
321fall of 1996.
322
323Since it seems that Guile might soon have a new, cleaner interface to
324lone Tk, and that the old Guile/Tk glue code would probably need to be
325completely rewritten, we (Jim Blandy and Richard Stallman) have
326decided not to support the old code. We'll spend the time instead on
327a good interface to the newer Tk, as soon as it is available.
5c54da76 328
8512dea6 329Until then, gtcltk-lib provides trivial, low-maintenance functionality.
deb95d71 330
5c54da76
JB
331\f
332Copyright information:
333
334Copyright (C) 1996 Free Software Foundation, Inc.
335
336 Permission is granted to anyone to make or distribute verbatim copies
337 of this document as received, in any medium, provided that the
338 copyright notice and this permission notice are preserved,
339 thus giving the recipient permission to redistribute in turn.
340
341 Permission is granted to distribute modified versions
342 of this document, or of portions of it,
343 under the above conditions, provided also that they
344 carry prominent notices stating who last changed them.
345