"Control Features" SRFI (srfi:226) clarifies interactions between threads, dynamic environment, and (partial) continuations. It is a large srfi and we haven't completely supported it yet, though some of it is already available in this release.
Although the srfi is a compatible extension to R7RS, some of it is incompatible with the way Gauche has extended R7RS. Notably, parameters behave differently. We're switching to SRFI-226 semantics, though in this release the built-in API behaves in the compatibility mode. The manual section Parameters and dynamic states explains the changes in detail, though here's a short summary:
parameterize
will be for parameters, and a new macro,
temporarily, can handle parameter-like objects.
We named srfi module as srfi-N
; which was the tradition before R6RS.
Modern Scheme uses a list to name libraries, and srfis are named like
(srfi N)
in R7RS, which translates to srfi.N
in Gauche's way.
So there are following variations:
(use srfi-N)
(Traditional Gauche code)
(use srfi.N)
(Alternative in Gauche code)
(import (srfi N))
(R7RS code)
We've been using srfi-N
throught documentation by 0.9.12. From
0.9.13, we make srfi.N
official for Gauche code. srfi-N
still works and will keep working. (Internally, we used to have code in
srfi-N.scm
and srfi/N.scm
merely referred to it. They are
switched in this release.)
We also recommend to use (library srfi.N)
(Gauche specific)
or (library (srfi N))
(portable R7RS) in the cond-expand
feature test clause, instead of srfi-N
feature identifier.
;; Legacy way (cond-expand (srfi-114 ;; code assuming SRFI-114 ) (else ...)) ;; Recommended (cond-expand ((library srfi.114) (use srfi.114) ;; code assuming SRFI-114 ) (else ...)) ;; Recommended (R7RS portabile) (cond-expand ((library (srfi 114)) (import (srfi 114)) ;; code assuming SRFI-114 ) (else ...))
The legacy way was the only way until library
clause was introduced
in R7RS. Now using library
is the preferred way. The legacy way
conflates feature test and library import, which can have a pitfall.
For example, SRFI-101 redefines lots of Scheme primitive operators.
Using the legacy way to test srfi-101
availability triggers loading
srfi.101
into the current module, which shadows those primitive operators.
Most of the time that's not what you want.
Using the new way, you can import srfi.101
identifiers with prefix
or renaming so that they won't conflict with R7RS primitives.
If you set the enviornment variable GAUCHE_WARN_SRFI_FEATURE_ID
,
Gauche warns if it sees srfi-N
feature identifiers. We'll make it
default in future versions.
w-i-f
lists symbols starting with with-input-from-
.
(Segmented completion).
use
. (Hints for unbound variable error).
Gauche comes with several Scheme scripts, such as precomp
for
ahead-of-time compilation. They used to be installed in the toplevel
library directory so that they can be invoked as gosh precomp
etc.
However, as the number of such scripts grow, the library directory will
get cluttered. So we now install those scripts in tools
directory,
e.g. you can invoke it as gosh tools/precomp
. For easier transition,
the original path still works but a warning is printed. We'll drop this
compatibily feature in future, so rewrite your Makefiles whenever you
see the warning.
Added whole bunch of real-*
functions (e.g. real-exp)
that work only for
real numbers. They are faster than the generic (complex) version
and preferable in a speed-sensitive code.
See Real numerical functions.
We had undocumented real-domain functions such as %exp
.
They were intended to be internal building blocks and not to be used
directly. However, they were visible from gauche
module
so some existing code may be using them.
A compatibility module compat.real-elementary-functions
is available for transition.
format
enhancement
A bunch of new directives are new recognized by format.
~:w
(pretty print)
~&
(fresh line)
~
+ newline (line continuation)
~@r
(Roman numerals) - We support up to 499999, for Unicode
has Roman numeral for 100000.
~p
(plural)
The old API uses incomplete strings as octed sequences, which is gradually superseded by u8vectors (bytevectors) now. We revised their interface so that they use u8vector for octet streams, and allows to obtain the decoded result as either a string or a u8vector.
The old API still works, but deprecated.
Affected modules are as follows: rfc.hmac, util.digest, rfc.base64, rfc.quoted-printable.
Here's the new naming convention.
*-to
and
takes the class of desired return type: hmac-to,
hmac-message-to, digest-to,
digest-message-to, base64-decode-string-to,
quoted-printable-decode-string-to.
Also, rfc.base64 is updated to support RFC4648; it has an option to omit padding, and also base32 and base16 encodings are supported.
srfi.236
: independently
ls
).
c-w-c-c
with call-with-current-continuation
.
%exp
etc. See "Real-domain elementary functions" above.
test-equal
.
rotatef
.
:encoding
argument isn't given to
the file port open procedures.
(flush)
after displaying
prompt before reading user's input. Now, that flush is automatically done.
See port-link!, port-unlink!.
--omit-debug-source-info
to precomp not to add it.
#?=expr
always print expr
and its value, but sometimes it is too much and you want to
selectively print it when a condition is met. A new syntax
#??=test expr
prints expr
only when test
is satisfied.
There's also #??,
that corresponds to #?,
.
See debug-print-conditionally.
quasirename
constructed lists.
:metric
keyword arguments that specifies which metric
the results should be compared. See time-these/report.
:string-length
write control parameter.
load
search a file in *load-path*
.
(Note: In previous versions, load
returned #t
on success).
<time>
objects.
π
as the
constant, so as π/2
etc.
:immutable
.
See :immutable slot option.
gosh
: Extended -v
option. If you specify -v:0.9.12
,
for example,
it tries to run 0.9.12 but falls back to the current version if the
specified version isn't available (with warning).
Without colon, e.g. -v0.9.12
,
gosh
exits with an error in such case.
<json-mixin>
class to
allow easy serialization of Gauche objects to JSON.
:on-abnormal-exit :exit-code
option so that the
caller can get abnormal exit code of the subprocess.
--enable-multibyte
) for some time,
using utf8 as our only internal representation. You've seen warning
if you select internal encoding other than utf8. We urge you to switch
to utf8.
--enable-threads
option will be removed, and appropriate
thread subsystem for the platform will be automatically selected.
The number of libraries assuming thread support is growing, and
considering the case when threads are unavaiable is becoming a burden.
(read-bytevector 0)
returned EOF rather than 0.
Scm_SimpleMain()
, align exit status with script
execution. Issue:861.
current-output-port
etc. are now proper parameters. They were
a "parameter-like" objects (or "dynamic state" in our term), but
such objects no longer work with srfi-226 parameterize
.