Kawa 1.14 released
Kawa 1.14 is now evailable from the usual places:ftp://ftp.gnu.org/pub/gnu/kawa/kawa-1.14.tar.gz (source code)
ftp://ftp.gnu.org/pub/gnu/kawa/kawa-1.14.jar (runnablejar
)
For a extended list of changes, see the news page. Below are some highlights.
More R7RS functions
The proposed new standard for Scheme R7RS has a number of new functions, and also extensions to existing functions. Kawa 1.14 implements (and documents) most of the new functions and extensions, and also implements a number of the syntactic changes:
make-list
, list-copy
,
list-set!
all the R7RS list procedures are implemented.
square
,
boolean=?
, string-copy!
,
digit-value
,
get-environment-variable
, get-environment-variables
,
current-second
, current-jiffy
,
jiffies-per-second
, and features
.
finite?
, infinite?
, and
nan?
are generalized to complex numbers.
write
, write-simple
,
and write-shared
are now consistent with R7RS.
string-copy
, string->list
,
and string-fill!
now take optional (start,end)-bounds.
All of the R7RS string functions are now implemented.
=>
syntax in case
form.
'|Hello\nworld|
.
The most important functionality still missing is support for the
library (module) system, and specifically the define-library
form. Of course Kawa has its own powerful
module system
which is in spirit quite compatible, but we still need to decide on the
pragmatic issues, including how modules are resolved to files
(probably using a module search path), and translation to class names.
Another feature to ponder is how to handle the R7RS exception
mechanism, and how it maps to JVM exceptions. We probably won't
implement all of the R7RS semantics, but it would be desirable
if (for example) some simple uses of guard
would work on Kawa.
Better support for multi-line strings and templates
SRFI-109 specifies a syntax for quasi-literal strings. These have a numbers of advantages over traditional double-quote literals. The are quasi-literals in the sense that they can contain embedded expressions. For example, ifname
has the value "John"
, then:
&{Hello &[name]!}evaluates to
"Hello John!"
.
Other benefits include control over indentation (layout),
built-in support for format
specifiers,
and a huge number of named special characters.
See the documentation and the
SRFI-109 specification for details.
Named quasi-literals (SRFI-108)
SRFI-108 can be viewed as a generalization of SRFI-109, in that the constructors have names, and you can define new constructors. This could be used for writing documentation (similar to the Scribble system), or constructing complex nested data structures (a generalization of XML).Better support for command scripts
A number of little improvements have been made to make it easier to write Kawa command scripts (simple one-file applications). Most importantly the documentation has been re-written. The value returned by(car (command-line))
(i.e. the "name" of the script/command invoked) is now accurate and
useful in many more cases; you also have the option of setting explicitly
it with the -Dkawa.command.name
option.
Experimental Java 8 support
There is some very preliminary support for next year's Java 8.
These are enabled if you run configure
with
the --with-java-source=8
(or if ant
auto-detects java.util.stream.Stream
).
This flag doesn't yet do very much:
- It sets the classfile major version number.
- It adds an optimized version of the
Stream#forEach
method forgnu.lists.SimpleVector
and its subclasses, which includes theFVector
used to implement Scheme vectors. - Enhance
gnu.lists.Consumer
to implementjava.util.function.Consumer
and the specialized classesjava.util.function.{Int,Long,Double}Consumer
.Because output port implements
gnu.lists.Consumer
, this means you can pass a port to theforEach
method:#|kawa:11|# ((['a 'b 'c 'd]:stream):forEach (current-output-port)) a b c d
Of course a large extent streams just Work Out of the Box
with Kawa data types, because they implement the apropriate
Java interfaces. For examples lists and vectors both implement
java.util.List
, and thus they automatically have
the stream
method.