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