These changes are in more-or-less reverse chronological order, with the most recent changes first.
See also the list of Qexo (XQuery)-specific changes.
Various bug-fixes, mostly related to packaging and --browse-manual
.
Updates for Java 9 and newer.
Support justification ~<
...~>
in format
(thanks to Helmut Eller).
Partial (and highly experimental) support for the Language Server Protocol (used by editors and IDEs for on-the-fly syntax checking and more).
Revert 3.0 change in allocating closure objects for inlined functions.
Enhancements to arrays to match SRFI 163 and SRFI 164:
The type gvector
is a “generalized vector”.
Add optional port parameter to format-array
.
The build-array
procedure takes an optional setter procedure.
New procedures array-shape
, ->shape
.
In array constructors, index keywords must be all or none:
[int[] length: 5 11 22]
or [int[] length: 5 1: 22 0: 11]
.
Various improvements in the Common Lisp implementation, by Helmut Eller.
New --max-errors
option.
The classes created by define-record-type
now extends
kawa.lang.Record
, which adds some conveniences, such as printing.
Support for source location ranges with an end position.
Various improvements when running under DomTerm include clickable error message locations.
Many bug-fixes and minor improvements.
Binary release are now built for Java 8. The repository source code is now set up for Java 8. (Building for Java 6 or 7 is still supported. Java 5 might also work, but has not been tested recently.)
Tested and updated for Java 9.
Most places where you could declare a new identifier
binding have been generalized to accept patterns,
including literals and boolean guard
s.
Related changes:
The form (!
creates
variable bindings by matching
the pattern
expression
)expression
against the pattern
.
It is like define-constant
but generalized to patterns.
The conditional match form (?
is similar to pattern
expression
)!
but can only be
used in conditional context.
If the match fails, the condition is false.
Repeat patterns and forms is a powerful experimental feature, similar to list comprehensions.
The new form match
form is a generalization
of case
using patterns.
The internal calling convention used for “apply” (ie. calling an unknown-at-compile-time procedure) has been completely changed.
New types for arguments list (possibly with keywords)
arglist
and argvector
along with an API for using them.
Major changes to strings:
Incompatible change: String literals are now
gnu.lists.IString
rather than java.lang.String
.
The advantage of using gnu.lists.IString
is that string-ref
and string-length
are (roughly) constant-time, rather than
having to linearly scan the string.
Incompatible change:
The procedures string-append
, string-map
,
substring
, list->string
, vector->string
,
string-downcase
, string-upcase
, string-foldcase
,
string-titlecase
, and the constructor string
return an immutable string (an IString
).
(The function string-copy
is similar to substring
,
but returns a mutable string.)
This is a work-in-progress with the goal of implementing
SRFI-140:
Other procedures will be changed to return immutable strings.
If you (import (scheme base))
standard procedures
such as string-append
will return mutable strings;
if you (import (kawa base))
the procedures will return immutable strings.
The command-line options --r5rs
or --r6rs
or --r7rs
override the default so these procedures return mutable strings.
Incompatible change:
Treating a string as a sequence is now simpler but possibly slower:
The I
’th element is now the I
’th Unicode code point.
Indexing with function-call syntax
(
is the same as string
i
)(string-ref
and
string
i
)(length
is the same as string
)(string-length
.
This applies to all classes that implement string
)java.lang.CharSequence
.
Indexing may be a linear-time operation (thus much slower),
unless the string is an IString
(in which case it is constant-time),
Incompatible change: Before, if a Java parameter type
was java.lang.String
Kawa would accept any value, converting it
using Object’s toString
method.
Now Kawa will reject an argument if it is not a java.lang.CharSequence
.
New procedures: istring?
, reverse-list->string
,
string-any
, string-concatenate
, string-concatenate-reverse
,
string-contains
, string-contains-right
,
string-count
, string-drop
, string-drop-right
,
string-every
, string-filter
, string-fold
,
string-fold-right
, string-for-each-index
,
string-index
, string-index-right
, string-join
,
string-map-index
, string-null?
,
string-prefix?
, string-prefix-length
,
string-repeat
, string-remove
, string-replace
,
string-skip
, string-skip-right
, string-split
,
string-suffix?
, string-suffix-length
,
string-tabulate
, string-take
, string-take-right
,
string-trim
, string-trim-right
, string-trim-both
,
string-unfold
, string-unfold-right
,
string->utf16
, string->utf16be
, string->utf16le
,
utf16->string
, utf16be->string
, utf16le->string
,
xsubstring
.
These follow SRFI-140 and return immutable strings.
(Some of these had previously been available in SRFI-13,
but the older versions return mutable strings.)
Incompatible change: Kawa traditionally followed Java in allowing you to pass an array with the “rest” arguments to a varargs method. For example, you could write:
(define args (Object[] 3 "cm")) (java.lang.String:format "length:%s%s" args)
This is no longer allowed. Instead, use the splice operator:
(java.lang.String:format "length:%s%s" @args)
Incompatible change: You used to be able to write a
type-specifier in a formal parameter or return type without
using ‘::
’, as in:
(define (incr (x int)) int (+ x 1))
This is no longer allowed, because it conflicts with the syntax for patterns. Instead you have to write:
(define (incr (x ::int)) ::int (+ x 1))
New type aliases bitvector
and c16vector
.
The latter is a uniform vector type for wrapping char[]
arrays.
You can convert a Java array (for example a int[]
to the corresponing uniform vector type
(for example u32vector
) using the as
pseudo-function or the corresponding
conversion procedure (for example ->u32vector
). The result shares storage with the
array, so changes in one will update the other.
The expression (module-class)
evaluates to the
containing module class.
Change the mangling for field and local variables names to match the Symbolic Freedom style.
Internally, expressions now record their ending position (line/column), in addition to the starting position.
The new procedure environment-fold
can be used to iterate
over the bindings of an environment.
Change in how closure objects are allocated for inlined functions. This sometimes reduces the number of objection allocations and also of helper classes, though in pathological cases it could cause objects to be retained (leak) where it didn’t before.
New command-line flag --warn-uninitialized
(by default on) to control warning about using uninitialized variables.
The pre-defined character sets are now based on Java 9’s Unicode 8 support.
Final 2.x release. Minor updates and fixes.
Moved Kawa’s source code repository (version control system) to use git, hosted at GitLab.
Issues (bugs, feature requests, etc) should now be reported using the GitLab Issue Tracker.
New with-docbook-stylesheets
to make it easier to build
the documentation with better functionality and look.
The command-line option console:jline-mouse=yes
enables moving the input cursor using a mouse click,
when using JLine in the REPL on common xterm-like terminals.
This is disabled by default because it conflicts with
other mouse actions, such as making a selection for copying text.
You can press shift to get the terminal’s standard mouse handling.
A binary release is no longer just a Kawa .jar
file,
but is now a zip
archive that also includes
shell/batch scripts for running Kawa, useful
third-party libraries, and the complete documentation in EPUB format.
The archives are named kawa-version.zip
.
The kawa --browse-manual
switch makes it easy to
browse the local documentation.
The (kawa pictures
) library lets
you create “picture” objects,
display them, transform them, combine them, and more.
There is a new API for pretty-printing.
Basic support for Java 9 (though still some issues).
Generated files like Makefile.in
and configure
are no
longer in the Subversion source code repository, though they are still
included in the distributed kawa-version.tar.gz
releases. The new
top-level script autogen.sh
should be run before
configure
.
Kawa traditionally followed Java in allowing you to pass an array with
the "rest" arguments to a varargs method. (A "varargs" method includes
Java varargs methods, as well as Kawa methods with a #!rest
parameter that is explicitly typed to be an array type.) For example,
you could write:
(define args (Object[] 3 "cm")) (java.lang.String:format "length:%s%s" args)
This is deprecated, and may stop working in a future release. Instead, use the splice operator:
(java.lang.String:format "length:%s%s" @args)
More options for range objects. For example,
you can write [1 by: 2 <=: 9]
.
Many enhancements to arrays and vectors:
Shape specifiers (used when creating an array) can now be one of a rank-2 array of low/high-bounds, as in SRFI-25; a vector of upper bounds; or a vector of ranges.
New type specifiers for array: array
is any array (i.e. any
gnu.lists.Array
); array
is the same restricted to rank
N
; N
array[etype]
or arrayN[etype]
restrict the types
of elements to etype
.
If the etype
is a primitive type (for example
array2[double]
) then indexing is optimized to method calls that
avoid object allocation.
Generalized array indexing: If A is an array (or a vector), then the
expression:
(A I J K ...)
in general evaluates to an array B such that:
(B i1 i2 ... j1 j2 ... k1 k2 ... ...)
is
(A (I i1 i2 ..) (J j1 j2 ...) (K k1 k2 ...) ...)
If an index I is an integer, it is treated as a zero-index array - a scalar.
For example: if (define B (A 2 [4 <: 10]))
then (B i)
is
(A 2 (+ i 4))
.
The procedure array-index-ref
is does the above indexing
explicitly: (array-index-ref A I J K ...)
is
(A I J K ...)
. The result is a read-only snapshot.
The procedure array-index-share
is like array-index-ref
but creates a modifiable view into argument array.
(build-array shape procedure)
is a general constructor for lazy
arrays: If A
is the result, then (A i j k ...)
is
(procedure [I J K ...])
.
array-transform
creates a view, with a mapping of the indexes.
Other new procedures (like those in the Racket math package):
array-size
, array-fill!
, array-copy!
,
array-transform
, array-reshape
, array-flatten
,
array->vector
, index-array
, build-array
.
Add Common Lisp array reader syntax (#rankA
) with
Guile
extensions, including reader sypport for multi-dimensional uniform
(primitive) arrays. This is also used when printing arrays.
New format-array
procedure print an array a tabular 2-dimensional
(APL-like) format. This format is used by default in the top-level of
the REPL.
Print bit-vectors using the Common Lisp (and Guile) reader syntax.
For example #*1100110
. Enhanced the reader to read this format.
Various REPL enhancements and new features:
The -w
switch to create a new REPL window
can be followed by various sub-options to control how and
where the window is created.
For example -wbrowser
creates a new window
using your default web browser.
Prompts are now normally specified using printf
-style templates.
The normal prompt template is specified by the input-prompt1
variable, while continuation lines use input-prompt2
. These can
be initialized by command-line options console:prompt1
and
console:prompt2
, or otherwise use language-specific defaults. You
can still use set-input-port-prompter!
to set a more general
prompt-procedure, but it is now only called for the initial line of a
command, not continuation lines.
The new --with-jline3
configure option builds support for the
JLine (version 3) library for
handling console input, similar to GNU readline.
Context-dependent command-completion (tab-completion) works when using JLine.
Various REPL enhancements when using DomTerm.
If you “print” an XML/HTML node, it gets inserted into the DomTerm objects. You print images, tables, fancy text, and more.
If you “print” a picture object or a BuferredImage
the picture is shown in the DomTerm console.
You can load or modify styles with the domterm-load-stylesheet
procedure.
When pretty-printing, calculation of line-breaks and indentation is handled by DomTerm. If you change the window width, DomTerm will dynamically re-calculate the line-breaks of previous pretten output. This works even in the case of a session saved to an HTML file, as long as JavaScript is enabled.
Hide/show buttons are emitted as part of the default prompt.
Multiple literals that have the same value (as in equal?
) get
compiled to the same object.
The syntax &<[expr]
is now equivalent to &<{&[expr]}
,
assuming expr
is an expression that evaluates to a string that
named an existing file. That file is read is the result is the contents
of the file (as if by (path-data expr)
).
Lots of little changes, and some big changes to sequences and strings.
Enhancements to the Kawa tutorial.
Added parameter
as a new typename, for Scheme parameter objects.
It can be parameterized (for example parameter[string]
) for
better type inference when "calling" (reading) the parameter.
We now define “interactive mode” as a REPL or a source module that uses the default global top-level environment or a source module imported/required by a interactive module. Interactive mode attempts to support dynamic re-definition and re-loading of function and other definitions. This is a work-in-progres; interactive mode currently uses extra indirection to support re-definitions (at a slight performance cost).
Various changes and fixes in Path/URI handling. Most significantly, the
resolve argorithm used by resolve-uri
was re-written to use the
algorithm from RFC-3986, rather than the obsolete RFC-2396 algorithm
used by java.net.URI.resolve
.
Change to mangle class and package name in Symbolic Freedom style. This means that class names and class filenames usually match the source file, even if special charaters are used, except for a small number of disallowed characters. Note this is currently only used for class and package names.
Allow 'synchronized
and 'strictfp
as access flags for
methods.
You can now have a type-specifier for define-variable
.
Better support for forward references between macros.
Added unsigned primitive integer types ubyte
, ushort
,
uint
, and ulong
. These are represented at run-time by the
corresponding signed types, but Kawa generates code to do unsigned
arithmethic and comparisons. Corresponding boxed classes are
gnu.math.UByte
, gnu.math.UShort
, gnu.math.UInt
, and
gnu.math.ULong
.
Improvements and unification of sequences and strings:
The new sequence
type generalizes lists, vectors, arrays,
strings, and more. It is implemented as the java.util.List
interface, but strings (java.lang.CharSequence
) and Java arrays
are compatible with sequence
and converted as needed.
The length
function is generalized to arbitrary sequences. (For
strings it uses the CharSequence.length
method, which returns the
number of (16-bit) code units. This is different from the
string-length
function, which returns the number of Unicode code
points.)
A new pseudo-character value #\ignorable-char
is introduced. It
is ignored in string-construction contexts.
The function-call syntax for indexing works for all sequences. If the
sequence is a string, the result is the Unicode (20-bit) scalar value at
the specified index. If index references the trailing surrogate of a
surrogate pair the result is #\ignorable-char
. This allows
efficient indexing of strings: Handing of surrogate pairs are handled
automatically as long as #\ignorable-char
is skipped.
Indexing of uniform vector types (such as s64vector
or
f64vector
or u16vector
) now return the “standard”
primitive type (such as long
or double
) or the new
unsigned primitive (such as ushort
). This improves performance
(since we can generally use primitive types), and improves compatibility
with Java arrays. Specifically, s64vector
now implements
Sequence<Long>
, and thus java.util.List<Long>
Note that
indexing a f64vector
returns a double
which as an object
is a java.lang.Double
, not the Kawa floating-point type
gnu.math.DFloNum
. The result is usually the same, but eqv?
might return a different result than previously.
The arguments to map
, for-each
, and vector-for-each
can now be any sequence (including strings and native arrays). The
arguments to vector-for-each
can now be arbitrary
java.util.List
values. All of these are inlined. If the sequence
type is known, more efficient custom code is generated.
A range represents an enumerable sequence, normally integers, but it is
represented compactly using the start value, the step (usually 1), and
size. There is a new convenient syntax for writing a range: if i
and j
are integers then [i <=: j]
is the sequence of
integers starting at i
and ending at j
(inclusive). You
can also write [i <=: j]
(excludes the upper bound),
[i >: j]
(counts down to j
, exclusive), and
[i >=: j]
(counts down to j
, inclusive).
You can use a sequences of integers to index a sequence. The result is
the sequence of the selected elements. In general
(seq [i0 ... in])
is [(seq i0) ... (seq in)]
. This work
well with ranges: (seq [i <: j])
is the subsequence of seq
from i
to j
(exclusive).
If the seq
is a string (a CharSequence
) then the result is
also a string. In this case the indexing behavior is slightly different
in that indexing selects (16-bit) code units, which are combined to a
string.
A new dynamic
type is like Object
. However, it forces
runtime lookup and type-checking, and supresses compile-time type check
and errors. (This is similar to C#. It is useful as an escape hatch if
we ever implement traditional strict static type-checking.)
Specifying the parameter type or return type of a function or method
without a ’::
’ is deprecated and results in a warning.
In --r7rs
mode: The ’l
’ exponent suffix of a number
literal creates a floating-point double, rather than a
BigInteger
.
Added the hyperbolic functions: sinh, cosh, tanh, asinh, acosh, atanh.
The equal?
function can now handle cyclic lists and vectors. So
can equal-hash
.
The command-line option --with-arg-count=N
allows finer control
of command-line-processing. It is used before an “action”, and
specifies the N
arguments following the action are set as the
command-line-arguments. After the action, command-line-processing
continues following those N
arguments.
Added the R6RS module (rnrs arithmetic bitwise)
.
The kawa.repl
argument processor now handles -D
options.
The new class
sub-form of import
allows you to import
classes, and give them abbreviated names, like the Java import
statement. The new form is more compact and convenient than
define-alias
.
You can also use a classname directly, as a symbol, instead of writing it in the form of a list:
(import (only java.lang.Math PI))
In the only
clause of the import
syntax you can now
directly rename, without having to write a rename
clause.
Changes in the calling-convention for --full-tailcalls
yields a
substantial speed-up in some situations.
The type of boolean literals #f
and #t
is now primitive
boolean
rather than java.lang.Boolean
.
General multi-dimensional arrays can be indexed with function call
notation. E.g. (arr i j k)
is equivalent to
(array-ref a i j k)
. You can also use set!
with either
array-ref
or function call notation.
The #!null
value (Java null
) is now considered false, not
true. Likewise for non-canonical false Boolean objects (i.e. all
instances of java.lang.Boolean
for which booleanValue
returns false, not just Boolean.FALSE
).
New standard libraries (kawa base)
and (kawa reflect)
.
You can now use patterns in the let
form and related forms.
Implemented the lambda lifting optimzation.
An expression that has type T is now considered compatible with a context requiring an interface type I only if T implements I (or T is Object). (Before they were considered possibly-compatible if T was non-final because the run-time class might be a subclass of T that implements I.)
New --console
flag forces input to be treated as an interactive
console, with prompting. This is needed on Windows under Emacs, where
System.console()
gives the wrong result.
You can now in a sub-class reference fields from not-yet-compiled super-classes. (This doesn’t work for methods yet.)
The (? name::type value)
operator supports conditional binding.
The (! name::type value)
operator supports unconditional binding;
it is similar to define-constant
, but supports patterns.
More efficient implementation of call-with-values
: If either
argument is a fixed-arity lambda expression it is inlined. Better
type-checking of both call-with-values
and values
.
Jamison Hope enhanced the support for quaternions, primarily the new
(kawa rotations)
library.
There are many new features, but the big one is R7RS compatibility.
New define-alias
can define aliases for static class members.
The treatment of keywords is changing to not be self-evaluating (in Scheme). If you want a literal keyword, you should quote it. Unquoted keywords should only be used for keyword arguments. (This will be enforced in a future release.) The compiler now warns about badly formed keyword arguments, for example if a value is missing following a keyword.
The default is now Java 7, rather than Java 6. This means the checked-in source code is pre-processed for Java 7, and future binary releases will require Java 7.
The behavior of parameters and fluid variables has changed. Setting a parameter no longer changes its value in already-running sub-threads. The implementation is simpler and should be more efficient.
The form define-early-constant
is similar to
define-constant
, but it is evaluated in a module’s class
initializer (or constructor in the case of a non-static definition).
Almost all of R7RS is now working:
Importing a SRFI library can now use the syntax
(import (srfi N [name]))
The various standard libraries such as (scheme base)
are
implemented.
The functions eval
and load
can now take an
environment-specifier. Implemented the environment
function.
Extended numerator
, denominator
, gcd
, and
lcm
to inexacts.
The full R7RS library functionality is working, including
define-library
The keyword export
is now a synonym for
module-export
, and both support the rename
keyword. The
prefix
option of import
now works.
The cond-expand
form now supports the library
clause.
Implemented make-promise
and delay-force
(equivalent to
the older name lazy
).
Changed include
so that by default it first seaches the directory
containing the included file, so by default it has the same effect as
include-relative
. However, you can override the search path with
the -Dkawa.include.path
property. Also implemented
include-ci
.
Implemented define-values
.
Fixed string->number
to correctly handle a radix specifier in the
string.
The read
procedure now returns mutable pairs.
If you need to use ...
in a syntax-rules
template you can
use (... template)
, which disables the special meaning of
...
in template
. (This is an extension of the older
(... ...)
.)
Alternatively, you can can write
(syntax-rules dots (literals) rules)
. The symbol dots
replaces the functionality of ...
in the rules
.
An underscore _
in a syntax-rules
pattern matches
anything, and is ignored.
The syntax-error
syntax (renamed from %syntax-error
)
allows error reporting in syntax-rules
macros. (The older
Kawa-specific syntax-error
procedure was renamed to
report-syntax-error
.)
Implemented and documented R7RS exception handling: The syntax
guard
and the procedures with-exception-handler
,
raise
, and raise-continuable
all work. The error
procedure is R7RS-compatible, and the procedures error-object?
,
error-object-message
, error-object-irritants
,
file-error?
, and read-error?
were implemented.
Implemented emergency-exit
, and modified exit
so
finally-blocks are executed.
Implemented exact-integer?
, floor/
, floor-quotient
,
floor-remainder
, truncate/
, truncate-quotient
, and
truncate-remainder
.
The letrec*
syntax is now supported. (It works the same as
letrec
, which is an allowed extension of letrec
.)
The functions utf8->string
and string->utf8
are now
documented in the manual.
The changes to characters and strings are worth covering separately:
The character
type is now a new primitive type (implemented as
int
). This can avoid boxing (object allocation)
There is also a new character-or-eof
. (A union of
character
and the EOF value, except the latter is encoded as -1,
thus avoiding object allocation.) The functions read-char and
peek-char
now return a character-or-eof
value.
Functions like string-ref
that take a character index would not
take into account non-BMP characters (those whose value is greater than
#xffff
, thus requiring two surrogate characters). This was
contrary to R6RS/R7RS. This has been fixed, though at some performance
cost . (For example string-ref
and string-length
are no
longer constant-time.)
Implemented a string-cursor
API (based on Chibi Scheme). Thes allow efficient indexing, based on
opaque cursors (actually counts of 16-bits char
s).
Optimized string-for-each
, which is now the preferred way to
iterate through a string.
Implemented string-map
.
New function string-append!
for in-place appending to a mutable
string.
New function string-replace!
for replacing a substring of a
string with some other string.
The SRFI-13 function string-append/shared
is no longer
automatically visible; you have to (import (srfi :13 strings))
or
similar.
The module-name
form allows the name to be a list, as in a
R6RS/R7RS-style library name.
The syntax @expression
is a splicing form. The
expression
must evaluate to a sequence (vector, list, array,
etc). The function application or constructor form is equivalent to all
the elements of the sequence.
The parameter object current-path
returns (or sets) the default
directory of the current thread.
Add convenience procedures and syntax for working
with processes: run-process
, process-exit-wait
,
process-exit-ok?
, &cmd
, &`
, &sh
.
The functions path-bytes
, and path-data
can
read
or write the entire contents of a file. Alternatively, you can use the
short-hand syntax: &<{pname}
&>{pname}
&>>{pname}
. These work with "blobs" which may be text or binary
depending on context.
The initial values of (current-output-port)
and
(current-error-port)
are now hybrid textual/binary ports. This
means you can call write-bytevector
and write-u8
on them,
making it possible for an application to write binary data to standard
output. Similarly, initial value of (current-input-port)
is a
hybrid textual/binary port, but only if there is no console (standard
input is not a tty).
Jamison Hope contributed support for quaternions, a generalization of complex numbers containing 4 real components.
Andrea Bernardini contributed an optimized implementation of case
expressions. He was sponsored by Google Summer of Code.
The kawa.sh
shell script (which is installed as kawa
when
not configuring with --enable-kawa-frontend
) now handles
-D
and -J
options. The kawa.sh
script is now also
built when usint Ant.
The cond-expand
features java-6
though java-9
are
now set based on the System
property "java.version"
(rather than how Kawa was configured).
An Emacs-style coding
declaration allows you to specify the
encoding of a Scheme source file.
The command-line option --debug-syntax-pattern-match
prints
logging importation to standard error when a syntax-rules
or
syntax-case
pattern matches.
SRFI-60 (Integers as Bits) is now fully implemented.
Ported SRFI-101.
These are immutable (read-only) lists with fast (logarithmic) indexing
and functional update (i.e. return a modified list). These are
implemented by a RAPair
class which extends the generic
pair
type, which means that most code that expects a standard
list will work on these lists as well.
The class kawa.lib.kawa.expressions
contains an experimental
Scheme API for manipulating and validating expressions.
Internal: Changed representation used for multiple values to an abstract class with multiple implementations.
Internal: Started converting to more standard Java code formatting and indentation conventions, rather than GNU conventions. Some files converted; this is ongoing work.
Internal: Various I/O-related classes moved to new package
gnu.kawa.io
.
Various changes to the configure+make
build framework: A C
compiler is now only needed if you configure with
--enable-kawa-frontend
. Improved support for building under
Windows (using MinGW/MSYS).
Support for building with GCJ was removed.
You can pass flags from the kawa
front-end to the java
launcher using -J
and -D
flags. The kawa
front-end
now passes the kawa.command.line
property to Java; this is used
by the (command-line)
procedure.
Various improvements to the shell-script handling, including re-written documentation.
Some initial support for Java 8.
More of R7RS is now working:
After adding list procedures make-list
, list-copy
,
list-set!
all the R7RS list procedures are implemented.
Other added procedures: square
, boolean=?
,
string-copy!
, digit-value
,
get-environment-variable
, get-environment-variables
,
current-second
, current-jiffy
, jiffies-per-second
,
and features
.
The predicates finite?
, infinite?
, and nan?
are
generalized to complex numbers.
The procedures write
, write-simple
, and
write-shared
are now consistent with R7RS.
String and character comparison functions are generalized to more than two arguments (but restricted to strings or characters, respectively).
The procedures string-copy
, string->list
, and
string-fill!
now take optional (start,end)-bounds. All of the
R7RS string functions are now implemented.
Support =>
syntax in case
form.
Support backslash-escaped special characters in symbols when inside
vertical bars, such as '|Hello\nworld|
.
The new functions and syntax are documented in the Kawa manual; look for the functions in the index.
Added define-private-alias
keyword.
Extended string quasi-literals
(templates) as specified by
SRFI-109. For
example, if name
has the value "John"
, then:
&{Hello &[name]!}
evaluates to: "Hello John!"
.
Named quasi-literal constructors as specified by SRFI-108.
A symbol having the form ->type
is a type conversion function
that converts a value to type
.
New and improved check for void-valued expressions in a context
requiring a value. This is controlled by the new option
--warn-void-used
, which defaults to true.
The datum->syntax
procedure takes an optional third parameter to
specify the source location. See testsuite/srfi-108-test.scm
for
an example.
Instead of specifying --main
the command line, you can now
specify (module-compile-options: main: #t)
in the Scheme file.
This makes it easier to compile one or more application (main) modules
along with other modules.
A change to the data structure used to detect never-returning procedure uses a lot less memory. (Kawa 1.13 implemented a conservative detection of when a procedure cannot return. This analysis would sometimes cause the Kawa compiler to run out of memory. The improved analysis uses the same basic algorithm, but with a more space-efficient “inverted” data structure.)
Multiple fixes to get Emacs Lisp (JEmacs) working (somewhat) again.
We now do a simple (conservative) analysis of when a procedure cannot return. This is combined with earlier and more precise analysis of reachable code. Not only does this catch programmer errors better, but it also avoids some internal compiler errors, because Kawa could get confused by unreachable code.
Implement 2-argument version of log
function, as specified by
R6RS and R7RS (and, prematurely, the Kawa documentation).
Implement the R7RS bytevector
functions. The bytevector
type is a synonym for older u8vector
type.
Implement R7RS vector
procedures. Various procedures now take
(start,end)-bounds.
Implement most of the R7RS input/output proecdures. Most significant enhancement is support for R7RS-conforming binary ports.
Various enhancements to the manual, including merging in lots of text from R7RS.
Improved Android support, including a more convenient Ant script contributed by Julien Rousseau. Also, documentation merged into manual.
Implement a compile-time data-flow framework, similar to Single Static Assignment. This enables better type inference, improves some warnings/errors, and enables some optimizations.
Jamison Hope added support for co-variant return types and bridge methods for generics.
Macros were improved and more standards-conforming:
datum->syntax
and syntax->datum
are preferred names for
datum->syntax-object
and syntax-object->datum
.
Implemented bound-identifier=?
and re-wrote implementation of
free-identifier=?
.
Implement unsyntax
and unsyntax-splicing
, along with the
reader prefixes #,
and #,@
.
New and improved lazy evaluation functionality:
Lazy values (resulting from delay
or future
) are
implicitly forced as needed. This makes “lazy programming” more
convenient.
New type promise
.
The semantics of promises (delay
etc) is now compatible with
SRFI 45.
“Blank promises” are useful for passing data between processes, logic
programmming, and more. New functions promise-set-value!
,
promise-set-alias!
, promise-set-exception!
, and
promise-set-thunk!
.
The stream functions of SRFI-41 were re-implemented to use the new promise functionality.
Different functions in the same module can be compiled with or without
full tailcall support. You can control this by using
full-tailcalls
in with-compile-options
. You can also
control full-tailcalls
using module-compile-options
.
Charles Turner (sponsored by Google’s Summer of Code) enhanced the printer with support for SRFI-38: External Representation for Data With Shared Structure.
Optimize tail-recursion in module-level procedures. (We used to only do this for internal functions, for reasons that are no longer relevant.)
Add support for building Kawa on Windows using configure+make (autotools) and Cygwin.
Some support for parameterized (generic) types:
Type[Arg1 Arg2 ... ArgN]
is more-or-less equivalent to Java’s:
Type<Arg1, Arg2, ..., ArgN>
New language options --r5rs
, --r6rs
, and --r7rs
provide better compatibility with those Scheme standards. (This is a
work-in-progress.) For example --r6rs
aims to disable Kawa
extensions that conflict with R6RS. It does not aim to disable all
extensions, only incompatible extensions. So far these extensions
disable the colon operator and keyword literals. Selecting --r5rs
makes symbols by default case-insensitive.
The special tokens #!fold-case
and #!no-fold-case
act like
comments except they enable or disable case-folding of symbols. The old
symbol-read-case
global is now only checked when a LispReader is
created, not each time a symbol is read.
You can now use square brackets to construct immutable sequences (vectors).
A record type defined using define-record-type
is now compiled to
a class that is a member of the module class.
Annotations are now supported. This example shows how to use JAXB annotations to automatically convert between between Java objects and XML files.
Prevent mutation of vector literals.
More R6RS procedures: vector-map
, vector-for-each
,
string-for-each
, real-valued?
, rational-valued?
,
integer-valued?
, finite?
, infinite?
, nan?
,
exact-integer-sqrt
.
SRFI-14 ("character sets") and SRFI-41 ("streams") are now supported, thanks to porting done by Jamison Hope.
Kawa now runs under JDK 1.7. This mostly involved fixing some errors in
StackMapTable
generation.
You can now have a class created by define-simple-class
with the
same name as the module class. For example
(define-simple-class foo ...)
in a file foo.scm
. The
defined class will serve dual-purpose as the module class.
Improvements in separating compile-time from run-time code, reducing the size of the runtime jar used for compiled code.
In the cond-expand
conditional form you can now use
class-exists:ClassName
as a feature “name” to tests that
ClassName
exists.
A new Kawa logo, contributed by Jakub Jankiewicz.
A new --warn-unknown-member
option, which generalizes
--warn-invoke-unknown-method
to fields as well as methods.
A new kawac
task, useful for Ant
build.xml
files, contributed by Jamison Hope.
New define-enum
macro contributed by
Jamison Hope.
Access specifiers 'final
and 'enum
are now allowed in
define-class
and related forms.
Optimized odd?
and even?
.
If you specify the type of a #!rest
parameter as an array type,
that will now be used for the "varargs" method parameter. (Before only
object arrays did this.)
When constructing an object and there is no matching constructor method,
look for "add
" methods in addition to "set
" methods. Also,
allow passing constructor args as well as keyword setters.
See here for the gory details.
New expand
function (contributed by Helmut Eller, and enabled by
(require 'syntax-utils)
) for converting Scheme expressions to
macro-expanded forms.
SAM-conversion: In a
context that expects a Single Abstract Method (SAM) type (for example
java.lang.Runnable
), if you pass a lambda you will get an
object
where the lambda implements the abstract method.
In interactive mode allow dynamic rebinding of procedures. I.e. if you re-define a procedure, the old procedure objects gets modified in-place and re-used, rather than creating a new procedure object. Thus calls in existing procedures will call the new version.
Fix various threading issues related to compilation and eval.
When format
returns a string, return a java.lang.String
rather than a gnu.lists.FString
. Also, add some minor
optimization.
Inheritance of environments and fluid variables now work properly for
all child threads, not just ones created using future
.
Now defaults to using Java 6, when compiling from source. The pre-built
jar
works with Java 5, but makes use of some Java 6 features
(javax.script
, built-in HTTP server) if available.
You can write XML literals in Scheme code
prefixed by a #
, for example:
#<p>The result is &{result}.</p>
New functions element-name
and attribute-name
.
Various Web server improvements. You
have the option of using JDK 6’s builtin
web-server for
auto-configued web pages.
Automatic import of web server functions, so you should not need to
(import 'http)
any more.
Kawa hashtables now extend java.util.Map
.
If a source file is specified on the kawa
command line without
any options, it is read and compiled as a whole module before it is run.
In contrast, if you want to read and evaluate a source file line-by-line
you must use the -f
flag.
You can specify a class name on the kawa
command line:
$ kawa fully.qualified.name
This is like the java
command. but you don’t need to specify the
path to the Kawa runtime library, and you don’t need a main
method (as long as the class is Runnable
).
The usual bug-fixes, including better handling of the ~F
format
directive; and fix in handling of macro hygiene of the
lambda
(bug
#27042).
Spaces are now optional before and after the ’::’ in type specifiers. The preferred syntax leave no space after the ’::’, as in:
(define xx ::int 1)
define-for-syntax
and begin-for-syntax
work.
You can now use car
, cdr
etc to work with syntax
objects that wrap lists, as in SRFI-72.
You can now define a package alias:
(define-alias jutil java.util) (define mylist :: jutil:List (jutil:ArrayList))
--module-static
is now the default. A new
--module-nonstatic
(or --no-module-static
) option can be
used to get the old behavior.
You can use access:
to specify that a field is 'volatile
or 'transient
.
You can now have type-specifiers for multiple variables in a do
.
Imported variables are read-only.
Exported variables are only made into Locations when needed.
The letter used for the exponent in a floating-point literal determines
its type: 12s2
is a java.lang.Float
, 12d2
is a
java.lang.Double
, 12l2
is a java.math.BigInteger
,
12e2
is a gnu.math.DFloat
.
Internal: Asking for a .class
file using
getResourceAsStream
on an ArrayClassLoader
will now open a
ByteArrayInputStream
on the class bytes.
A new disassemble
function.
If exp1
has type int
, the type of (+ exp1 1)
is now
(32-bit) int
, rather than (unlimited-precision) integer
.
Similar for long
expressions, other arithmetic operations (as
appropriate), and other untyped integer literals (as long as they fit in
32/64 bits respectively).
Many more oprimization/specializations of arithmetic, especially when argument types are known.
Top-level bindings in a module compiled with --main
are now
implicitly module-private, unless there is an explicit
module-export
.
SRFI-2
(and-let*
: an and
with local bindings, a guarded *
special form) is now supported.
The reader now supports shared sub-objects, as in
SRFI-38 and Common
Lisp: (#2=(3 4) 9 #2# #2#)
. (Writing shared sub-objects is not
yet implemented.)
A module compiled with --main
by default exports no bindings
(unless overriden by an explicit module-export
).
Factor out compile-time only code from run-time code. The new
kawart-version.jar
is smaller because it has less compile-time
only code. (Work in progress.)
More changes for R6RS compatibility:
The reader now recognizes +nan.0
, +inf.0
and variations.
The div
, mod
, div0
, mod0
,
div-and-mod
, div0-and-mod0
, inexact
and
exact
functions were implemented.
command-line
and exit
.
Support for javax.script
.
Support for regular expressions.
Performance improvements:
Emit iinc
instruction (to increment a local int
by a
constant).
Inline the not
function if the argument is constant.
If call-with-current-continuation
is only used to exit a block in
the current method, optimize to a goto
.
Generate StackMapTable
attributes when targeting Java 6.
Kawa can now inline a function with multiple calls (without code
duplication) if all call sites have the same return location
(continuation). For example: (if p (f a) (f b))
. Also mutually
tail-recursive functions are inlined, so you get constant stack space
even without --full-tailcalls
. (Thanks for Helmut Eller for a
prototype.)
A number of changes for R6RS compatibility:
The char-titlecase
, char-foldcase
, char-title-case?
library functions are implemented.
Imported variables are read-only.
Support the R6RS import
keyword, including support for renaming.
Support the R6RS export
keyword (though without support for
renaming).
Implemented the (rnrs hashtables)
library.
Implemented the (rnrs sorting)
library.
CommonLisp-style keyword syntax is no longer supported (for Scheme): A colon followed by an identifier is no longer a keyword (though an identifier followed by a colon is still a keyword). (One reason for this change is to support SRFI-97.)
The character names #\delete
, #\alarm
, #\vtab
are
now supported. The old names #\del
, #\rubout
, and
#\bel
are deprecated.
Hex escapes in character literals are supported. These are now printed where we before printed octal escapes.
A hex escape in a string literal should be terminated by a semi-colon, but for compatibily any other non-hex-digit will also terminate the escape. (A terminating semi-colon will be skipped, though a different terminator will be included in the string.)
A backslash-whitespace escape in a string literal will not only ignore the whitespace through the end of the line, but also any initial whitespace at the start of the following line.
The comment prefix #;
skips the following S-expression, as
specified by
SRFI-62.
All the
R6RS
exact bitwise arithmetic functions are now implemented and
documented in the manual. The new
standard functions (for example bitwise-and
) are now preferred
over the old functions (for example logand
).
If delete-file
fails, throws an exception instead of returning
#f
.
The code-base now by default assumes Java 5 (JDK 1.5 or newer), and
pre-built jar
files will require Java 5. Also, the Kawa source
code now uses generics, so you need to use a generics-aware
javac
, passing it the appropriate --target
flag.
New SRFIs supported:
In BRL text outside square brackets (or nested like ]this[
) now
evaluates to UnescapedData
, which a Scheme quoted string
evaluates to String
, rather than an FString
. (All of the
mentioned types implement java.lang.CharSequence
.)
You can now run Kawa Scheme programs on Android, Google’s mobile-phone operating system.
The macro resource-url
is useful for accessing resources.
A new command-line option --target
(or -target
) similar to
javac
’s -target
option.
If there is no console, by default create a window as if -w
was
specificed.
If a class method (defined in define-class
,
define-simple-class
or object
) does not have its parameter
or return type specified, search the super-classes/interfaces for
matching methods (same name and number of parameters), and if these are
consistent, use that type.
Trying to modify the car
or cdr
of a literal list now
throws an exception.
The .zip
archive created by compile-file
is now
compressed.
Java5-style varargs-methods are recognized as such.
When evaluating or loading a source file, we now always compile to bytecode, rather than interpreting “simple” expressions. This makes semantics and performance more consistent, and gives us better exception stack traces.
The Scheme type specifier <integer>
now handles automatic
conversion from java.math.BigInteger
and the java.lang
classes Long
, Integer
, Short
, and Byte
. The
various standard functions that work on <integer>
(for example
gcd
and arithmetic-shift
) can be passed (say) a
java.lang.Integer
. The generic functions such as +
and the
real function modulo
should also work. (The result is still a
gnu.math.IntNum
.)
If a name such as (java.util
) is lexically unbound, and there is
a known package with that name, return the java.lang.Package
instance. Also, the colon operator is extended so that
package:name
evaluates to the Class
for
package.name
.
`prefix:,expression
works - it finds a symbol in prefix
’s
package (aka namespace), whose local-name is the value of
expression
.
A quantity 3.0cm
is now syntactic sugar for
(* 3.0 unit:cm)
. Similarly:
(define-unit name value)
is equivalent to:
(define-constant unit:name value)
This means that unit names follow normal name-lookup rules (except being
in the unit
“package”), so for example you can have local unit
definitions.
You can specify whether a class has public or package access, and whether it is translated to an interface or class.
You can declare an abstract method by writing #!abstract
as its
body.
If a name of the form type?
is undefined, but type
is
defined, then treat the former as
(lambda (x) (instance? x type))
.
A major incompatible (but long-sought) change: Java strings (i.e.
java.lang.String
values) are now Scheme strings, rather than
Scheme symbols. Since Scheme strings are mutable, while Java
String
s are not, we use a different type for mutable strings:
gnu.lists.FString
(this is not a change). Scheme string literals
are java.lang.String
values. The common type for Scheme string is
java.lang.CharSequence
(which was introducted in JDK 1.4).
Scheme symbols are now instances of
gnu.mapping.Symbol
,
specifically the SimpleSymbol
class.
A fully-qualified class name such as java.lang.Integer
now
evaluates to the corresponding java.lang.Class
object. I.e. it is
equivalent to the Java term java.lang.Integer.class
. This assumes
that the name does not have a lexical binding, and that it exists
in the class-path at compile time.
Array class names (such as java.lang.Integer[]
) and primitive
types (such as int
) also work.
The older angle-bracket syntax <java.lang.Integer>
also works and
has the same meaning. It also evaluates to a Class
. It used to
evaluate to a Type
, so this is
a change.
The name bound by a define-simple-class
now evaluates to a
Class
, rather than a
ClassType
. A
define-simple-class
is not allowed to reference non-static
module-level bindings; for that use define-class
.
New convenience macro
define-syntax-case
.
Fix some problems building Kawa from source using configure+make
.
New types and functions for working with paths and URIs.
Reader macros URI, namespace, duration.
Simplified build using gcj, and added configure flag –with-gcj-dbtool.
If two “word” values are written, a space is written between them. A
word is most Scheme values, including numbers and lists. A Scheme string
is treated as a word by write
but by not display
.
A new --pedantic
command-line flag. It currently only affects the
XQuery parser.
The load-compile
procedure was removed.
The string printed by the --version
switch now includes the
Subversion revision and date (but only if Kawa was built using
make
rather than ant
from a checked-out Subversion tree).
Kawa development now uses the Subversion (svn) version control system instead of CVS.
Show file/line/column on unbound symbols (both when interpreted and when compiled).
Cycles are now allowed between require
’d modules. Also, compiling
at set of modules that depend on each other can now specified on the
compilation command line in any order, as long as needed require
forms are given.
The “colon notation” has been
generalized.. The syntax object:name
generally means to extract
a component with a given name
from object
, which may be an
object, a class, or a namespace.
New command-line options --debug-error-prints-stack-trace
and
--debug-warning-prints-stack-trace
provide stack trace on static
error messages.
The license for the Kawa software has been changed to the X11/MIT license.
A much more convenient syntax for working with Java arrays.
The same function-call syntax also works for Scheme vectors, uniform
vectors, strings, lists - and anything else that implements
java.util.List
.
The fields and methods of a class and its bases classes are in scope within methods of the class.
Unnamed procedures (such as lambda expressions) are printed with the source filename and line.
The numeric compare functions (=
, <=
, etc) and
number->string
now work when passed standard Java Number
objects (such as java.lang.Long
or java.math.BigDecimal
).
SRFI-10 is now
implemented, providing the #,(name args ...)
form. Predefined
constructor name
s so far are URI
and namespace
. The
define-reader-ctor
function is available if you
(require 'srfi-10)
.
A new --script
option makes it easier to write Unix shell
scripts.
Allow general URLs for loading (including the -f
flag),
compilation and open-input-file
, if the “file name” starts with
a URL “scheme” like http:
.
Classes defined (e.g. with define-simple-class
) in a
module can now mutually reference each other. On the other hand, you can
no longer define-class
if the class extends a class rather than
an interface; you must use define-simple-class
.
KawaPageServlet
now automatically selects language.
provide
macro.
quasisyntax
and the convenience syntax #`
, from
SRFI-72.
define-for-syntax
, syntax-source
, syntax-line
, and
syntax-column
, for better compatibility with mzscheme.
SRFI-34 (Exception
Handling for Programs), which implements with-exception-handler
,
guard
, and raise
, is now available, if you
(require 'srfi-34)
.
Also, SRFI-35
(Conditions) is available, if you (require 'srfi-35)
.
The case-lambda
form from
SRFI-16 is now
implemented more efficiently.
SRFI-69 “Basic hash
tables” is now available, if you (require 'hash-table)
or
(require 'srfi-69)
. This is an optimized and Java-compatible port
whose default hash function calls the standard hashCode
method.
A define-simple-class
can now have one (or more) explicit
constructor methods. These have the spcial name *init*
. You can
call superclass constructors or sibling constructors (this
constructor calls) using the (admittedly verbose but powerful)
invoke-special
form.
The runnable
function creates a Runnable
from a
Procedure
. It is implemented using the new class
RunnableClosure
, which is now also used to implement
future
.
The kawa
command can now be run “in-place” from the build
directory: $build_dir/bin/kawa
.
The special field name class
in (static-name type 'class)
or (prefix:.class)
returns the java.lang.Class
object
corresponding to the type
or prefix
. This is similar to
the Java syntax.
Contructing an instance (perhaps using make
) of a class defined
using define-simple-class
in the current module is much more
efficient, since it no longer uses reflection. (Optimizing classes
defined using define-class
is more difficult.) The constructor
function defined by the define-record-type
macro is also
optimized.
You can now access instance methods using this short-hand:
(*:methodname instance arg ...)
This is equivalent to: (invoke instance 'methodname arg ...)
You can now also access a fields using the same colon-notation as used
for accessing methods, except you write a dot before the field name:
(type:.fieldname)
;;
is like:
(static-field type 'fieldname)
.
(*:.fieldname instance)
;;
is like:
(field 'fieldname instance)
(type:.fieldname instance)
;;
is like:
(*:.fieldname (as instance type))
These all work with set!
- for example:
(set! (*:.fieldname instance) value)
.
In the above uses of colon-notation, a type
can be any one of:
- a namespace prefix bound using define-namespace
to a namespace
uri of the form "class:classname"
;
- a namespace prefix using define-namespace
bound to a
<classname>
name, which can be a fully-qualified class name or a
locally-declared class, or an alias (which might be an imported
class);
- a fully qualified name of a class (that exists at compile-time), as in
(java.lang.Integer:toHexString 123)
; or
- a <classname>
variable, for example:
(<list>:list3 11 12 13)
.
New fluid variables *print-base*
, *print-radix*
,
*print-right-margin*
, and *print-miser-width*
can control
output formatting. (These are based on Common Lisp.)
You can new emit elipsis (...
) in the output of a syntax
template using the syntax (... ...)
, as in other
syntax-case
implementations.
The args-fold
program-argument processor from
SRFI-37 is
available after you (require 'args-fold)
or
(require 'srfi-37)
.
The fluid-let
form now works with lexical bindings, and should be
more compatible with other Scheme implementations.
(module-export namespace:prefix)
can be used to export a
namespace prefix.
Static modules are now implemented more similarly to non-static modules.
Specifically, the module body is not automatically run by the class
initializer. To get the old behavior, use the new
--module-static-run
flag. Alternatively, instead of
(module-static #t)
use (module-static 'init-run)
.
Implement SRFI-39
"Parameter-objects". These are like anonymous fluid values and use the
same implementation. current-input-port
,
current-output-port
, and current-error-port
are now
parameters.
Infer types of variables declared with a let
.
Character comparisons (such as char-=?
, char-ci<?
)
implemented much more efficiently — and (if using Java5) work for
characters not in the Basic Multilingual Plane.
Major re-write of symbol and namespace handling. A
Symbol
is now immutable,
consisting of a "print-name" and a pointer to a
Namespace
(package). An
Environment
is a mapping
from Symbol
to
Location
.
Rename Interpreter
to
Language
and
LispInterpreter
to
LispLanguage
.
Constant-time property list operations.
Namespace-prefixes are now always resolved at compile-time, never at run-time.
(define-namespace PREFIX <CLASS>)
is loosely the same as
(define-namespace PREFIX "class:CLASS")
but does the right thing
for classes defined in this module, including nested or non-simple
classes.
Macros capture proper scope automatically, not just when using require. This allows some internal macros to become private.
Major re-write of the macro-handling and hygiene framework. Usable
support for syntax-case
; in fact some of the primitives (such as
if
) are now implemented using syntax-case
.
(syntax form)
(or the short-cut #!form)
evaluates to a
syntax object. (define-syntax (mac x) tr)
same as
(define-syntax mac (lambda (x) tr))
. The following non-hygienic
forms are equivalent:
(define-macro (macro-name (param ...) transformer) (define-macro macro-name (lambda (param ...) transformer)) (defmacro macro-name (PARAM ...) transformer)
Allow vectors and more general ellipsis-forms in patterns and templates.
A new configure switch --with-java-source=version
allows you to
tweak the Kawa sources to match Java compiler and libraries you’re
using. The default (and how the sources are distributed) is 2
(for "Java 2" – jdk 1.2 or better), but you can also select "1
"
(for jdk 1.1.x), and "5
" for Java 5 (jdk 1.5). You can also
specify a jdk version number: "1.4.1
" is equivalent to "2" (for
now). Note the default source-base is incompatible with Java 5 (or more
generally JAXB 1.3 or DOM 3), unless you also --disable-xml
.
Configure argument --with-servlet
[=servlet-api.jar
]
replaces --enable-servlet
.
Function argument in error message are now numbered starting at one. Type errors now give better error messages.
A new function calling convention, used for --full-tailcalls
. A
function call is split up in two parts: A
match0
/.../matchN
method checks that the actual arguments
match the expected formal arguments, and leaves them in the per-thread
CallContext
. Then after
the calling function returns, a zero-argument apply()
methods
evaluates the function body. This new convention has long-term
advantages (performance, full continuations), but the most immediate
benefit is better handling of generic (otherloaded) functions. There are
also improved error messages.
Real numbers, characters, Lisp/Scheme strings
(FString
) and symbols all now
implement the Comparable
interface.
In define-class
/define-simple-class
: [Most of this work
was funded by Merced Systems.]
You can specify
access:
['private
|'protected
|'publi
c|'package
]
to set the Java access permissions of fields and methods.
Methods can be static by using the access: 'static
specifier.
The reflective routines invoke
, field
,
static-field
, slot-ref
, slot-set!
can now access
non-public methods/fields when appropriate.
Such classes are no longer initialized when the containing module is loaded.
The expr
in init-form: expr
is now evaluated in the outer
scope.
A new init: expr
evalues expr
in the inner scope.
An option name following allocation:
can now be a string literal
or a quoted symbol. The latter is preferred: allocation: 'class
.
Added 'static
as a synonym for 'class
following
allocation:
.
Initialization of static field (allocation: 'class init: expr
)
now works, and is performed at class initialization time.
You can use unnamed “dummy fields” to add initialization-time actions not tied to a field:
(define-simple-class Foo () (:init (perform-some-action)))
Various fixes and better error messages in number parsing. Some optimizations for the divide function.
New framework for controlling compiler warnings and other features,
supporting command-line flags, and the Scheme forms
with-compile-options
and module-compile-options
. The flag
--warn-undefined-variable
is useful for catching typos.
Implementation funded by Merced
Systems.
New invoke-special
syntax form (implemented by Chris Dean).
New define-variable
form (similar to Common Lisp’s
defvar
).
KawaPageServlet
allows automatic loading and on-the-fly compilation in a servlet engine.
See
http://www.gnu.org/software/qexo/simple-xquery-webapp.html.
The default source-base requires various Java 2 features, such as
collection. However, make-select1
will comment out Java2
dependencies, allowing you to build Kawa with an older Java
implementation.
The -f
flag and the load function can take an absolute URL. New
Scheme functions load-relative
and base-uri
.
Imported implementation of cut and cute from SRFI-26 (Notation for Specializing Parameters without Currying).
The way top-level definitions (including Scheme procedures) are mapped into Java fields is changed to use a mostly reversible mapping. (The mapping to method names remains more natural but non-reversible.)
define-alias
of types can now be exported from a module.
New --no-inline
and --inline=none
options.
You can use define-namespace
to define “namespace aliases”.
This is used for the new short-hard syntax for method invocation:
(define-namespace Int32 "class:java.lang.Integer")
(Int32:toHexString 255)
=> "ff"
(Int32:toString (Int32:new "00255"))
=> "255"
Alternatively, you can write:
(java.lang.Integer:toHexString 255)
=> "ff"
SRFI-9
(define-record-type) has been implemented, and compiled to a
define-class
, with efficient code.
The configure option --with-collections
is now the default.
Unknowns are no longer automatically static.
If type not specified in a declaration, don’t infer it from it initial
value. If no return type is specified for a function, default to
Object
, rather than the return type of the body. (The latter
leads to undesirable different behaviour if definitions are
re-arranged.)
You can now define and use classes defined using object
,
define-class
, and define-simple-class
from the
“interpreter”, as well as the compiler. Also, a bug where inherited
fields did not get initialized has been fixed.
There are several new procedures useful for servlets.
Numerical comparisions (<
, <=
, etc) now generates
optimized bytecode if the types of the operands have certain known
types. including efficient code for <int>
, <long>
,
<double>
, and <integer>
. Much more code can now (with type
declaration) be written just as efficiently in Scheme as in Java.
There have been some internal re-arranging of how Expressions are processed. The Scheme-specific Translator type now inherits from Compilation, which replaces the old Parser class. A Complation is now allocated much earlier, as part of parsing, and includes a SourceMessages object. SourcesMessages now includes (default) line number, which is used by Compilation for the "current" line numbers. The ExpWalker class includes a SourceMessages instance (which it gets from the Compilation). CanInline.inline method now takes ExpWalker parameter. Checking of the number or parameters, and mapping known procedures to Java methods are now both done during the inlining pass.
The user-visible effect is that Kawa can now emit error mesages more cleanly more places; the inlining pass can be more agressive, and can emit better error messages, which yields better type information. This gives us better code with fewer warnings about unknown methods.
A new language front-end handles a tiny subset of XSLT. An example is the check-format-users test in gnu/xquery/testsuite/Makefile.
There are now converters between SAX2 and Consumer events, and a basic implementation of XMLReader based on XMLParser.
The function as-xml prints a value in XML format.
Srfi-0 (cond-expand), srfi-8 (receive), and srfi-25 (multi-dimensional arrays) are now implemented. So is srfi-1 (list library), though that requires doing (require ’list-lib).
The JEmacs code is being re-organized, splitting out the Swing-dependent code into a separate gnu.jemacs.swing package. This should make it easier to add JEmacs implementation without Swing.
The class gnu.expr.Interpreter has various new ’eval’ methods that are useful for evaluating Scheme/BRL/XQuery/... expressions from Java.
Kawa now uses current versions of autoconf, autoamke, and libtool, allowing the use of automake file inclusion.
The comparisons <<
, <=
, -
, >
, and =>
now compile to optimized Java arithmetic if both operands are
<int>
or a literal that fits in <int>
.
Generated HTML and Postscrpt documents are no longer included in the
source distribution. Get kawa-doc-version.tar.gz
instead.
(format #t ...) and (format PORT ...) now returns #!void instead of #t.
Support fluid bindings (fluid-let) for any thread, not just Future and main.
A Unix script header #!/PROGRAM
is ignored.
You can now take the same Kawa "web" program (written in Scheme, KRL/BRL, or XQuery) and run it as either a servlet or a CGI script.
There are a number of new functions for accessing HTTP requests and generating HTTP responses.
Kawa now supports a new experimental programming KRL (the "Kawa Report Language"). You select this language using –krl on the Kawa command link. It allows Scheme code to be inside template files, like HTML pages, using a syntax based on BRL (brl.sourceforge.net). However, KRL has soem experimental changes to both BRL and standard Scheme. There is also a BRL-compatibile mode, selected using –brl, though that currently only supports a subset of BRL functions.
If language is not explicitly specified and you’re running a source file (e.g. "java kawa.repl myscript.xql"), Kawa tried to derive the language from the the filename extension (e.g. "xql"). It still defaults to Scheme if there is no extension or the extension is unrecognized.
New command-line option –output-format alias –format can be used to over-ride the format used to write out top-level (repl, load) values.
XMLPrinter can now print in (non-well-formed-XML) HTML.
Changed lots of error messages to use pairs of single quotes rather than starting with a backquote (accent grave): ’name’ instead of ‘name’. Many newer fonts make the latter look bad, so it is now discouraged.
The types <String>
and <java.lang.String>
new behave
differently. The type <java.lang.String>
now works just like
(say) <java.util.Hashtable>
. Converting an object to a
<java.lang.String>
is done by a simple coercion, so the incoming
value must be a java.lang.String reference or null. The special type
<String>
converts any object to a java.string.String by calling
toString; it also handles null by specially testing for it.
For convenience (and backwards compatibility) Kawa uses the type
<String>
(rather than <java.lang.String>
) when it sees the
Java type java.lang
.String, for example in the argument to an
invoke
.
The default behaviour of ’[’ and ’] was changed back to be token (word) constituents, matching R5RS and Common Lisp. However, you can easily change this behaviour using the new setBrackMode method or the defaultBracketMode static field in ReadTable.
You can now build Kawa from source using the Ant build system (from Apache’s Jakarta project), as an alternative to using the traditional configure+make system. An advantage of Ant is that it works on most Java systems, without requiring a Unix shell and commands. Specifically, this makes it easy to build Kawa under MS-Windows. Thanks to James White for contributing this support.
Added (current-error-port) which does the obvious.
The new let-values and let-values* macros from srfi-11 provide a more convenient way to use multiple values.
All the abstract apply* and eval* methods now specify ’throws Throwable’. A bunch of code was changed to match. The main visible advantage is that the throw and primitive-throw procedures work for any Throwable without requiring it to be (confusingly) wrapped.
A new compilation flag –servlet generates a Servlet which can be deployed in a servlet engin like Tomcat. This is experimental, but it seesm to work for both Scheme source and XQuery source.
The interface gnu.lists.CharSequence was renamed to avoid conflitcs with the (similar) interface java.lang.CharSequence in JDK 1.4beta.
New –help option (contributed by Andreas Schlapbach).
Changed the code generation used when –full-tailcalls. It now is closer to that used by default, in that we don’t generate a class for each non-inlined procedure. In both cases calling an unknown procedure involves executing a switch statement to select a method. In addition to generating fewer classes and simplifying one of the more fragile parts of Kawa, it is also a step towards how full continuations will be implemented.
Changed the convention for name "mangling" - i.e. how Scheme names are
mapped into Java names. Now, if a Scheme name is a valid Java name it is
used as is; otherwise a reversible mangling using "$" characters is
used. Thus the Scheme names '<
and '$Leq
are both mapped
into the same Java name "$Leq"
. However, other names not
containing "$
" should no longer clash, including pairs like
"char-letter?
" and "charLetter?
" and "isCharLetter
"
which used to be all mapped to "isCharLetter
". Now only names
containing "$
" can be ambiguous.
If the compiler can determine that all the operands of (+ ...) or (- ...) are floating-point, then it will generate optimized code using Java primitive arithmetic.
Guile-style keyword syntax ’#:KEYWORD’ is recognized. (Note this conflicts with Common Lisp syntax for uninterned symbols.)
New syntax forms define-class and define-simple-class allow you to define classes more easily. define-class supports true multiple inheritance and first class class values, where each Scheme class is compiled to a pair of an inteface and a class. define-simple-class generates more efficient and Java-compatible classes.
A new language "xquery" implements a (so far small subset of) XQuery, the draft XML Query languaage.
Various internal (Java API) changes: Changes to gnu.expr.Interpreter to make it easier to add non-Lisp-like languages; gnu.lists.Consumer now has an endAttribute method that need to be called after each attribute, rather than endAttributes that was called after all of them.
If configured with –with-gcj, Kawa builds and intalls a ’gckawa’ script to simlify linking with needed libraries.
The setter
function is now inlined, and
(set! (field X 'N) V)
and (set! (static-field <T> "N) V)
are now inlined.
If configured --with-gcj
, then a gckawa
helper script is
installed, to make it easier to link Kawa+gcj-compiled applications.
The JEmacs code now depends on CommonLisp, rather than vice versa, which means Commonlisp no longer depends on Swing, and can be built with GCJ. CommonLisp and JEmacs symbols are now implemented using Binding, not String.
Kawa now installs as a .jar file (kawa.jar symlinked to kawa-VERSION.jar), rather than a collection of .class files.
The Kawa manual includes instructions for how to build Kawa using GCJ, and how to compile Scheme code to a native executable using GCJ.
Kawa now has builtin pretty-printer support, using an algorithm from Steel Bank Common Lisp converted from Lisp to Java. The high-level Common Lisp pretty-printing features are mostly not yet implemented, but the low-level support is there. The standard output and error ports default to pretty-printing.
A new formatting framework uses the Consumer interface from gnu.lists. You can associate a format with an output port. Common Lisp and JEmacs finally print using their respective syntaxes.
All output ports (OutPort instances) are now automatically flushed on program exit, using a new WriterManager helper class.
The new commmand-line option –debug-print-expr causes the Expression for each expression to be printed. The option –debug-print-final-expr is similar, but prints Expressions after optimization and just before compilation. They are printed using the new pretty-printer.
Changed calling convention for –full-tailcalls to write results to a Consumer, usually a TreeList or something to be printed. A top-level ModuleBody now uses the same CpsProcedure convention. This is useful for generating xml or html.
New libtool support allows kawa to be built as a shared library.
The new configure flag –with-gcj uses gcj to compile Kawa to both .class files and native code. This is experimental.
The reader (for Scheme and Lisp) has been re-written to be table-driven, based on the design of Common Lisp readtables.
The new gnu.lists package has new implementations of sequence-related classes. It replaces most of gnu.kawa.util. See the package.html file.
If the expected type of a non-unary +
or -
is <int>
or <long>
and the operands are integeral types, then the operands
will converted to the primitive integer type and the addition or
subtraction done using primitive arithmetic. Similarly if the expected
type is <float>
or <long>
and the operands have
appropriate type. This optimization an make a big performance
difference. (We still need to also optimize compare operations like
(< x y)
to really benefit from <int>
declarations of loop
variables.)
The implementation of procedure closures has been changed to basically be the same as top-level procedures (except when –full-tailcalls is specified): Each procedure is now an instance of a ModuleMethod, which each "frame" is an instance of ModuleBody, just like for top-level functions. This sometimes reduces the number of classes generated, but more importantly it simplifies the implementation.
A new gnu.xml
package
contains XML-related code, currently an XML parser and printer, plus
some XPath support. The class
gnu.lists.TreeList
(alias
<document>
) is useful for compactly representing nested
structures, including XML documents. If you (require 'xml)
you
will get Scheme interfaces (print-as-xml
and
parse-xml-from-url
) to these classes.
New package gnu.kawa.functions, for primitive functions (written in Java).
The map and for-each procedure is now inlined. This is most especially beneficial when it allows the mapped-over procedure to also be inlined, such as when that procedure is a lambda expression.
Added documentation on compiling with Jikes. Renamed some classes to avoid warning when compiling with Jikes.
The reverse! procedure was added.
Internal changes: * If a variable reference is unknown, create a Declaration instance with the IS_UNKNOWN flag to represent an imported binding. * The ExpWalker framework for "tree walking" Expressions had a bit of reorganization. * New package gnu.kawa.functions, for primitive functions (written in Java).
Added a hook for constant-folding and other optimization/inlining at traversal (ExpWalker) time. Optimization of + and - procedures to use primitive Java operations when the operands are primitive types.
Implementation of SRFI-17. Change the definitions of (set! (f x ...) val) to ((setter f) x ... val), rather then the old ((setter f) val x ...). You can now associate a setter with a procedure, either using make-procedure or set-procedure-property!. Also, (setter f) is now inlined, when possible.
Internally, Syntax (and hence Macro) no longer extend Declaration.
Various Java-level changes, which may be reflected in Scheme later: * gnu.kawa.util.Consumer interface is similar to ObjectOutput and SAX’s ContentHandler interfaces. * A gnu.expr.ConsumerTarget is used when evaluating to an implicit Consumer. * These interfaces will make it easy to write functional-style but efficient code for transforming data streams, including XML. * gnu.kawa.util.FString is now variable-size.
The bare beginnings of Common Lisp support, enabled by the –commonlisp (or –clisp) command line option. This is so far little more than a hack of the EmacsLisp support, but with lexical scoping and CL-style format.
JEmacs news:
Define emacs-version as Kawa version but with leading 0 instead of 1. For example, the current value is "0.6.68 JEmacs".
New testsuite directory.
Improved autoload framework. Handle ELisp autoload comments.
Handle escape and meta-key.
Handle lot more of ELisp.
Lots more is now done in ELisp, using .el files imported from XEmacs.
Incomplete support for setting mark, including using selection.
Basic (but incomplete) implementation of (interactive spec).
Common Lisp extensions: typep, default arguments.
A new status.html file to note what works and what doesn’t.
You can now specify in define
and define-private
the type
of a variable. If the variable is module-level,
(define name :: <type> value)
creates a field named
“name
” having the specified type and initial value. (If type is
not specified, the default is not Object
, but rather a
Binding
that contains the variable’s value.)
You can now define the type of a module-level variable: In (define[-private] :: type expression) New (define-constant name [:: type] expression) definition form.
A procedure can now have arbitrary properties associated with it. Use procedure-property and set-procedure-property! to get and set them.
The new procedure make-procedure creates a generic procedure that may contain one or more methods, as well as specified properties.
New declaration form define-base-unit. Both it and define-unit have been re-implemented to be module-safe. Basically ’(define-unit ft 12in)’ is sugar for ’(define-constant ft$unit (... (* 12 in$unit)))’, where ft$unit and in$unit are standard identifiers managed by the module system. Also, the output syntax for units and quantities is cleaner.
The new declaration (module-export name ...) allows control over the names exported from a module. The new declaration (module-static ...) allows control over which definitions are static and which are non-static. This makes it easier to use a module as a Java class.
Procedures names that accidentally clash with inherited method names (such as "run") are now re-named.
Simple aliases (define-aliases defining an alias for a variable name) are implemented more efficiently.
The package hierarchy is getter cleaner, with fewer cyclic dependencies: The gnu.math package no longer has any dependencies on kawa.* or gnu.*. Two classes were moved from gnu.text to other classes, avoiding another cyclic package dependency between gnu.text and gnu.mapping. The new gnu.kawa.lispexpr is for compile-time handling of Lisp-like languages.
Compliation of literals has been re-done. A class that can be used in a literal no longer needs to be declared as Compilable. Instead, you declare it as implementaing java.io.Externalizable, and make sure it has appropriate methods.
All the standard "data" types (i.e. not procedures or ports) now implement java.io.Externalizable, and can thus be serialized. If they appear in literals, they can also be compiled.
Created a new class gnu.kawa.util.AbstractString, with the Scheme alias
<abstract-string>
. The old gnu.kawa.util.FString now extends
AbstractString. A new class CharBuffer provides an growable buffer, with
markers (automatically-adjusted positions). Many of the Scheme
<string>
procedures now work on <abstract-string>
. The
JEmacs BufferContnat class (contains the characters of a buffer) now
extends CharBuffer.
Some JEmacs changes to support a "mode" concept, as well as preliminary support for inferior-process and telnet modes.
New section in manual / web page for projects using Kawa.
The record feasture (make-record-type etc) how handles "funny" type and fields names that need to be "mangled" to Java names.
Re-did implementation of define-alias. For example, you can define
type-aliases:
(define-alias <marker> <gnu.jemacs.buffer.Marker>)
and then use <marker> instead of <gnu.jemacs.buffer.Marker>.
(field array 'length)
now works.
Added documentation to the manual for Homogeneous numeric vector datatypes (SRFI-4).
You can now specify characters using their Unicode value: #\u05d0 is alef.
Kawa now uses a more mnemonic name mangling Scheme. For example, a
Scheme function named <=
would get compiled to method
$Ls$Eq
.
There is now working and useful module support, thought not all features
are implemented. The basic idea is that a module can be any class that
has a default constructor (or all of whose fields and methods are
static); the public fields and methods of such a class are its exported
definitions. Compiling a Scheme file produces such a module. Doing:
(require <classname>)
will create an anonymous instance of <classname>
(if needed), and
add all its exported definitions to the current environment. Note that
if you import a class in a module you are compiling, then an instance of
the module will be created at compile-time, and imported definitions are
not re-imported. (For now you must compile a module, you cannot just
load it.)
The define-private keyword creates a module-local definition.
New syntax to override some properties of the current module:
(module-name <name>)
overrides the default name for a module.
(module-extends <class>)
specifies the super-class.
(module-implements <interface> ...)
specfies the implemented
interfaces.
The syntax: (require ’keyword) is syntactic sugar for (require <classname>) where the classname is find is a "module catalog" (currently hard-wired). This provides compatibility with Slib. The Slib "features" gen-write, pretty-print, pprint-file, and printf are now available in Kawa; more will be added, depending on time and demand. See the package directory gnu/kawa/slib for what is available.
A lot of improvements to JEmacs (see JEmacs.SourceForge.net).
kawa-compiled-VERSION.zip is replaced by kawa-compiled-VERSION.jar.
You can now use Kawa to generate applets, using the new –applet switch, Check the "Applet compilation" section in the manual. Generating an application using the –main flag should work again. Neither –applet nor –main has Scheme hard-wired any more.
A new macro ‘(this)’ evaluates to the "this object" - the current instance of the current class. The current implementation is incomplete, and buggy, but it will have to do for now.
The command-line argument -f FILENAME will load the same files types as load.
When a source file is compiled, the top-level definitions (procedures, variables, and macros) are compiled to final fields on the resulting class. This are not automatically entered into the current environment; instead that is the responsibility of whoever loads the compiled class. This is a major step towards a module system for Kawa.
There is a new form define-private which is like define, except that the defined name is not exported from the current module.
A procedure that has optional arguments is now typically compiled into multiple methods. If it’s a top-level procedure, these will be methods in the modules "ModuleBody" class, with the same (mangled) name. The compiler can in many cases call the appropriate method directly. Usually, each method takes a fixed number of arguments, which means we save the overhead of creating an array for the arguments.
A top-level procedure declared using the form (define (NAME ARS ...) BODY ..) is assumed to be "constant" if it isn’t assigned to in the current compilation unit. A call in the same compilation unit will now be implemented as a direct method call. This is not done if the prcedure is declared with the form: (define NAME (lambda (ARGS ,,,) BODY ...)
gnu.expr.Declaration no longer inherits from gnu.bytecode.Variable.
A gnu.mapping.Environment now resolves hash index collisions using "double hashing" and "open addressing" instead of "chaining" through Binding. This allows a Binding to appear in multiple Environments.
The classes Sequence, Pair, PairWithPosition, FString, and Char were moved from kawa.lang to the new package gnu.kawa.util. It seems that these classes (except perhaps Char) belong together. The classes List and Vector were also moved, and at the same time renamed to LList and FVector, respectively, to avoid clashed with classes in java.util.
New data types and procedures for "uniform vectors" of primitive types were implemented. These follow the SRFI-4 specification, which you can find at http://srfi.schemers.org/srfi-4/srfi-4.html .
You can now use the syntax name :: type
to specify the type of a
parameter. For example:
(define (vector-length x :: <vector>) (invoke x 'length))
The following also works:
(define (vector-length (x :: <vector>)) ...)
.
(define-member-alias name object [fname])
is new syntactic sugar
for (define-alias name (field object fname))
, where the default
for fname
is the mangling of name
.
The new function ‘invoke’ allows you to call a Java method. All of ‘invoke’, ‘invoke-static’ and ‘make’ now select the bets method. They are also inlined at compile time in many cases. Specifically, if there is a method known to be definitely applicable, based on compile-time types of the argument expressions, the compiler will choose the most specific such method.
The functions slot-ref, slot-set!, field, and static-field are now inlined by the compiler when it can.
Added open-input-string, open-output-string, get-output-string from SRFI-6. See http://srfi.schemers.org/srfi-6/srfi-6.html.
The manual has a new section "Mapping Scheme names to Java names", and a new chapter "Types". The chapters "Extensions", "Objects and Classes", and "Low-level functions" have been extensivley re-organized.
The Kawa license has been simplified. There used to be two licenses: One for the packages gnu.*, and one for the packages kawa.*. There latter has been replaced by the former. The "License" section of the manual was also improved.
There is a new package gnu.kawa.reflect. Some classes that used to be in kawa.lang or kawa.standard are now there.
The procedures slot-ref and slot-set! are now available. They are equivalent to the existing ‘field’, but reading a field ‘x’ will look for ‘getX’ method if there is no public ‘x’ field; writing to a field will look for ‘setX’.
The procedure ‘make’ makes it convenient to create new objects.
There is now a teaser screen snapshot of "JEmacs" at http://www.bothner.com/~per/papers/jemacs.png.
The html version of the manual now has a primitive index. The manual has been slightly re-organized, with a new "Classes and Objects" chapter.
The new functions invoke-static and class-methods allow you to call an arbitary Java method. They both take a class specification and a method name. The result of class-methods is a generic procedure consisting of those methods whose names match. (Instance methods are also matched; they are treated the asme as class methods with an extra initial argument.) The invoke-static function also takes extra arguments, and actually calls the "best"-matching method. An example:
(invoke-static <java.lang.Thread> 'sleep 100)
Many fewer classes are now generated when compiling a Scheme file. It used to be that each top-level procedure got compiled to its own class; that is no longer the case. The change should lead to faster startup and less resource use, but procedure application will probably be noticably slower (though not so much slower as when reflection is used). The reason for the slowdown is that we in the general case now do an extra method call, plus a not-yet-optimized switch statement. This change is part of the new Kawa module system. That will allow the compiler to substitute direct methods calls in more cases, which I hope will more than make up for the slowdown.
A Scheme procedure is now in general compiled to a Java method whose name is a "mangling" of the Scheme procedure’s name. If the procedure takes a variable number of parameters, then "$V" is added to the name; this indicates that the last argument is a Java array containing the rest of the arguments. Conversely, calling a Java method whose name ends in "$V" passes any excess arguments in the last argument, which must be an array type.
Many changes to the "Emacs-emulation" library in gnu.jemacs.buffer: * Implemented commands to read and save files. * We ask for file and buffer names using a dialog pop-up window. * Split windows correctly, so that the windows that are not split keep their sizes, the windows being split gets split as specified, and the frame does not change size. Now also handles horizonal splits. * Fairly good support for buffer-local keymaps and Emacs-style keymap search order. A new class BufferKeymap manages the active keymaps of a buffer. Multi-key key-sequences are handled. Pending prefix keys are remembered on a per-buffer basis (whereas Emacs does it globally).
There is now some low-level support for generic procedures.
The R5RS primitives let-syntax and letrec-syntax for defining local syntax extensions (macros) should now work. Also define-syntax works as an internal definition. All of these should now be properly "hygienic". (There is one known exception: symbols listed among the literals lists are matched as raw symbols, rather that checking that the symbol has the same binding, if any, as at the defining site.) The plan is to support general functions as hygienic rewriters, as in the Chez Scheme "syntax-case" system; as one part of that plan, the syntax-case primitive is available, but so far without any of the supporting machinary to support hygiene.
The read-line procedure was added. This allows you to efficiently read a line from an input port. The interface is the same as scsh and Guile.
define-alias now works both top-level and inside a function.
Optimized eqv? so if one of the arguments is constant and not Char or Numeric, inline it the same way eq? is. (This helps case when the labels are symbols, which help the "lattice" benchmark.) ???
The Emacs-related packages are now grouped under a new gnu.jemacs package.
Improved framework for catching errors. This means improved error messages when passing a parameter of the wrong type. Many standard procedures have been improved.
Simplified, documented, and tested (!) procedure for building Kawa from source under Windows (95/98/NT).
New macros trace and untrace for tracing procedures. After executing (trace PROCEDURE), debugging output will be written (to the standard error port) every time PROCEDURE is called, with the parameters and return value. Use (untrace PROCEDURE) to turn tracing off.
New utility functions (system-tmpdir) and (make-temporary-file [format]).
A new (unfinished) framework supports multiple languages. The command-line option –elisp selects Emacs Lisp, while –scheme (the default) selects Scheme. (The only difference so far is the reader syntax; that will change.)
The ‘format’ function now provides fairly complete functionality for
CommonLisp-style formatting. (See the Comon Lisp hyperspec at
http://www.harlequin.com/education/books/HyperSpec/Body/sec_22-3.html.)
The floating point formatters (~F, ~E, ~G, ~$) now pass the formatst.scm
test (from Slib, but with some "fixes"; in the testsuite directory).
Also, output ports now track column numbers, so ~T
and ~&
also work correctly.
A new package gnu.emacs provides various building blocks for building an Emacs-like text editor. These classes are only compiled when Kawa is configured with the new –with-swing configuration option. This is a large initial step towards "JEmacs" - an Emacs re-implemented to use Kawa, Java, and Swing, but with full support (using gnu.elisp) for traditional Emacs Lisp. For more imformation see gnu/emacs/overview.html.
A new configuration option –with-swing can be used if Swing is available. It is currently only used in gnu.emacs, but that may change.
Kawa is now "properly tail-recursive" if you invoke it with the –full-tail-calls flag. (Exception: the eval procedure does not perform proper tail calls, in violation of R5RS. This will be fixed in a future release.) Code compiled when –full-tail-calls is in effect is also properly tail-recursive. Procedures compiled with –full-tail-calls can call procedures compiled without it, and vice versa (but of course without doing proper tail calls). The default is still –no-full-tail-calls, partly because of performance concerns, partly because that provides better compatibility with Java conventions and tools.
The keywords let (including named let), let*, and letrec support type specifiers for the declared variables For example:
(let ((lst :: <list> (foo x))) (reverse lst))
Square brackets [ ... ] are allowed as a synonym of parentheses ( ... ).
A new command-line flag –server PORT specifies that Kawa should run as a telnet server on the specified PORT, creating a new read-eval-print loop for each connection. This allows you to connect using any telnet client program to a remote "Kawa server".
A new front-end program, written in C, that provides editing of input lines, using the GNU readline library. This is a friendlier interface than the plain "java kawa.repl". However, because kawa.c needs readline and suitable networking library support, it is not built by default, but only when you configure Kawa with the –enable-kawa-frontend flag.
The way Scheme names are mapped ("mangled") into Java identifiers is now more natural. E.g. "foo-bar?" now is mapped to "isFooBar".
New syntax (object (SUPERS ...) FIELD-AND-METHODS ...) for creating a new object instance of an anonymous class. Now fairly powerful.
New procedures field and static-field for more convenient field access.
Syntactic sugar: (lambda args <type> body)
->
(lambda args (as <type> body))
. This is especially useful for
declaring methods in classes.
A new synchonized form allows you to synchronize on an arbitrary Java object, and execute some forms while having an exclusive lock on the object. (The syntax matches that used by Skij.)
New –debug-dump-zip option writes out a .zip file for compilation. (Useful for debugging Kawa.)
You can now declare parameter types.
Lot of work on more efficient procedure representation and calling convention: Inlining, directly callable statics method, plus some procedures no longer generate a separate Class.
Local functions that are only called from one locations, except for tail-recursion, are now inlined. This inlines do loops, and most "named let" loops.
New representation of closures (closures with captured local variables). We no longer use an array for the closure. Instead we store the captured variables in the Procedure itself. This should be faster (since we can use field accesses rather than array indexing, which requires bounds checking), and avoids a separate environment object.
If the compiler sees a function call whose (non-lexically-bound) name matches an existing (globally-defined) procedure, and that procedure instance has a static method named either "apply" or the mangled procedure name, them the compiler emits a direct call to that method. This can make a very noticable speed difference, though it may violate strict Scheme sementics, and some code may break.
Partial support for first-class "location" variables.
Created new packages gnu.mapping and gnu.expr. Many classes were moved from kawa.lang to the new packages. (This is part of the long-term process of splitting Kawa into more manageable chunks, separating the Scheme-specific code from the language-independent code, and moving classes under the gnu hierarchy.)
You can now write keywords with the colon first (e.g. :KEYWORD), which has exactly the same effect and meaning as putting the colon last (e.g. KEYWORD:). The latter is preferred is being more consistent with normal English use of punctuation, but the former is allowed for compatibility with soem other Scheme implementations and Common Lisp.
The new package gnu.text contains facilities for reading, formatting, and manipulating text. Some classes in kawa.lang where moved to there.
Added string-upcase!, string-downcase!, string-capitalize!, string-upcase, string-downcase, and string-capitalize; compatible with Slib.
Character constants can now use octal notation (as in Guile). Writing a character uses octal format when that seems best.
A format function, similar to that in Common Lisp (and Slib) has been added.
The default parameter of a #!optional or #!key parameter can now be #!null.
The "record" feature has been changed to that a "record-type descriptor"
is now a gnu.bytecode.ClassType (a <record-type>
), rather than a
java.lang.Class. Thus make-record-type now returns a
<record-typee>
, not a Class, and record-type-descriptor
takes a <record-typee>
, not a Class.
More robust Eval interfaces.
New Lexer abstract class. New ScmRead class (which extends Lexer) now contains the Scheme reader (moved from Inport). Now read errors are kept in queue, and can be recovered from.
Comparing an exact rational and an inexact real (double) is now done as if by first converting the double to exact, to satisfy R5RS.
The compile virtual method in Expression now takes a Target object, representing the "destination". The special ConditionalTarget is used to evaluate the test of an ’if expression. This allows us to generate much better code for and, or, eq?, not and nested if inside an if.
Added port-line, port-column, and set-port-line! to match Guile.
The Makefiles have been written so all out-of-date .java (or .scm). files in a directory are compiled using a single invocation of javac (or kawa). Building Kawa should now be much faster. (But note that this depends on unreleased recent autoamke changes.)
How the Kawa version number is compiled into Kawa was changed to make it easier for people who want to build from source on non-Unix-like systems.
A new gnu.ecmascript package contains an extremely incomplete implementation of ECMSScript, the ECMA standardized version of JavaScript. It includes an ECMAScript lexer (basically complete), parser (the framework is there but most of the language is missing), incomplete expression evaluation, and a read-eval-print-loop (for testing only).
Improved Kawa home page with extra links, pointer to Java-generated api docs, and homepages for gnu.math and gnu.bytecode.
Implemented system, make-process, and some related procedures.
Added macros for primitive access to object fields, static fields, and Java arrays. Added constant-fold syntax, and used it for the other macros.
The –main flag compiles Scheme code to an application (containing a main method), which can be be invoked directly by a Java interpreter.
Implemented –version (following GNU standards) as kawa.repl command-line flag.
Adding make procedure to create new objects/records.
Extended (set! (f . args) value) to be equivalent to ((setter f) value . args). Implemented setter, as well as (setter car) and (setter cdr).
Can now get and set a record field value using an application: (rec ’fname) gets the value of the field named fname in record rec. (set! (rec ’fname) value) sets the value of the field named fname in rec.
A partial re-write of the implementation of input ports and the Scheme reader, to fix some problems, add some features, and improve performance.
Compiled .class files are now installed in $(datadir)/java, rather than $(prefix)/java. By default, that means they are installed in /usr/local/shared/java, rather than /usr/local/java.
There is now internal infrastructure to support inlining of procedures, and general procedure-specific optimized code generation.
There is better testing that the right number of arguments are passed to a procedure, and better error messages when you don’t. If the procedure is inlined, you get a compile-time error message.
The functions created by primitive-constructor, primitive-virtual-method, primitive-static-method, and primitive-interface-method are now first-class procedure values. They use the Java reflection facily, except when the compiler can directly inline them (in which case it generates the same efficient bytecodes as before).
New functions instance? (tests type membership) and as (converts).
The kawa.html is now split into several files, one per chapter. The table of contents is now kawa_toc.html.
The syntactic form try-catch provides low-level exception handler support. It is basically the same as Java’s try/catch form, but in Scheme syntax. The new procedure primitive-throw throws an exception object.
The higher-level catch and throw procedures implement exception handling where the handler is specified with a "key" (a symbol). These functions were taken from Guile.
The error function has been generalized to take multiple arguments (as in Guile). It is now a wrapper around (throw ’misc-error ...).
There is a new "friendly" GUI access to the Kawa command-line. If you invoke kawa.repl with the -w flag, a new interaction window is created. This is uses the AWT TextArea class. You can create multiple "consoles". They can either share top-level enevironments, or have separate environments. This window interface has some nice features, including editing. Added a scheme-window procedure, which is another way to create a window.
The default prompt now shows continuations lines differently.
The copy-file function was added.
The variable port-char-encoding controls how external files are converted to/from internal Unicode characters. It also controls whether CR and CR-LF are converted to LF.
The reader by default no longer down-cases letters in symbols. A new variable symbol-read-case control how case is handled: ’P (the default) preserves case; ’U upper-cases letters; ’D or -" down-cases letters; and ’I inverts case.
The gnu.bytecode package now supports exception handlers. The new syntactic form try-finally supports a cleanup hook that is run after some other code finishes (normally or abnormally). Try-finally is used to implement dynamic-wind and fluid-let.
The environment handling has been improved to support thread-specific environments, a thread-safe fluid-let, and multiple top-levels. (The latter still needs a bit of work.)
The gnu.bytecode package has been extensively changed. There are new classes representing the various standard Attributes, and data associated with an attribute is now stored there.
Added new procedures environment-bound? and scheme-implementation-version.
Scheme symbols are represented as java.lang.String objects. Interned symbols are interned Strings; uninterned symbols are uninterned Strings. Note that Java strings literals are automatically interned in JDK 1.1. This change makes symbols slightly more efficient, and moves Kawa closer to Java.
Ports now use the JDK 1.1 character-based Reader and Writer classes, rather than the byte-oriented InputStream and OutputStream classes. This supports different reading and writing different character encodings [in theory - there is no support yet for other than Ascii or binary files].
An interactive input port now has a prompt function associated with it. It is settable with set-input-port-prompter!. The prompt function takes one argument (the input port), and returns a prompt string. There are also user functions for inquiring about the current line and column number of an input port.
The R4RS procedures transcript-on and transcript-off are implemented.
Standard types can be referred to using syntax similar to RScheme. For
example Scheme strings now have the type <string>
which is
preferred to "kawa.lang.FString
" (which in addition to being
longer, is also more suspectible to changes in internal implementation).
Though these types are first-class values, this is so far mainly useful
for invoking primitive methods.
Execute a ~/.kawarc.scm file on startup, if it exists.
Add a number of functions for testing, renaming, and deleting files. These are meant to be compatible with scsh, Guile, and MIT Scheme: file-exists?, file-directory?, file-readable?, file-writable?, delete-file, rename-file, create-diretory, and the variable home-directory.
Fixed some small bugs, mainly in gnu.math and in load.
Generalize apply to accept an arbitrary Sequence, or a primitive Java array.
The codegen package has been renamed gnu.bytecode. The kawa.math package has been moved to gnu.math. Both packages have new license: No restrictions if you use an unmodified release, but GNU General Public License. Let me know if that causes problems. The rest of Kawa still has the old license.
Implement defmacro and gentemp.
Implement make-record-type and related functions to create and use new record types. A record type is implemented as a java.lang.Class object, and this feature depends on the new reflection features of JDK 1.1.
Implement keywords, and extend lambda parameter lists to support #!optional #!rest and #!keyword parameters (following DSSSL).
Added more primitives to call arbitrary interface and constructor methods.
Added primitives to make it easy to call arbitrary Java methods from Scheme.
Exact rational arithetic is now fully implemented. All integer functions now believed to correctly handle bignums. Logical operations on exact integers have been implemented. These include all the logical functions from Guile.
Complex numbers are implemented (except {,a}{sin,cos,tan}). Quantities (with units) are implemented (as in DSSSL).
Eval is available, as specified for R5RS. Also implemented are scheme-report-environment, null-environment, and interaction-environment.
Internal define is implemented.
Rough support for multiple threads is implemented.
Moved kawa class to kawa/repl. Merged in kawac (compiler) functionality. A ’kawa’ shell-script is now created. This is now the preferred interface to both the interactive evaluator and the compiler (on Unix-like systems).
Now builds "without a snag" using Cafe 1.51 under Win95. (Symantec JIT
(ver 2.00b19) requires disabling JIT - JAVA_COMPCMD=disable
.)
Compiles under JDK 1.1 beta (with some warnings).
A testsuite (and testing framework) was added.
Documentation moved to doc directory. There is now an internals overview, in doc/kawa-tour.ps.
The numeric classes have been re-written. There is partial support for bignums (infinite-precision integers), but divide (for example) has not been implemented yet. The representation of bignums uses 2’s complement, where the "big digits" are laid out so as to be compatible with the mpn functions of the GNU Multi-Precision library (gmp). (The intent is that a future version of Kawa will support an option to use gmp native functions for speed.)
The kawa application takes a number of useful command-line switches.
Basically all of R4RS has been implemented. All the essential forms and functions are implemented. Almost all of the optional forms are implemented. The exceptions are transcript-on, transcript-off, and the functions for complex numbers, and fractions (exact non-integer rationals).
Loading a source file with load now wraps the entire file in a lambda (named "atFileLevel"). This is for better error reporting, and consistency with compile-file.
The hygienic macros described in the appendix to R4RS are now impemented (but only the define-syntax form). They are used to implement the standard "do" form.
The R5RS multiple value functions values
and
call-with-values
are implemented.
Macros (and primitive syntax) can now be autoloaded as well as procedures.
New kawac application compiles to one or more .class files.
Compile time errors include line numbers. Uncaught exceptions cause a stack trace that includes .scm line numbers. This makes it more practical to debug Kawa with a Java debugger.
Quasiquotation is implemented.
Various minor bug fixes and optimizations.
The biggest single change is that Scheme procedures are now compiled to Java bytecodes. This is mainly for efficiency, but it also allows us to do tail-recursion-elimination in some cases.
The "codegen" library is included. This is a toolkit that handles most of the details needed to generate Java bytecode (.class) files.
The internal structure of Kawa has been extensively re-written, especially how syntax transforms, eval, and apply are done, largely due to the needs for compilation.
Almost all the R4RS procedures are now implemented, except that there are still large gaps in Section 6.5 "Numbers".