Update gauche to 0.9.4. Changes are:
Major feature upgrade
* R7RS support
* Notable improvements
* A bunch of new procedures and enhancements
* Tons of bug fixes
+ Fixes that may break the compatibility
+ Miscellaneous fixes
Gauche now supports R7RS-small ( http://r7rs.org/ ). It can load R7RS libraries
and execute R7RS scripts seamlessly. (There are minor caveats; see ref:Standard
conformance). See also ref:Library modules - R7RS integration for the details
of how R7RS is integrated.
The backward compatibility to the legacy Gauche code is kept as much as
possible; in short, you can keep using existing Gauche code and write new code
in pretty much the same way.
It's up to you to write code in traditional Gauche way or R7RS way: If you plan
to make the code portable, you may want to stick with R7RS, but if you need to
depend on lots of Gauche-specific libraries, there's not much point to adopt
R7RS structure, for you can't run it in other implementations anyway.
* REPL is slightly improved: You can access history (ref:Working in REPL).
And describe shows known bindings when called on symbols. The default
writer now do not show shared structures, for it confused newcomers; it
still shows circular structures in srfi:38 notation.
* data.random: Random data generators.
* math.prime module for lazy sequence of primes, testing primality, and prime
* srfi-106: Basic socket interface.
* PIPE signal handling is changed. By default, Gauche effectively ignores
SIGPIPE; the system calls will generate EPIPE system-error instead. Since
the signal delivery timing differ in the Scheme world from C world,
handling SIGPIPE reasonably is difficult, while handling system error is
straightforward and synchronous. Note that EPIPE error from stdout and
stderr terminates the process immediately, so that the Gauche script don't
spit error messsages when used in command pipelines and the destination
command exits prematurely. See ref:Handling signals for the details.
* write and display is now R7RS; that is, they won't explode by circular
* On Windows, system interface functions now properly handles multibyte
filenames, command-line arguments and enviornment variables. Contribution
from SAITO Atsushi.
A bunch of new procedures and enhancements
* New numerical procedures:
+ On rationalization: rationalize, real->rational, continued-fraction;
see Gauche-blog:20120925-rationalize. As a bonus, now converting
flonums to exact number can produce more readable (simple) rational
numbers; see Gauche-blog:20120930-exact.
+ On integer operations: exact-integer? (r7rs) expt-mod, twos-exponent,
+ Gamma functions: gamma, lgamma.
+ r7rs division operators floor/, floor-quotient, floor-remainder,
truncate/, truncate-quotient, truncate-remainder.
* expt now returns exact value if possible, even the exponent is non-integer
(but exact rational).
* New list and vector procedures: length<=?, list-set!, vector-map (r7rs),
vector-for-each (r7rs), vector-tabulate.
* New regex procedures: rxmatch-substrings, rxmatch-positions,
+ Also, regex objects now have read-write invariance.
* rfc.json: Now you can customize mappings between json array/object and
Scheme objects. Also parse-json* is added to parse multiple JSON objects
from a single source.
* gauche.generator: New procedures: gconcatenate, gmerge, gbuffer-filter.
* gauche.lazy: New procedure: lconcatenate
+ u8vector-multi-copy!, u8vector-append (and all other TAG variations).
+ string->u8vector etc.: Added immutable? optional argument to produce
immutable uvector, which avoids copying the string contents. u8vector->
string also avoids copying if the source vector is immutable.
* rfc.http: Support for basic authentication added.
* file.filter: file-filter may leave the destination file untouched if it
won't be changed, by :leave-unchanged option. Also added new procedures:
file-filter-for-each, file-filter-fold, file-filter-map.
* You can now load script from non-regular files (e.g. device files). Useful
for one-liner such as gosh -E... /dev/null.
* Char-set now adopts collection framework, and also they're applicable
object to test membership.
* Trie (util.trie) now adopts dictionary framework.
* make-tree-map accepts single compare argument instead of = and <.
* rfc.hmac: Pick appropriate block size according to the digest algorithm
* string-split: Accept an optional argument to limit the number of the
result, much like Perl's similar operator.
* command-line (r7rs)
* include and include-ci (r7rs)
* util.sparse: sparse-vector-ref and sparse-table-ref now have generalized
* symbol=?, boolean=? (r7rs).
* Reader supports #true and #false for r7rs.
* Negative zeros (-0.0) are recognized when it matters.
* cond-expand supports library clause (r7rs).
* text.unicode: utf8->string, string->utf8 (r7rs); string-ci=? etc. that
handles Unicode full case mapping, as required by R7RS.
* dotimes and dolist now supports omission of variable.
* letrec* (r7rs).
* rfc.base64: base64-decode and base64-encode support :url-safe keyword
argument to use url-safe alternative characters.
* syntax-rules: Support r7rs enhancements.
* define-values: Made r7rs compliant.
* sys-errno->symbol, sys-symbol->errno.
* Built-in sort procedures now supports srfi-95. See ref:Comparison and
* digit->integer, integer->digit: Extended to handle digit characters other
than [0-9]; Unicode defines a bunch of them.
* gauche.dictionary: Bimap can have default conflict resolution.
* os.windows: Console procedures are enhanced. Contribution from github.com/
Tons of bug fixes
Fixes that may break the compatibility
* The reader syntax \xNN is now interpreted as R7RS-way by default
(semicolon-terminated, Unicode codepoint). If we don't find the terminating
semicolon, we interpret it as the legacy syntax. However, there are
ambiguous cases that lead to incompatible behavior. You can switch the
reader mode by reader-lexical-mode to make it fully comatiple to the old
* The hash function for char-set behaved poorly, so we changed it. If you
have saved the hash value of char-sets in the previous versions of Gauche,
you need to recalculate them.
* We no longer coerce the result to inexact when dividing an exact numebr by
exact zero; we used to return +inf.0, but that interpretation is no longer
allowed since R6RS. Now it raises an error.
* It is now an error to pass strings containing NUL characters to external
libraries that expects strings. For example, passing "foo.scm\0.exe" to
open-input-file throws an error. Allowing it would make potential security
issue. If you need to pass a byte array that may contain 0, consider using
u8vector instead of strings.
* copy-bit-field: The argument order is switched - Gauche was following the
old SLIB interface, but it was changed during SRFI-60 discussion. We now
comply the new argument order for the portability, and the old code that
uses this procedure need to be changed.
* rfc.uri: Use uppercase for percent-encoding of special chars, as
recommended in RFC3986. Watch out if the code relying on the case of
* srfi-13: Switched the argument order of string-filter and string-delete;
they are changed after finalization, to be in sync with srfi:13's reference
implementation. (Usually reference implementation is fixed to match the
spec, but in this case, quite a few Scheme implementations had been using
the reference implementation as it was, and changing it would have broken
existing code.) Fortunately we could support both order so that the
existing code will keep working, but we recommend to change the code to
match the new order if possible.
* Fix: thread-terminate! caused SEGV when called on a thread that's not
* Fix: Character reader produced incorrect values in some #\uxxxxx input.
* Fixed incorrect/missing stack traces, contributed from Vitaly Magerya.
* Fixed subtle bugs in conversion between rationals and flonums.
* util.match: Fixed match-define.
* force: Fixed leak, introduced between 0.9.2 and 0.9.3.
* write-ber-integer ignored the port argument.
* gauche.net: On Windows, the socket code had a fd leak.
* text.diff: diff ignored :equal keyword argument.
* rfc.tls: Fixed file descriptor leak.
* rfc.json: Propertly handles surrogate pairs.
* unwind-protect: The cleanup handler wasn't called properly if the process
exits within the body.
Update to 0.9.3.2.
Here is list of changes:
Fix documentation build problem when configured to use non default
Fix build problem on Windows/MinGW.
* New Features
o Lazy sequences: An efficient and seamless support of mixing lazy
evaluation with ordinary list procedures. Forcing delayed
evaluation is implicit, so you can pass lazy list to normal list
procedures such as car or fold. See the manual entry for the
details and examples.
o gauche.generator: A general utilities for generators, a thunk that
generates a value every time it is called. Lazy sequences are built
on top of generators. See the manual entry for the details.
o Threads are now supported on Windows/MinGW build. It is directly
based on Win32 thread API instead of pthreads; but Scheme-level
semantics are almost the same. The cond-expand conditions are
slightly modified to accomodate both thread models--- see Threads
for the details.
o add-load-path macro now accepts an optional argument to make the
given path relative to the currently loaded file. This is useful to
distribute a script accompanied with library files; for example,
specify (add-load-path "." :relative) in the script makes the
library files searched from the same directory where the script
exists. Then users can just copy the directory to anywhere and run
o A chained-application macro $: Incorporated the feature which has
been experimented as gauche.experimental.app. This macro allows (f
a b (g c d (h i j))) to be written as ($ f a b $ g c d $ h i j).
Although it is slighly longer, it is sometimes work better with
indentation of deeply nested function calls. See the manual entry
for the full explanation.
o A new gosh option -m module allows the main procedure to be
searched in the specified module instead of the default user
module. This allows a Scheme file to work both as a library module
and an executable scripts (e.g. for running tests or demos); name
the test program main but not export it, and it won't affect
ordinary module users, but you can test the module by using -m
* Incompatibile Changes
o util.queue: Thread-safe queue can now be created with zero
max-length, which is handy as a synchronization device. This is an
incompatible change---previously, specyfing zero to :max-length
means unlimited queue length. (Cf: Queue of zero length
http://blog.practical-scheme.net/gauche … ngth-queue ).
o Fixed a regexp bug in treatment of BOL/EOL assertions (^, $) within
the assetion blocks such as (?=...). Regarding BOL/EOL assertions,
these assertion blocks are treated as if they're stand-alone. The
fixed behavior is now compatible with Perl and Oniguruma. The code
that counted on the previous (buggy) behavior may break by this
o Removed gauche.auxsys module. This module contained several
less-used system procedures; now they are in the core. The module
was autoloaded, so not many code should be affected by this change.
Only the code that explicitly refer to this module needs to be
o Many frequently-used list procedures (all of util.list, and some of
srfi-1) are now included in the core. The module util.list is no
longer needed, although it is kept just for the backward
compatibility. From srfi-1, the following procedures are now in the
core: null-list?, cons*, last, member (extended one), take, drop,
take-right, drop-right, take!, drop-right!, delete, delete!,
delete-duplicates, delete-duplicates!, assoc (extended one),
alist-copy, alist-delete, alist-delete!, any, every, filter,
filter!, remove, remove!, filter-map, fold, fold-right, find,
find-tail, split-at, split-at!, iota.
o New macros and procedures: values->list, fold-left,
o New procedure applicable? can be used to check object's
applicability finer than procedure?. Related, a special class
<bottom> is added, which behaves as a subtype of any classes.
o Build process is overhauled to allow out-of-source-tree build.
o Regular expression engine is slightly improved. For example, it now
calculates the set of characters that can be a beginning of a part
of regexp, and uses it to skip the input efficiently.
o thread-terminate! now attempts to terminate the target thread
gracefully, and only tries the forceful means when the gracefull
o open-input-file now accepts :encoding #t argument, which tells the
procedure to use a coding-aware port. That is, it can recognize
coding: ... specification in the beginning of the file. Useful to
process source files.
o map is now restart-safe, that is, saving continuations in middle of
mapping and restarting it doesn't affect previous results. This is
required in R6RS.
o Various small improvements in the compiler and VM stack layout.
o gauche.test: test-module now checks the number of arguments given
to the global procedures. This is useful to catch careless
mistakes. In rare cases that you do intend to pass number of
arguments incompatible to the normal usage of the procedures, list
such procedures in :bypass-arity-check keyword argument (It is
possible because of the dynamic nature of the language---methods of
a different signature may be added later, for example).
o gauche.test: test-end has a keyword argument to exit with non-zero
status if test failed. New function test-summary-check exits with
non-zero status when the test record file indicates there have been
failures. Both are useful to propagate test failure to upper levels
such as continuous integration server.
o srfi-42: Support :generator qualifier to allow using generator
procedures in a sense of gauche.generator.
o file.util: touch-file and touch-files takes various keyword
arguments similar to touch(1) command.
o rfc.http: A new parameter http-proxy allows to set the default http
proxy. The https connection now uses a library bundled to Gauche,
no longer requires external stunnel command.
o GC is bumped to bdwgc 7.2-alpha6.
* Bux fixes
o Fixed an incorrect rounding bug when inexact numbers were given to
div and mod.
o Fixed another division bug in /., when both dividend and divisor
are too big to be represented by floating-point numbers.
o In quasiquote expander, unquote and unquote-splicing are recognized
o force is now thread-safe.
o Fixed some MT-hazards in file loading/requiring. Thanks to Kirill
Zorin for tracking those hard-to-find bugs.
o Fixed a bug that made (regexp-compile '(alt)) Bus Error.
o Fixed another regexp bug that didn't handle case-folding match
beyond ASCII range. Patch from OOHASHI Daichi.
o gauche.parameter: Accessing parameters created in unrelated threads
used to raise an error. It was annoying, since such situation could
occur inadvertently when autoload is involved. Now the parameters
work regardless of where they are created.
o rfc.json: Fixed a bug that produced incorrect JSON.
o rfc.http: Fixed the behavior of redirection for 3xx responses. You
can also customize the behavior.
o gauche.threads: Fixed a bug in thread-sleep! when passed an exact
o util.stream: stream-count didn't work.