*** empty log message ***
[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
48d224d7
JB
22We no longer distribute the documentation, since it was either out of
23date, or incomplete. As soon as we have current documentation, we
24will distribute it.
25
f3b1485f
JB
26* Changes to the stand-alone interpreter
27
48d224d7
JB
28** guile now accepts command-line arguments compatible with SCSH, Olin
29Shivers' Scheme Shell.
30
31In general, arguments are evaluated from left to right, but there are
32exceptions. The following switches stop argument processing, and
33stash all remaining command-line arguments as the value returned by
34the (command-line) function.
35 -s SCRIPT load Scheme source code from FILE, and exit
36 -c EXPR evalute Scheme expression EXPR, and exit
37 -- stop scanning arguments; run interactively
38
39The switches below are processed as they are encountered.
40 -l FILE load Scheme source code from FILE
41 -e FUNCTION after reading script, apply FUNCTION to
42 command line arguments
43 -ds do -s script at this point
44 --emacs enable Emacs protocol (experimental)
45 -h, --help display this help and exit
46 -v, --version display version information and exit
47 \ read arguments from following script lines
48
49So, for example, here is a Guile script named `ekko' (thanks, Olin)
50which re-implements the traditional "echo" command:
51
52#!/usr/local/bin/guile -s
53!#
54(define (main args)
55 (map (lambda (arg) (display arg) (display " "))
56 (cdr args))
57 (newline))
58
59(main (command-line))
60
61Suppose we invoke this script as follows:
62
63 ekko a speckled gecko
64
65Through the magic of Unix script processing (triggered by the `#!'
66token at the top of the file), /usr/local/bin/guile receives the
67following list of command-line arguments:
68
69 ("-s" "./ekko" "a" "speckled" "gecko")
70
71Unix inserts the name of the script after the argument specified on
72the first line of the file (in this case, "-s"), and then follows that
73with the arguments given to the script. Guile loads the script, which
74defines the `main' function, and then applies it to the list of
75remaining command-line arguments, ("a" "speckled" "gecko").
76
77* Changes to the procedure for linking libguile with your programs
78
79** Guile now builds and installs a shared guile library, if your
80system support shared libraries. (It still builds a static library on
81all systems.) Guile automatically detects whether your system
82supports shared libraries. To prevent Guile from buildisg shared
83libraries, pass the `--disable-shared' flag to the configure script.
84
85Guile takes longer to compile when it builds shared libraries, because
86it must compile every file twice --- once to produce position-
87independent object code, and once to produce normal object code.
88
89** The libthreads library has been merged into libguile.
90
91To link a program against Guile, you now need only link against
92-lguile and -lqt; -lthreads is no longer needed. If you are using
93autoconf to generate configuration scripts for your application, the
94following lines should suffice to add the appropriate libraries to
95your link command:
96
97### Find quickthreads and libguile.
98AC_CHECK_LIB(qt, main)
99AC_CHECK_LIB(guile, scm_shell)
f3b1485f
JB
100
101* Changes to Scheme functions
102
48d224d7
JB
103** There are new accessors and setters for the broken-out time vectors
104returned by `localtime', `gmtime', and that ilk. They are:
105
106 Component Accessor Setter
107 ========================= ============ ============
108 seconds tm:sec set-tm:sec
109 minutes tm:min set-tm:min
110 hours tm:hour set-tm:hour
111 day of the month tm:mday set-tm:mday
112 month tm:mon set-tm:mon
113 year tm:year set-tm:year
114 day of the week tm:wday set-tm:wday
115 day in the year tm:yday set-tm:yday
116 daylight saving time tm:isdst set-tm:isdst
117 GMT offset, seconds tm:gmtoff set-tm:gmtoff
118 name of time zone tm:zone set-tm:zone
119
120** There are new accessors for the vectors returned by `uname'.
121
122 Component Accessor
123 ============================================== ================
124 name of the operating system implementation utsname:sysname
125 network name of this machine utsname:nodename
126 release level of the operating system utsname:release
127 version level of the operating system utsname:version
128 machine hardware platform utsname:machine
129
130** There is now a complete set of accessors for the vectors returned
131by the `getserv'
132
133** The new function `eval-string' reads Scheme expressions from a
134string and evaluates them, returning the value of the last expression
135in the string. If the string contains no expressions, it returns an
136unspecified value.
137
138** The new function `command-line' returns the command-line arguments
139given to Guile, as a list of strings.
140
141When using guile as a script interpreter, `command-line' returns the
142script's arguments; those processed by the interpreter (like `-s' or
143`-c') are omitted. (In other words, you get the normal, expected
144behavior.) Any application that uses scm_shell to process its
145command-line arguments gets this behavior as well.
146
147** The new function `load-user-init' looks for a file called `.guile'
148in the user's home directory, and loads it if it exists. This is
149mostly for use by the code generated by scm_compile_shell_switches,
150but we thought it might also be useful in other circumstances.
151
152** The new function `log10' returns the base-10 logarithm of its
153argument.
154
f3b1485f
JB
155** gethost, getproto, and getnet, and getserv now return more helpful
156error codes.
6685dc83 157
ea00ecba
MG
158* Changes to the gh_ interface
159
160** gh_eval_str() now returns an SCM object which is the result of the
161evaluation
162
aaef0d2a
MG
163** gh_scm2str() now copies the Scheme data to a caller-provided C
164array
165
166** gh_scm2newstr() now makes a C array, copies the Scheme data to it,
167and returns the array
168
169** gh_scm2str0() is gone: there is no need to distinguish
170null-terminated from non-null-terminated, since gh_scm2newstr() allows
171the user to interpret the data both ways.
172
f3b1485f
JB
173* Changes to the scm_ interface
174
175** The new function scm_shell makes it easy for user applications to
176process command-line arguments in a way that is compatible with the
177stand-alone guile interpreter (which is in turn compatible with SCSH,
178the Scheme shell).
179
180To use the scm_shell function, first initialize any guile modules
181linked into your application, and then call scm_shell with the values
182of ARGC and ARGV your `main' function received. scm_shell will adding
183any SCSH-style meta-arguments from the top of the script file to the
184argument vector, and then process the command-line arguments. This
185generally means loading a script file or starting up an interactive
186command interpreter. For details, see "Changes to the stand-alone
187interpreter" above.
188
48d224d7
JB
189** [[new: scm_usage_name, scm_shell_usage, scm_compile_shell_switches]]
190
191** scm_eval_0str now returns SCM_UNSPECIFIED if the string contains no
192expressions. It used to return SCM_EOL.
193
ea00ecba
MG
194* Changes to documentation
195
196** the $(srcdir)/newdoc hierarchy now contains a new approach to the
197manuals. The approach, recommended by Jim Blandy, is to have: (*) a
198tutorial with the pedagogical style of guile-user, and a non-dry
199reference manual in the style of the most excellent GNU libc reference
200manual: the reference manual should be complete, but at the same time
201it should have an introductory screen for each major topic, which can
202be referenced if the user goes "up" a level in the info documentation.
203
f7b47737
JB
204\f
205Guile 1.0b3
3065a62a 206
f3b1485f
JB
207User-visible changes from Thursday, September 5, 1996 until Guile 1.0
208(Sun 5 Jan 1997):
3065a62a 209
4b521edb 210* Changes to the 'guile' program:
3065a62a 211
4b521edb
JB
212** Guile now loads some new files when it starts up. Guile first
213searches the load path for init.scm, and loads it if found. Then, if
214Guile is not being used to execute a script, and the user's home
215directory contains a file named `.guile', Guile loads that.
c6486f8a 216
4b521edb 217** You can now use Guile as a shell script interpreter.
3065a62a
JB
218
219To paraphrase the SCSH manual:
220
221 When Unix tries to execute an executable file whose first two
222 characters are the `#!', it treats the file not as machine code to
223 be directly executed by the native processor, but as source code
224 to be executed by some interpreter. The interpreter to use is
225 specified immediately after the #! sequence on the first line of
226 the source file. The kernel reads in the name of the interpreter,
227 and executes that instead. It passes the interpreter the source
228 filename as its first argument, with the original arguments
229 following. Consult the Unix man page for the `exec' system call
230 for more information.
231
1a1945be
JB
232Now you can use Guile as an interpreter, using a mechanism which is a
233compatible subset of that provided by SCSH.
234
3065a62a
JB
235Guile now recognizes a '-s' command line switch, whose argument is the
236name of a file of Scheme code to load. It also treats the two
237characters `#!' as the start of a comment, terminated by `!#'. Thus,
238to make a file of Scheme code directly executable by Unix, insert the
239following two lines at the top of the file:
240
241#!/usr/local/bin/guile -s
242!#
243
244Guile treats the argument of the `-s' command-line switch as the name
245of a file of Scheme code to load, and treats the sequence `#!' as the
246start of a block comment, terminated by `!#'.
247
248For example, here's a version of 'echo' written in Scheme:
249
250#!/usr/local/bin/guile -s
251!#
252(let loop ((args (cdr (program-arguments))))
253 (if (pair? args)
254 (begin
255 (display (car args))
256 (if (pair? (cdr args))
257 (display " "))
258 (loop (cdr args)))))
259(newline)
260
261Why does `#!' start a block comment terminated by `!#', instead of the
262end of the line? That is the notation SCSH uses, and although we
263don't yet support the other SCSH features that motivate that choice,
264we would like to be backward-compatible with any existing Guile
3763761c
JB
265scripts once we do. Furthermore, if the path to Guile on your system
266is too long for your kernel, you can start the script with this
267horrible hack:
268
269#!/bin/sh
270exec /really/long/path/to/guile -s "$0" ${1+"$@"}
271!#
3065a62a
JB
272
273Note that some very old Unix systems don't support the `#!' syntax.
274
c6486f8a 275
4b521edb 276** You can now run Guile without installing it.
6685dc83
JB
277
278Previous versions of the interactive Guile interpreter (`guile')
279couldn't start up unless Guile's Scheme library had been installed;
280they used the value of the environment variable `SCHEME_LOAD_PATH'
281later on in the startup process, but not to find the startup code
282itself. Now Guile uses `SCHEME_LOAD_PATH' in all searches for Scheme
283code.
284
285To run Guile without installing it, build it in the normal way, and
286then set the environment variable `SCHEME_LOAD_PATH' to a
287colon-separated list of directories, including the top-level directory
288of the Guile sources. For example, if you unpacked Guile so that the
289full filename of this NEWS file is /home/jimb/guile-1.0b3/NEWS, then
290you might say
291
292 export SCHEME_LOAD_PATH=/home/jimb/my-scheme:/home/jimb/guile-1.0b3
293
c6486f8a 294
4b521edb
JB
295** Guile's read-eval-print loop no longer prints #<unspecified>
296results. If the user wants to see this, she can evaluate the
297expression (assert-repl-print-unspecified #t), perhaps in her startup
48d224d7 298file.
6685dc83 299
4b521edb
JB
300** Guile no longer shows backtraces by default when an error occurs;
301however, it does display a message saying how to get one, and how to
302request that they be displayed by default. After an error, evaluate
303 (backtrace)
304to see a backtrace, and
305 (debug-enable 'backtrace)
306to see them by default.
6685dc83 307
6685dc83 308
d9fb83d9 309
4b521edb
JB
310* Changes to Guile Scheme:
311
312** Guile now distinguishes between #f and the empty list.
313
314This is for compatibility with the IEEE standard, the (possibly)
315upcoming Revised^5 Report on Scheme, and many extant Scheme
316implementations.
317
318Guile used to have #f and '() denote the same object, to make Scheme's
319type system more compatible with Emacs Lisp's. However, the change
320caused too much trouble for Scheme programmers, and we found another
321way to reconcile Emacs Lisp with Scheme that didn't require this.
322
323
324** Guile's delq, delv, delete functions, and their destructive
c6486f8a
JB
325counterparts, delq!, delv!, and delete!, now remove all matching
326elements from the list, not just the first. This matches the behavior
327of the corresponding Emacs Lisp functions, and (I believe) the Maclisp
328functions which inspired them.
329
330I recognize that this change may break code in subtle ways, but it
331seems best to make the change before the FSF's first Guile release,
332rather than after.
333
334
4b521edb 335** The compiled-library-path function has been deleted from libguile.
6685dc83 336
4b521edb 337** The facilities for loading Scheme source files have changed.
c6486f8a 338
4b521edb 339*** The variable %load-path now tells Guile which directories to search
6685dc83
JB
340for Scheme code. Its value is a list of strings, each of which names
341a directory.
342
4b521edb
JB
343*** The variable %load-extensions now tells Guile which extensions to
344try appending to a filename when searching the load path. Its value
345is a list of strings. Its default value is ("" ".scm").
346
347*** (%search-load-path FILENAME) searches the directories listed in the
348value of the %load-path variable for a Scheme file named FILENAME,
349with all the extensions listed in %load-extensions. If it finds a
350match, then it returns its full filename. If FILENAME is absolute, it
351returns it unchanged. Otherwise, it returns #f.
6685dc83 352
4b521edb
JB
353%search-load-path will not return matches that refer to directories.
354
355*** (primitive-load FILENAME :optional CASE-INSENSITIVE-P SHARP)
356uses %seach-load-path to find a file named FILENAME, and loads it if
357it finds it. If it can't read FILENAME for any reason, it throws an
358error.
6685dc83
JB
359
360The arguments CASE-INSENSITIVE-P and SHARP are interpreted as by the
4b521edb
JB
361`read' function.
362
363*** load uses the same searching semantics as primitive-load.
364
365*** The functions %try-load, try-load-with-path, %load, load-with-path,
366basic-try-load-with-path, basic-load-with-path, try-load-module-with-
367path, and load-module-with-path have been deleted. The functions
368above should serve their purposes.
369
370*** If the value of the variable %load-hook is a procedure,
371`primitive-load' applies its value to the name of the file being
372loaded (without the load path directory name prepended). If its value
373is #f, it is ignored. Otherwise, an error occurs.
374
375This is mostly useful for printing load notification messages.
376
377
378** The function `eval!' is no longer accessible from the scheme level.
379We can't allow operations which introduce glocs into the scheme level,
380because Guile's type system can't handle these as data. Use `eval' or
381`read-and-eval!' (see below) as replacement.
382
383** The new function read-and-eval! reads an expression from PORT,
384evaluates it, and returns the result. This is more efficient than
385simply calling `read' and `eval', since it is not necessary to make a
386copy of the expression for the evaluator to munge.
387
388Its optional arguments CASE_INSENSITIVE_P and SHARP are interpreted as
389for the `read' function.
390
391
392** The function `int?' has been removed; its definition was identical
393to that of `integer?'.
394
395** The functions `<?', `<?', `<=?', `=?', `>?', and `>=?'. Code should
396use the R4RS names for these functions.
397
398** The function object-properties no longer returns the hash handle;
399it simply returns the object's property list.
400
401** Many functions have been changed to throw errors, instead of
402returning #f on failure. The point of providing exception handling in
403the language is to simplify the logic of user code, but this is less
404useful if Guile's primitives don't throw exceptions.
405
406** The function `fileno' has been renamed from `%fileno'.
407
408** The function primitive-mode->fdes returns #t or #f now, not 1 or 0.
409
410
411* Changes to Guile's C interface:
412
413** The library's initialization procedure has been simplified.
414scm_boot_guile now has the prototype:
415
416void scm_boot_guile (int ARGC,
417 char **ARGV,
418 void (*main_func) (),
419 void *closure);
420
421scm_boot_guile calls MAIN_FUNC, passing it CLOSURE, ARGC, and ARGV.
422MAIN_FUNC should do all the work of the program (initializing other
423packages, reading user input, etc.) before returning. When MAIN_FUNC
424returns, call exit (0); this function never returns. If you want some
425other exit value, MAIN_FUNC may call exit itself.
426
427scm_boot_guile arranges for program-arguments to return the strings
428given by ARGC and ARGV. If MAIN_FUNC modifies ARGC/ARGV, should call
429scm_set_program_arguments with the final list, so Scheme code will
430know which arguments have been processed.
431
432scm_boot_guile establishes a catch-all catch handler which prints an
433error message and exits the process. This means that Guile exits in a
434coherent way when system errors occur and the user isn't prepared to
435handle it. If the user doesn't like this behavior, they can establish
436their own universal catcher in MAIN_FUNC to shadow this one.
437
438Why must the caller do all the real work from MAIN_FUNC? The garbage
439collector assumes that all local variables of type SCM will be above
440scm_boot_guile's stack frame on the stack. If you try to manipulate
441SCM values after this function returns, it's the luck of the draw
442whether the GC will be able to find the objects you allocate. So,
443scm_boot_guile function exits, rather than returning, to discourage
444people from making that mistake.
445
446The IN, OUT, and ERR arguments were removed; there are other
447convenient ways to override these when desired.
448
449The RESULT argument was deleted; this function should never return.
450
451The BOOT_CMD argument was deleted; the MAIN_FUNC argument is more
452general.
453
454
455** Guile's header files should no longer conflict with your system's
456header files.
457
458In order to compile code which #included <libguile.h>, previous
459versions of Guile required you to add a directory containing all the
460Guile header files to your #include path. This was a problem, since
461Guile's header files have names which conflict with many systems'
462header files.
463
464Now only <libguile.h> need appear in your #include path; you must
465refer to all Guile's other header files as <libguile/mumble.h>.
466Guile's installation procedure puts libguile.h in $(includedir), and
467the rest in $(includedir)/libguile.
468
469
470** Two new C functions, scm_protect_object and scm_unprotect_object,
471have been added to the Guile library.
472
473scm_protect_object (OBJ) protects OBJ from the garbage collector.
474OBJ will not be freed, even if all other references are dropped,
475until someone does scm_unprotect_object (OBJ). Both functions
476return OBJ.
477
478Note that calls to scm_protect_object do not nest. You can call
479scm_protect_object any number of times on a given object, and the
480next call to scm_unprotect_object will unprotect it completely.
481
482Basically, scm_protect_object and scm_unprotect_object just
483maintain a list of references to things. Since the GC knows about
484this list, all objects it mentions stay alive. scm_protect_object
485adds its argument to the list; scm_unprotect_object remove its
486argument from the list.
487
488
489** scm_eval_0str now returns the value of the last expression
490evaluated.
491
492** The new function scm_read_0str reads an s-expression from a
493null-terminated string, and returns it.
494
495** The new function `scm_stdio_to_port' converts a STDIO file pointer
496to a Scheme port object.
497
498** The new function `scm_set_program_arguments' allows C code to set
499the value teruturned by the Scheme `program-arguments' function.
6685dc83 500
6685dc83 501\f
1a1945be
JB
502Older changes:
503
504* Guile no longer includes sophisticated Tcl/Tk support.
505
506The old Tcl/Tk support was unsatisfying to us, because it required the
507user to link against the Tcl library, as well as Tk and Guile. The
508interface was also un-lispy, in that it preserved Tcl/Tk's practice of
509referring to widgets by names, rather than exporting widgets to Scheme
510code as a special datatype.
511
512In the Usenix Tk Developer's Workshop held in July 1996, the Tcl/Tk
513maintainers described some very interesting changes in progress to the
514Tcl/Tk internals, which would facilitate clean interfaces between lone
515Tk and other interpreters --- even for garbage-collected languages
516like Scheme. They expected the new Tk to be publicly available in the
517fall of 1996.
518
519Since it seems that Guile might soon have a new, cleaner interface to
520lone Tk, and that the old Guile/Tk glue code would probably need to be
521completely rewritten, we (Jim Blandy and Richard Stallman) have
522decided not to support the old code. We'll spend the time instead on
523a good interface to the newer Tk, as soon as it is available.
5c54da76 524
8512dea6 525Until then, gtcltk-lib provides trivial, low-maintenance functionality.
deb95d71 526
5c54da76
JB
527\f
528Copyright information:
529
ea00ecba 530Copyright (C) 1996,1997 Free Software Foundation, Inc.
5c54da76
JB
531
532 Permission is granted to anyone to make or distribute verbatim copies
533 of this document as received, in any medium, provided that the
534 copyright notice and this permission notice are preserved,
535 thus giving the recipient permission to redistribute in turn.
536
537 Permission is granted to distribute modified versions
538 of this document, or of portions of it,
539 under the above conditions, provided also that they
540 carry prominent notices stating who last changed them.
541
48d224d7
JB
542\f
543Local variables:
544mode: outline
545paragraph-separate: "[ \f]*$"
546end:
547