1.10.844 Release
We’re happy to announce a new release of ClojureScript. If you’re an existing user of ClojureScript please read over the following release notes carefully.
Noteworthy & Breaking Changes
-
Closure Compiler has been updated to
v20210302
-
Closure Library has been updated to
0.0-20201211-3e6c510d
Note that the latest Closure Library release includes breaking changes that may impact your code:
-
goog.debug.Logger.Level
has been renamed togoog.Logger.Level
and thegoog.log.Level/getLogger
function now takes an additional argument. -
The following JavaScript type checking predicates have been removed:
goog/isString
,goog/isArray
,goog/isFunction
,goog/isNumber
, andgoog/isBoolean
. -
Closure namespace loading logic has been revised, necessitating updates to some REPLs.
New Core Features
Library Property Namespaces
When consuming a JavaScript library which is exposed as a JavaScript
object, you can now specify a property of this object to be used as a
first-class namespace in ClojureScript. To do this, you use the $
delimiter.
For example, the SubLib
property of a library object provided by npm-lib
can be treated as a namespace like so:
(ns foo
(:require [npm-lib$SubLib :as sub-lib :refer [...]]))
If needed, you can also employ string-based requires:
(ns foo
(:require ["@npm/lib$SubLib" :as sub-lib :refer [...]]))
This feature can also be used to access default
exports:
(ns foo
(:require [npm-lib$default :as npm-lib :refer [...]]))
The $
delimiter is only needed to access the top-level object property;
any nested properties are accessed via .
as in the following example:
(ns foo
(:require [react-native$NativeModules.SomeBridge :as woz]))
Notable Fixes
Accurate file name and line numbers in cljs.test
Instead of inaccurately inferring file name and line numbers from the call stack
in do-report
, they are now captured during macro-expansion based on metadata.
sort
and sort-by
retain meta
This simple change makes sort
and sort-by
consistent with Clojure. For example,
the following evaluates to {:a true}
:
(meta (sort (with-meta (range 10) {:a true})))
Performance Improvements
Reduce code generated by destructure macro for maps
The code generated to implement map destructuring was optimized by introducing a shared helper to handle kw-args, reducing a portion of the Closure-optimized output from 35 bytes down to 5, a nice savings since map destructuring is frequently employed in code.
Change List
For a complete list of updates in ClojureScript 1.10.844 see Changes.