当前位置

网站首页> 程序设计 > 程序资讯 > 软件更新资讯 > 浏览文章

Kawa 1.90 发布,高级动态编程语言

作者:小梦 来源: 网络 时间: 2024-08-05 阅读:

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 and loadcan 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 includenew 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 a syntax-rulestemplate you can use (...template), which disablesthe 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 patternmatches 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 renamedto 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 theprocedures error-object?, error-object-message,error-object-irritants, file-error?,and read-error? were implemented.

    • Implemented emergency-exit, and modified exitso 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 anallowed extension of letrec.)

    • The functions utf8->stringand 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 thelatter is encoded as -1, thus avoiding object allocation.)The functions read-char and peek-char nowreturn a character-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 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 (actuallycounts of 16-bits chars).

    • 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-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 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, 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-bytevectorand write-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 features java-6though java-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-matchprints logging importation to standard error when a syntax-rulesor 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 functionalupdate (i.e. return a modified list).These are implemented by a RAPair classwhich extends the generic pair type, 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+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.


热点阅读

网友最爱