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