Gauche is an R5RS Scheme implementation developed to be a handy script interpreter, which allows programmers and system administrators to write small to large scripts for their daily chores. Quick startup, built-in system interface, native multilingual support are some of my goals.
Gauche runs on several Unix-like platforms.
See Features for implemented features.
News
See ChangeLog for details. You can also check the most recent development status at Git repository.
- 2011/8/6
-
Gauche 0.9.2 and Gauche-gl 0.5.1 are released.
Gauche 0.9.2:
- New Features
- Case mapping and character properties are fully supported, compatible to R6RS and R7RS draft (both based on Unicode standard). Character-wise case mapping (char-upcase etc.) and property queries (char-alphabetic?, char-general-category, etc.) are built-in. Context-aware string case mapping (string-upcase etc.) is provided in the new text.unicode module. (Note: srfi-13's string-upcase etc. are unchanged; they are defined to use simple case mappings.) The text.unicode module also provides conversion between utf-8/utf-16 and Unicode codepoints.
- Windows binary distribution is now in MS installer (*.msi) format, created with WiX. It's safer than the previous *.exe format created by NSIS, which had a bug that smashes PATH settings when it is too long.
- A convenient wrapper for atomic execution is added in gauche.threads. See this intro post.
- Benchmarking utilities resembles to Perl's Benchmark module is now available in gauche.time. See this post for an introduction.
- with-lock-file: A long-awaited feature to use lock files conveniently. It is in file.util module.
- Added full support of srfi-60, integer bitwise operations.
- gauche.cgen: Some API that Gauche uses to generate C code become public. See the manual for the details.
- Incompatibile Changes
- control.thread-pool: add-job! now takes timeout argument. If it is omitted and the job queue is full, add-job! blocks. It is a change from 0.9.1, in which add-job! returns immediately in such case. To get the same behavior, pass 0 explicitly to the timeout argument. The argument order of wait-all is also changed to take timeout optional argument first. In 0.9.1 it never timeouts.
- If --enable-multibyte flag is given to ./configure without explicit encoding, we now assume utf-8. It used to be euc-jp. This is for the consistency. We don't think this change affects many, for the document has always been told to give explicit encoding name for this option.
- The --enable-ipv6 configure option is turned on by default. It shouldn't cause problems on modern OSes. If you ever get a compile error in gauche.net module on a platform that lacks modern API, specify --disable-ipv6 option to ./configure.
- (This is an internal change of undocumented feature. We mention it just in case if some extension packages depend on this.) In the initialization code generated by genstub or precomp, it used to be possible to refer to the current module by mod. Now you should use Scm_CurrentModule() instead. Also, gauche.cgen.unit now doesn't include <gauche.h> automatically.
- Improvements
- The compiler is improved to avoid creating a closure at execution time when it doesn't close local environment. For example, (map (^x (* x x)) lis) doesn't create a closure; instead, the internal lambda is compiled as if it is a toplevel-defined procedure. (Yeah, it's a simple lambda lifting. We didn't do it since it could slow down the compiler. Now the compiler is efficient enough to handle it.)
- Supports zero or multi-argument unquote/unquote-splicing, as defined in R6RS.
- sys-exec and sys-fork-and-exec now supports :detached keyword argument to make the child process detached from the parent's process group.
- Buliltin reverse and reverse! takes optional list-tail argument.
- A new builtin procedure map* that can deal with dotted list.
- Common Lisp-like ecase macro is added.
- The extended lambda formals (:key, :optional, etc) are now available in define-method as well.
- New built-in function sys-clearenv, useful to fork subprocess securely.
- rxmatch-case accepts (else => proc) form, just like case.
- Socket address objects (e.g. <sockaddr-un>) can now be compared by equal? based on its content. Useful to put them in a hashtable, for example.
- gauche.uvector: A new procedure uvector-copy! that can copy any type of uvectors.
- gauche.test: A new test expected result constructor test-one-of allows to check if the test result matches any one of possible outcomes.
- control.thread-pool: Now a pool raises <thread-pool-shut-down> condition if the pool has already be shut down and no longer accepting new jobs. terminate-all now takes :cancel-queued-jobs keyword argument to stop the pool immediately, instead of waiting for all the jobs to be finished. Canceled jobs are marked as killed. New APIs: thread-pool-results, thread-pool-shut-down?.
- rfc.json: Allow construct-json to take optional output port for the consistency.
- rfc.uri: A new procedure uri-merge that can be resolve a relative uri in regart to a base uri.
- rfc.cookie: Recognize :http-only cookie attribute introduced in RFC6265.
- Now the tilde `~' expansion of sys-normalize-pathname works on Windows as well to refer to the current user's home directory; it tries environment variables heuristically to find it. To refer to other user's home directory by ~user is still only available on Unix platforms, though.
- util.combinations: combinations is optimized to handle leaf cases efficiently.
- Bux fixes
- Fixed a bug that the number parser hangs when reading 2.2250738585072012e-308.
- Integer multiplication routine had a code that depended on undefined behavior of C; it worked on gcc but revealed the bug on clang-llvm.
- Fixed a module bug on the visibility of bindings of extended modules.
- gauche.parameter: Fixed a couple of bugs on parameter objects.
- Numeric comparison procedures such as < didn't work correctly when more than four arguments were given. The bug was introduced by incorrect optimization.
- Fixed bugs in lognot, logand, logior and logxor, which crashed when non-integer ratinoal numbers are passed.
- port->string, port->string-list: These procedures returned prematurely when the input contains an illegal byte sequence for internal encoding. Now they return an incomplete string instead.
- srfi-1: Some srfi-1 procedures that are built-in were not exported, causing errors when you wanted to import them selectively, e.g. (use srfi-1 :only (fold)).
- util.queue: Fixed list->queue to work.
- binary.pack: Fixed a bug that the result may be truncated if the input contains byte sequences that can be interpreted as invalid character multibyte sequences.
- srfi-42: Fixed a hygiene bug; the previous versions failed when only toplevel macros are imported using :only import option.
- rfc.json: Fixed a bug that didn't escape double-quotes in the string, and didn't handle empty array.
- Coding-aware ports didn't count lines correctly in CR-only or CRLF line endings.
- Fixed a problem that caused crash after changing metaclasses of a class metaobject. An additional protection mechanism is in place in the class metaobject so that it won't be in an inconsistent state unexpectedly.
- Fixed sys-setenv in which you couldn't omit the overwrite argument, even if it was described optional.
- Fixed build problem of gauche.net on Solaris.
- Fixed a bug in gauche-package that caused an error when *load-path* contained a nonexistent path.
- Fixed a bug in string comparison routine that surfaces in a special architecture.
- The printed output of <time> was incorrect when its value was negative.
- There was a bug in the reader it reads ().() incorrectly.
- Fixed a bug in format to allow ~* to position after the last argument.
- Fixed GC compliation problem on OSX Lion.
Gauche-gl 0.5.1: Small change to make it compile with Gauche 0.9.2.
- New Features
- 2011/3/1
-
We switched the developement repository from Subversion to Git. See Download for instructions to check out or browse.
- 2010/12/25
-
It is reported that the Windows installer could smash the value of PATH, if adding the Gauche's path resulted the length of PATH to exceed a certain limit (it appears to be a known problem of NSIS, see a similar incindent in Winamp forum.) If your PATH is already close to about 1000 character long, please refrain from using the current Gauche-mingw-0.9.1.exe. We're looking at possible fixes.
- 2010/12/12
-
We found a bug in gauche-config that can affect installation of extension packages. The 0.9.1 release has been replaced with the fix. Please check the md5sum of the packages if you've already downloaded them.
6134e9c16aef2bc9fd3fa7e8fbebdd10 Gauche-0.9.1.tgz dce3a5f438506bfcbb63687e2debdeb1 Gauche-mingw-0.9.1.exe
- 2010/12/11
-
Gauche 0.9.1: Major Feature Enhancements
- New Features
- Extended formals:
Built-in lambda, define etc. can
recognize optional and keyword arguments, a la Common Lisp.
For example, you can now write
(define (foo x :optional (y 0) (z 2)) ...)
instead of(define (foo x . args) (let-optionals* args ((y 0) (z 2)) ...))
See the manual entry of lambda for the details. If you're writing a portable program and don't want to use this extended syntax accidentally, use syntactic bindings provided in the scheme module instead gauche module; syntactic keywords provided in the former raise an error if extended formals are used. See Extended formals about this decision. (Note: Currently define-method does not support extended formals due to a small technical obstacle. It should be addressed soon.) - Enhanced module mechanism: Now you can rename, choose, or add prefix to the symbols when importing other modules. See the "Using modules" section of the manual for the details. For the design decisions and implemtation details, see Import options: part one and Import options: part two.
- Efficient record types: A new module gauche.record provides ERR5RS (srfi-99) compatible record types. It is also upper compatible to srfi-9 records. (cf. ERR5RS records and beyond).
- More support for multithreaded applications: Thread-safe queue is added to util.queue (cf. Enhanced queue), and thread-pool feature is provided by the new module control.thread-pool. Continuations can be passed between threads; see below.
- Partial continuations: Partial (delimited) continuations are supported natively in gauche.partcont module. Also, a (full or partial) continuation captured in one thread can now be invoked by different thread. If it is a full continuation, an error is thrown if the continuation tries to return to the original thread context. (cf. Partial continuations and a fun of stack fiddling).
- Enhanced Windows support: On MinGW/MSYS build, non-console executable gosh-noconsole.exe is built as well as the ordinary gosh.exe. The former can be used to run Gauche scripts on Windows without creating a console window. If you install Gauche with the Windows binary installer, *.scm files will be associated with gosh-noconsole.exe. Windows binary installer also includes Gauche-gl by default. You can find some examples in C:\Program Files\Gauche\examples after installation. The os.windows module is added to provide Windows-specific interface. Currently it has MessageBox and Windows Console API (which was in gauche.termios before, but moved to os.windows). gauche-package compile is modified to work better on MinGW/MSYS environment. The directory argument for run-process (gauche.process) now works on Windows.
- New module: crypt.bcrypt: A module for Blowfish password hashing.
- New module: srfi-98: portable environment variable lookup support.
- New module: gauche.mop.propagate: Making object composition simpler.
- New module: rfc.json: JSON parsing and construction.
- Extended formals:
Built-in lambda, define etc. can
recognize optional and keyword arguments, a la Common Lisp.
For example, you can now write
- Changes
- The directory structure for Gauche installation has changed so that we can keep binary compatibility for the extension modules throughout 0.9.x releases. See New directory structure for the details. The extension libraries you've installed for Gauche 0.9 should keep working without recompilation and reinstallation.
- Now it is an error to pass a keyword argument that isn't expected by the callee. It used to be a warning.
- Regular expression re{,M} now means the same as re{0,M}, which is compatible to Oniguruma. Note: It used to be comatible to Perl, that is, re{,M} didn't have special meaning and matched the string literally. Now it should be written as re\{,M} to mean the literal sequence of an open brace, comma, number and a close brace.
- Improvements
- The compiler and the runtime got optimized more. The compiler now knows more about built-in procedures, and tries compile-time constant folding and/or inlining more aggressively (cf. Some improvements of constant propagation). For example, sxml.ssax can parse XML document a lot faster.
- ^ can be used in place of lambda, allowing more concise code. There's also convenience macros ^a, ^b, ... ^z and ^_ as abbreviations of lambda (a) etc. (cf. Shorter names)
- ~ is added for universal accessing operator. (~ x y) is the same as (ref x y), and (~ x y z) is the same as (ref (ref x y) z), and so on. It can be used with generalized setter, e.g. (set! (~ array i) x). See "Universal accessor" section of the manual for more details.
- define-syntax, let-syntax, and letrec-syntax are enhanced so that they can take a general expression in rhs, as far as it yields a syntactic transformer. This is a preparation to support different kind of macro transformers other than syntax-rules, although such alternative transformers are yet to be implemented. Cf. Supporting general transformers: Step 1.
- gauche.process: I/O redirection handling in run-process becomes more flexible. Cf. More control on redirection in run-process.
- rfc.http module now supports https connection (unix platforms only). Currently it relies on an external program (stunnel).
- A new procedure current-load-path allows the program to know the file name it is being loaded from.
- A new procedure .$ is introduced as an alternative name of compose.
- Regular expressions now got read-write invariance. Some internal regexp routines are made public, giving users an easy way to construct and analyze regexp programatically. See the "Inspecting and assembling regular expressions" section of the manual. See also Regexp read-write invariance.
- rfc.822: New procedure: rfc822-date->date.
- file.util: The procedure temporary-directory now became a parameter so that you can switch it when necessary. The default value is taken from (sys-tmpdir), which determines temporary directory in the recommended way of the platform; esp., it works on Windows native platforms. home-directory works on Windows, too. Procedures null-device and console-device are added to make it easier to write portable script across Unix and Windows platforms.
- util.queue: New proceduers: any-in-queue, every-in-queue.
- gauche.parseopt: When let-args encounters a command-line option that doesn't match any spec, it now raises a condition of type <parseopt-error> instead of <error>. The application can capture the condition to handle invalid command-line arguments.
- gauche.uvector: New procedure uvector-size to obtain number of octets actually to be written out when the given uvector is written out by write-block.
- dbm: A new procedure dbm-type->class allows an application to load appropriate dbm implementation at runtime. Utility scripts dbm/dump and dbm/restore are provided for easier backup and migration. See the manual entry for the details.
- Procedure slot-pop! is added for the consistency with other *-push!/pop! API pairs.
- When ref is used for object slot access, it can take default value in case the slot is unbound.
- Made (set! (ref list k) value) work.
- New procedures delete-keywords, delete-keywords!, tree-map-map, tree-map-for-each.
- unwind-protect allows multiple handlers, as in CL.
- sqrt now returns an exact number if the argument is exact and the result can be computed exactly. Also, R6RS's exact-integer-sqrt is added. Cf. Exact sqrt.
- gauche.parameter: Parameters can be used with generalized set!.
- The default-endian parameter is moved from binary.io module to the core, so that this parameter controls default endian of binary I/O in general. For example, read-block! and write-block of the gauche.uvector module now uses the value of this parameter as the default. A new procedure native-endian is added to retrieve the platform's native endianness.
- More R6RS procedures: inexact, exact, real-valued?, rational-valued?, integer-valued?, div, mod, div0, mod0.
- Bug fixes
- Fixed a bug that caused SEGV on some ARM processors, due to double precision floating-point number's alignment and endianness.
- rfc.http: Fixed a bug that http-get etc. hanged waiting for message body even when the server returns 204 or 304 response, which doesn't have a body. Fixed a bug that extraneous headers appeared when some keyword arguments were given to http-get etc. Also fixed mime handling to respect the content-transfer-encoding keyword argument.
- www.cgi: Fixed a bug in mime handling code that didn't parse option values in content-disposition header were unquoted. It caused a problem to dealing with Form POST data by certain clients.
- util.match: match-let* didn't work because required identifiers weren't exported. Also fixed an issue that the match procedure took exponential time in certain patterns.
- tree-map-pop-min! didn't update number of entries.
- Fixed a bug in glob which failed if an intermediate directory in the fully-specified path was searchable but unreadable (i.e. the mode bits are --x).
- In the VM, there was a code that violated strict aliasing rule of C, which yielded unintended optimization on some compilers. Thanks to NIIBE Yutaka for tracking down this subtle bug.
- Built-in numeric comparison procedures behaved incorrectly when NaN was involved. Half-floats (f16) routines didn't handle NaN well.
- char-set-complement had a bug when there was a single-character gap in the given charset.
- gauche.net: Fixed the bug that make-server-sockets failed if it tried to bind both IPv6 and IPv4 sockets, when the system defaults v6 sockets to be dual-stack. If the system has dual-stack sockets, the procedure doesn't need to create v4 socket by itself.
- gauche.dictionary: <bimap> was missing collection protocol.
- gauche.collection: Fixed <tree-map>
builder to allow :size keyword argument; without the
fix, (coerce-to
...) complained. - write went to infinite recursion when it tried to print (cdr #1='#1#).
- rational? now returns #f correctly for +inf.0, -inf.0 and +nan.0. These are the only numbers that are real but not rational.
- with-signal-handlers had a bug that sometimes incorrectly resets the handler to SIG_DFL. Thanks to Enami for providing the solution.
- srfi-19: updated to reflect new leap seconds.
- sxml.sxpath: Reflect upstream fixes of txpath and sxpath.
- rfc.ftp: A condition type <ftp-error> was documented but not exported.
- A character literal reader had a bug that recognize character names just by prefix match.
Gauche-gl 0.5
- Improved build process so that it can be easily compiled on MinGW/MSYS. The Windows binary installer includes precompiled Gauche-gl, with statically linked freeglut.
- Glut can have callbacks for each GL window.
- A module gl.simple-image is renamed to gl.simple.image. There's also a gl.simple.viewer module that provides simple skeleton of 3D viewer with camera control.
- Added support for gl-active-texture, gl-client-active-texture, gl-index.
- New procedures in module gl.math3d: vector4f-norm, vector4f-mul, vector4f-mul!, vector4f-div, matrix4f->translation, matrix4f->translation!, f32vector->matrix4f! vectors->quatf, vectors->quatf!, axes->quatf, axes->quatf!, quatf-conjugate!, quatf-set4!.
- gl-tex-image-2d can now take #f in place of texels array; it only allocates texture memory but not initialize it. It is useful when you want to render to the texture.
- New Features
Stay Informed
A mailing list for discussion and announcement of Gauche is now available, thanks for SourceForge. You can subscribe it from this page.