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