Kawa 是一个采用 Java 实现的高级动态编程语言,编译后是 Java 的类。
Kawa 1.90 是个 beta 版本,很快将会发布 Kawa 2.0 版本,此版本包括大量的新特性,最值得关注的是 R7RS 兼容性。 改进记录如下:
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 todefine-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: 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. Implemented the define-library syntax. More pieces of R7RS-style library functionality are working:
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 thelibrary clause. Implemented make-promise and delay-force (equivalent to the older name lazy ). Implemented include-ci . The command include 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 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-rulesdots(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 insyntax-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 andstring-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 , path-bytes , and path-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 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). The cond-expand features java-6 though java-9 are now set based on theSystem 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.
|