Kawa 1.90 发布,高级动态编程语言
11月23日开源中国源创会年度(北京万豪酒店)千人盛典正在报名中
Kawa 是一个采用 Java 实现的高级动态编程语言,编译后是 Java 的类。
Kawa 1.90 是个 beta 版本,很快将会发布 Kawa 2.0 版本,此版本包括大量的新特性,最值得关注的是 R7RS 兼容性。
改进记录如下:
New
define-alias
can define aliases forstatic 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 todefine-constant
, but it is evaluated in a module'sclass initializer (or constructor in the case of a non-static definition).Almost all of R7RS is now working:
The various standard libraries such as
(scheme base)
are implemented.The functions
eval
andload
can now take an environment-specifier.Implemented theenvironment
function.Extended
numerator
,denominator
,gcd
, andlcm
to inexacts.Implemented the
define-library
syntax.More pieces of R7RS-style library functionality are working:The keyword
export
is now a synonym formodule-export
,and both support therename
keyword.Theprefix
option ofimport
now works.The
cond-expand
form now supports thelibrary
clause.Implemented
make-promise
anddelay-force
(equivalent to the older namelazy
).Implemented
include-ci
. The commandinclude
new searches search the containing file's directory. It does this aftersearching the current directory, for backward compatibility.Implemented
define-values
.Fixed
string->number
to correctly handle aradix specifier in the string.The
read
procedure now returns mutable pairs.If you need to use
...
in asyntax-rules
template you can use(...template)
, which disablesthe special meaning of...
intemplate
.(This is an extension of the older(... ...)
.)Alternatively, you can can write
(syntax-rulesdots(literals)rules)
. The symboldots
replaces the functionality of...
in therules
.An underscore
_
in asyntax-rules
patternmatches anything, and is ignored.The
syntax-error
syntax(renamed from%syntax-error
) allows error reporting insyntax-rules
macros.(The older Kawa-specificsyntax-error
procedure was renamedtoreport-syntax-error
.)Implemented and documented R7RS exception handling:The syntax
guard
and the procedureswith-exception-handler
,raise
, andraise-continuable
all work.Theerror
procedure is R7RS-compatible, and theprocedureserror-object?
,error-object-message
,error-object-irritants
,file-error?
,andread-error?
were implemented.Implemented
emergency-exit
, and modifiedexit
so finally-blocks are executed.Implemented
exact-integer?
,floor/
,floor-quotient
,floor-remainder
,truncate/
,truncate-quotient
,andtruncate-remainder
.The
letrec*
syntax is now supported.(It works the same asletrec
, which is anallowed extension ofletrec
.)The functions
utf8->string
andstring->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 asint
). This can avoid boxing (object allocation)There is also a new
character-or-eof
.(A union ofcharacter
and the EOF value, except thelatter is encoded as -1, thus avoiding object allocation.)The functions read-char andpeek-char
nowreturn acharacter-or-eof
value.Functions like
string-ref
that take a characterindex would not take into account non-BMP characters (those whose valueis greater than#xffff
, thus requiring two surrogate characters).This was contrary to R6RS/R7RS. This has been fixed, though at someperformance cost . (For examplestring-ref
andstring-length
are no longer constant-time.)Implemented a
string-cursor
API (based on Chibi Scheme).Thes allow efficient indexing, based on opaque cursors (actuallycounts of 16-bitschar
s).Optimized
string-for-each
, which is now thepreferred way to iterate through a string.Implemented
string-map
.New function
string-append!
for in-placeappending to a mutable string.New function
string-replace!
for replacing asubstring 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.Theexpression
must evaluate to a sequence(vector, list, array, etc). The function application orconstructor 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
,path-bytes
, andpath-data
.Convenient syntax for re-direction: &<{pname} &>{pname} &>>{pname}.Read about processes.We also introduce "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 callwrite-bytevector
andwrite-u8
on them, making it possible for an applicationto 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).The
cond-expand
featuresjava-6
thoughjava-9
are now set based on theSystem
property"java.version"
(rather than how Kawa was configured).An Emacs-style
coding
declaration allows youto specify the encoding of a Scheme source file.The command-line option
--debug-syntax-pattern-match
prints logging importation to standard error when asyntax-rules
orsyntax-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 functionalupdate (i.e. return a modified list).These are implemented by a
RAPair
classwhich extends the genericpair
type, which means that mostcode 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 valuesto an abstract class with multiple implementations.
Internal: Started converting to more standard Java code formatting and indentationconventions, rather than GNU conventions.Some files converted; this is ongoing work.
Internal: Various I/O-related classes moved to newpackage
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.