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