Clojure 1.6 正式版发布,并发编程语言

Lisp 是一种编程语言,以表达性和功能强大著称,但人们通常认为它不太适合应用于一般情况。Clojure 是一种运行在 Java™ 平台上的 Lisp 方言,它的出现彻底改变了这一现状。如今,在任何具备 Java 虚拟机的地方,您都可以利用 Lisp 的强大功能。

作为当今最主流的运算平台JVM,把函数式编程语言引入JVM也是很多人尝试的方向,Clojure就是其中之一。Clojure是一个在JVM平台运行的动态函数式编程语言,其语法接近于LISP语言,在JVM平台运行的时候,会被编译为JVM的字节码进行运算。

Clojure保持了函数式语言的主要特点,例如immutable state,Full Lisp-style macro support,persistent data structures等等,并且还能够非常方便的调用Java类库的API,和Java类库进行良好的整合。

Clojure 1.6 正式版发布,并发编程语言

Clojure 1.6 正式版发布,下载地址:http://clojure.org/downloads

此版本更新内容如下:

1 兼容性和依赖关系

1.1 JDK 版本更新

Clojure now builds with Java SE 1.6 and emits bytecode requiring Java SE 1.6 instead of Java SE 1.5. [CLJ-1268]

1.2 ASM 库更新

The embedded version of the ASM bytecode library has been upgraded to ASM 4.1. [CLJ-713]

1.3 提升 "Alpha" 特性

The following features are no longer marked Alpha in Clojure:

  • Watches - add-watch, remove-watch

  • Transients - transient, persistent!, conj!, assoc!, dissoc!, pop!, disj!

  • Exception data - ex-info, ex-data

  • Promises - promise, deliver

  • Records - defrecord

  • Types - deftype

  • Pretty-print tables - print-table

2 新特性和改进记录

2.1 Java API

2.2 Map destructuring extended to support namespaced keys
2.3 New "some" operations
2.4 Hashing

Related tickets for dev and regressions:

  • CLJ-1328Make several Clojure tests independent of ordering

  • CLJ-1331Update primitive vectors to use Murmur3 hash

  • CLJ-1335Update hash for empty PersistentList and LazySeq

  • CLJ-1336Make hashing mixing functions available in Clojure

  • CLJ-1338Make Murmur3 class public

  • CLJ-1344Update mapHasheq to call Murmur3 algorithm

  • CLJ-1348Add hash-ordered-coll and hash-unordered-coll

  • CLJ-1355Restore cached hashCode for Symbol and (uncached) hashCode for Keyword

  • CLJ-1365Add type hints for new collection hash functions

2.5 bitops

  • CLJ-827 - unsigned-bit-shift-right

2.6 clojure.test

3 功能增强

3.1 Printing

  • CLJ-908Print metadata for functions when print-meta is true and remove errant space at beginning.

  • CLJ-937pprint cl-format now supports E, F, and G formats for ratios.

3.2 错误信息

  • CLJ-1248Include type information in reflection warning messages

  • CLJ-1099If non-seq passed where seq is needed, error message now is an ExceptionInfo with the instance value, retrievable via ex-data.

  • CLJ-1083Fix error message reporting for "munged" function names (like a->b).

  • CLJ-1056Handle more cases and improve error message for errors in defprotocol definitions.

  • CLJ-1102Better handling of exceptions with empty stack traces.

  • CLJ-939Exceptions thrown in the top level ns form are reported without file or line number.

3.3 文档字符串

  • CLJ-1164Fix typos in clojure.instant/validated and other internal instant functions.

  • CLJ-1143Correct doc string for ns macro.

  • CLJ-196Clarify value of file is undefined in the REPL.

  • CLJ-1228Fix a number of spelling errors in namespace and doc strings.

  • CLJ-835Update defmulti doc to clarify expectations for hierarchy argument.

  • CLJ-1304Fix minor typos in documentation and comments

  • CLJ-1302Mention that keys and vals order are consistent with seq order

