Skip to content

Commit b567120

Browse files
authored
Late 2021 Release (#395)
* Late 2021 Release
1 parent 9014f24 commit b567120

File tree

3 files changed

+86
-3
lines changed

3 files changed

+86
-3
lines changed

content/news/2021-05-24-release.adoc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ user of ClojureScript please read over the following release notes carefully.
1818

1919
ClojureScript generates efficient JavaScript for `and` / `or`,
2020
employing `&&` / `||` when applied to Boolean values. Previously these
21-
optimizations were implemented directly by the `and` / `or` macros. With
21+
optimizations were implemented directly by the `and` / `or` macros. With
2222
this release they are instead implemented during a compiler pass.
2323

2424
A consequence of moving these optimizations to the code generation phase
@@ -27,6 +27,10 @@ code walking libraries like `core.async`.
2727

2828
### Support Macros that Expand to `require` Statements
2929

30+
> **NOTE:** this change been reverted in following releases as it was discovered
31+
> later (after many tests, including ClojureScript Canary) that there are many
32+
> scenarios which cannot work. It will not be reintroduced.
33+
3034
This release allows macros that expand to `require` statements
3135
to be present in the code as is illustrated in the following example:
3236

@@ -41,14 +45,14 @@ to be present in the code as is illustrated in the following example:
4145

4246
### Support `IAssociative` `-contains-key?` Protocol Check in `contains?`
4347

44-
The `IAssociative` protocol defines `-contains-key?`, which facilitates
48+
The `IAssociative` protocol defines `-contains-key?`, which facilitates
4549
directly testing whether a key is in an associative collection. The core
4650
`contains?` function has been revised with this release to make such a
4751
call for collections that implement the `IAssociative` protocol.
4852

4953
### Higher-Order Checked Arrays
5054

51-
With this release, the
55+
With this release, the
5256
https://clojurescript.org/news/2017-07-14-checked-array-access[checked array access]
5357
feature is extended for higher-order uses of `aget` and `aset`. For example,
5458

content/news/2021-11-05-release.adoc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
= 1.10.891 Release
2+
ClojureScript Team
3+
2021-11-05 10:30:00
4+
:jbake-type: post
5+
6+
ifdef::env-github,env-browser[:outfilesuffix: .adoc]
7+
8+
We're happy to announce a new release of ClojureScript. If you're an existing
9+
user of ClojureScript please read over the following release notes carefully.
10+
11+
## Noteworthy Changes
12+
13+
* Closure Compiler has been updated to `v20210808`
14+
* Google Closure has been updated to `0.0-20211011-0726fdeb`
15+
16+
## Google Closure Library, goog.module & global access
17+
18+
You should no longer assume that Google Closure Library namespaces can be
19+
reached globally because some dependency may have already loaded it. For
20+
proper usage of Google Closure Library namespaces, an explicit require is always
21+
necessary.
22+
23+
Some ClojureScript libraries assume that because `cljs.core` loaded `goog.object`,
24+
it would be safe to refer to such definitions directly, i.e. `goog.object/get` without the necessary
25+
require. This pattern can be useful in the writing of macros so that users can
26+
elide a require. However, this is now an anti-pattern and will
27+
fail.
28+
29+
Google has slowly been converting various namespaces to the `goog.module`
30+
format which does not export globally as `goog.provide` does. In order to future
31+
proof - ClojureScript now always loads `goog.module` in accordance with
32+
Closure's guidelines as Closure Library may decide to convert any namespace into
33+
a `goog.module` at any time and simply drop support for global definition for that
34+
namespace.
35+
36+
To ease the transition for the most common cases, ClojureScript has a new
37+
compiler flag to restore the old behavior - `:global-goog-object&array`.
38+
39+
Note the above guidance does not apply to ClojureScript libraries. To
40+
understand why, we briefly answer some related questions.
41+
42+
### Will ClojureScript use `goog.module`?
43+
44+
No. Clojure style REPL driven development is best supported by the original
45+
Google Closure namespace conventions. By representing namespaces as nested
46+
JavaScript objects, we effectively get late bound environments that are
47+
semantically close to Clojure's vars which permit highly interactive development
48+
workflows.
49+
50+
Like ES modules, the `goog.module` format is simply incompatible with REPL driven
51+
development. Because namespaces are effectively function closures, precise
52+
redefinition is simply not a part of the design. The complexities and tradeoffs for interactive
53+
development are readily apparent when comparing typical JavaScript "hot-reloading"
54+
workflows and the development experience available to Clojure developers.
55+
56+
### What if Closure Compiler deprecates `goog.provide`?
57+
58+
Fortunately Google Closure Compiler is very mature. Unlike currently popular JavaScript
59+
tools it does not need exports to understand what to tree-shake. Closure Compiler
60+
works on objects and their properties. Even if Closure Compiler removed `goog.provide`,
61+
we could simply provide our own analogous constructs and Closure Compiler would
62+
still be able to provide all the usual advanced optimizations.
63+
64+
## Change List
65+
66+
For a complete list of updates in ClojureScript 1.10.891 see
67+
https://github.com/clojure/clojurescript/blob/master/changes.md#1.10.891[Changes].
68+
69+
## Contributors
70+
71+
Thanks to all of the community members who contributed to ClojureScript 1.10.891:
72+
73+
* Chance Russell

content/reference/compiler-options.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ multimethod. For more info see <<xref/../javascript-library-preprocessing#,JavaS
137137
exported values. The keys may be symbols or strings. If present the foreign library can be used idiomatically
138138
when required, i.e. support for `:refer`, `:rename`, `:as`, etc.
139139

140+
[[:global-goog-object&array]]
141+
=== :global-goog-object&array
142+
143+
Defaults to `false`. If `true` load `goog.object` and `goog.array` as global
144+
namespaces rather than as `goog.module` namespaces.
145+
140146
[[install-deps]]
141147
=== :install-deps
142148

0 commit comments

Comments
 (0)