Kawa 1.90 发布,高级动态编程语言
11月23日开源中国源创会年度(北京万豪酒店)千人盛典正在报名中
Kawa 是一个采用 Java 实现的高级动态编程语言,编译后是 Java 的类。
Kawa 1.90 是个 beta 版本,很快将会发布 Kawa 2.0 版本,此版本包括大量的新特性,最值得关注的是 R7RS 兼容性。
改进记录如下:
New
define-aliascan 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-constantis 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
evalandloadcan now take an environment-specifier.Implemented theenvironmentfunction.Extended
numerator,denominator,gcd, andlcmto inexacts.Implemented the
define-librarysyntax.More pieces of R7RS-style library functionality are working:The keyword
exportis now a synonym formodule-export,and both support therenamekeyword.Theprefixoption ofimportnow works.The
cond-expandform now supports thelibraryclause.Implemented
make-promiseanddelay-force(equivalent to the older namelazy).Implemented
include-ci. The commandincludenew searches search the containing file's directory. It does this aftersearching the current directory, for backward compatibility.Implemented
define-values.Fixed
string->numberto correctly handle aradix specifier in the string.The
readprocedure now returns mutable pairs.If you need to use
...in asyntax-rulestemplate 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 symboldotsreplaces the functionality of...in therules.An underscore
_in asyntax-rulespatternmatches anything, and is ignored.The
syntax-errorsyntax(renamed from%syntax-error) allows error reporting insyntax-rulesmacros.(The older Kawa-specificsyntax-errorprocedure was renamedtoreport-syntax-error.)Implemented and documented R7RS exception handling:The syntax
guardand the procedureswith-exception-handler,raise, andraise-continuableall work.Theerrorprocedure is R7RS-compatible, and theprocedureserror-object?,error-object-message,error-object-irritants,file-error?,andread-error?were implemented.Implemented
emergency-exit, and modifiedexitso 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->stringandstring->utf8are now documented in the manual.The changes to characters and strings are worth covering separately:
The
charactertype is now a new primitive type(implemented asint). This can avoid boxing (object allocation)There is also a new
character-or-eof.(A union ofcharacterand the EOF value, except thelatter is encoded as -1, thus avoiding object allocation.)The functions read-char andpeek-charnowreturn acharacter-or-eofvalue.Functions like
string-refthat 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-refandstring-lengthare no longer constant-time.)Implemented a
string-cursorAPI (based on Chibi Scheme).Thes allow efficient indexing, based on opaque cursors (actuallycounts of 16-bitschars).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/sharedis no longer automatically visible; you have to(import (srfi :13 strings))or similar.The
module-nameform allows the name to be a list,as in a R6RS/R7RS-style library name.The syntax
@expressionis a splicing form.Theexpressionmust 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-pathreturns (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-bytevectorandwrite-u8on 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-expandfeaturesjava-6thoughjava-9are now set based on theSystemproperty"java.version"(rather than how Kawa was configured).An Emacs-style
codingdeclaration allows youto specify the encoding of a Scheme source file.The command-line option
--debug-syntax-pattern-matchprints logging importation to standard error when asyntax-rulesorsyntax-casepattern 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
RAPairclasswhich extends the genericpairtype, which means that mostcode that expects a standard list will work on these lists as well.The class
kawa.lib.kawa.expressionscontains 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+makebuild 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.