3.4 性能

  • CLJ-858Improve speed of STM by removing System.currentTimeMillis.

  • CLJ-669clojure.java.io/do-copy: use java.nio for Files

  • commitReduce overhead of protocol callsites by removing unneeded generated cache fields.

3.5 其他改进

  • CLJ-908Make default-data-reader-fn set!-able in REPL, similar to data-readers.

  • CLJ-783Make clojure.inspector/inspect-tree work on sets.

  • CLJ-896Make browse-url aware of xdg-open.

  • CLJ-1160Fix clojure.core.reducers/mapcat does not stop on reduced? values.

  • CLJ-1121-> and ->> have been rewritten to work with a broader set of macros.

  • CLJ-1105clojure.walk now supports records.

  • CLJ-949Removed all unnecessary cases of sneakyThrow.

  • CLJ-1238Allow EdnReader to read foo// (matches LispReader behavior).

  • CLJ-1264Remove uses of _ as a var in the Java code (causes warning in Java 8).

  • CLJ-394Add record? predicate.

  • CLJ-1200ArraySeq dead code cleanup, ArraySeq_short support added.

  • CLJ-1331Primitive vectors should implement hasheq and use new hash algorithm

  • CLJ-1354Make APersistentVector.SubVector public so other collections can access

  • CLJ-1353Make awt run headless during the build process

4 Bug 修复

  • CLJ-1018Make range consistently return infinite sequence of start with a step of 0.

  • CLJ-863Make interleave return () on 0 args and identity on 1 args.

  • CLJ-1072Update internal usages of the old metadata reader syntax to new syntax.

  • CLJ-1193Make bigint and biginteger functions work on double values outside long range.

  • CLJ-1154Make Compile.java flush but not close stdout so errors can be reported.

  • CLJ-1161Remove bad version.properties from sources jar.

  • CLJ-1175Fix invalid behavior of Delay/deref if an exception is thrown - exception will now be rethrown on subsequent calls and not enter a corrupted state.

  • CLJ-1171Fix several issues with instance? to make it consistent when used with apply.

  • CLJ-1202Protocol fns with dashes may get incorrectly compiled into field accesses.

  • CLJ-850Add check to emit invokePrim with return type of double or long if type-hinted.

  • CLJ-1177clojure.java.io URL to File coercion corrupts path containing UTF-8 characters.

  • CLJ-1234Accept whitespace in Record and Type reader forms (similar to data literals).

  • CLJ-1233Allow ** as a valid symbol name without triggering dynamic warnings.

  • CLJ-1246Add support to clojure.reflect for classes with annotations.

    • CLJ-1184Evaling #{do ...} or [do ...] is treated as do special form.

  • CLJ-1090Indirect function calls through Var instances fail to clear locals.

  • CLJ-1076pprint tests fail on Windows, expecting \n.

  • CLJ-766Make into-array work consistently with short-array and byte-array on bigger types.

  • CLJ-1285Data structure invariants are violated after persistent operations when collision node created by transients.

  • CLJ-1222Multiplication overflow issues around Long/MIN_VALUE

  • CLJ-1118Inconsistent numeric comparison semantics between BigDecimals and other numerics

  • CLJ-1125Clojure can leak memory in a servlet container when using dynamic bindings or STM transactions.

  • CLJ-1082Subvecs of primitve vectors cannot be reduced

  • CLJ-1301Case expressions use a mixture of hashCode and hasheq, potentially leading to missed case matches when these differ.

  • CLJ-983proxy-super does not restore original binding if call throws exception

  • CLJ-1176clojure.repl/source errors when read-eval bound to :unknown

  • CLJ-935clojure.string/trim uses different definition of whitespace than triml and trimr

  • CLJ-1058StackOverflowError on exception in reducef for PersistentHashMap fold

  • CLJ-1328Fix some tests in the Clojure test suite to make their names unique and independent of hashing order

  • CLJ-1339Empty primitive vectors throw NPE on .equals with non-vector sequential types

  • CLJ-1363Field access via .- in reflective case does not work

  • CLJ-944Compiler gives constant collections types which mismatch their runtime values

相关推荐