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