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