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