|
| 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 |
0 commit comments