[gjs: 11/14] release: Document SpiderMonkey 60 changes
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 11/14] release: Document SpiderMonkey 60 changes
- Date: Sun, 29 Jul 2018 16:55:12 +0000 (UTC)
commit 34de292e3f086527904d571d7c814e69c5df951e
Author: Philip Chimento <philip chimento gmail com>
Date: Sat May 26 20:48:37 2018 -0700
release: Document SpiderMonkey 60 changes
Includes a change to a comment that previously advocated using a
nonstandard extension, which is now removed.
See: #161
NEWS | 61 +++++++++++++++++++++++++++++++++++++++++++++++
modules/overrides/GLib.js | 2 +-
2 files changed, 62 insertions(+), 1 deletion(-)
---
diff --git a/NEWS b/NEWS
index 759fbdb7..6d79157b 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,67 @@ NEXT
- GJS now depends on SpiderMonkey 60 and requires a compiler capable of C++14.
+- New JavaScript features! This version of GJS is based on SpiderMonkey 60, an
+ upgrade from the previous ESR (Extended Support Release) of SpiderMonkey 52.
+ Here are the highlights of the new JavaScript features.
+ For more information, look them up on MDN or devdocs.io.
+
+ * New syntax
+ + `for await (... of ...)` syntax is used for async iteration.
+ + The rest operator is now supported in object destructuring: e.g.
+ `({a, b, ...cd} = {a: 1, b: 2, c: 3, d: 4});`
+ + The spread operator is now supported in object literals: e.g.
+ `mergedObject = {...obj1, ...obj2};`
+ + Generator methods can now be async, using the `async function*` syntax,
+ or `async* f() {...}` method shorthand.
+ + It's now allowed to omit the variable binding from a catch statement, if
+ you don't need to access the thrown exception: `try {...} catch {}`
+
+ * New APIs
+ + Promise.prototype.finally(), popular in many third-party Promise
+ libraries, is now available natively.
+ + String.prototype.toLocaleLowerCase() and
+ String.prototype.toLocaleUpperCase() now take an optional locale or
+ array of locales.
+ + Intl.PluralRules is now available.
+ + Intl.NumberFormat.protoype.formatToParts() is now available.
+ + Intl.Collator now has a caseFirst option.
+ + Intl.DateTimeFormat now has an hourCycle option.
+
+ * New behaviour
+ + There are a lot of minor behaviour changes as SpiderMonkey's JS
+ implementation conforms ever closer to ECMAScript standards. For complete
+ information, read the Firefox developer release notes:
+ https://developer.mozilla.org/en-US/Firefox/Releases/53#JavaScript
+ https://developer.mozilla.org/en-US/Firefox/Releases/54#JavaScript
+ https://developer.mozilla.org/en-US/Firefox/Releases/55#JavaScript
+ https://developer.mozilla.org/en-US/Firefox/Releases/56#JavaScript
+ https://developer.mozilla.org/en-US/Firefox/Releases/57#JavaScript
+ https://developer.mozilla.org/en-US/Firefox/Releases/58#JavaScript
+ https://developer.mozilla.org/en-US/Firefox/Releases/59#JavaScript
+ https://developer.mozilla.org/en-US/Firefox/Releases/60#JavaScript
+
+ * Backwards-incompatible changes
+ + Conditional catch clauses have been removed, as they were a Mozilla
+ extension which will not be standardized. This requires some attention in
+ GJS programs, as previously we condoned code like `catch (e if
+ e.matches(Gio.IOError, Gio.IOError.EXISTS))` with a comment in
+ overrides/GLib.js, so it's likely this is used in several places.
+ + The nonstandard `for each (... in ...)` loop was removed.
+ + The nonstandard legacy lambda syntax (`function(x) x*x`) was removed.
+ + The nonstandard Mozilla iteration protocol was removed, as well as
+ nonstandard Mozilla generators, including the Iterator and StopIteration
+ objects, and the Function.prototype.isGenerator() method.
+ + Array comprehensions and generator comprehensions have been removed.
+ + Several nonstandard methods were removed: ArrayBuffer.slice() (but not
+ the standard version, ArrayBuffer.prototype.slice()),
+ Date.prototype.toLocaleFormat(), Function.prototype.isGenerator(),
+ Object.prototype.watch(), and Object.prototype.unwatch().
+
+- Many of the above backwards-incompatible changes can be caught by scanning
+ your source code using https://gitlab.gnome.org/ptomato/moz60tool, or
+ https://extensions.gnome.org/extension/1455/spidermonkey-60-migration-validator/
+
- Deprecation: the custom ByteArray is now discouraged. Instead of ByteArray,
use Javascript's native Uint8Array. The ByteArray module still contains
functions for converting between byte arrays, strings, and GLib.Bytes
diff --git a/modules/overrides/GLib.js b/modules/overrides/GLib.js
index fd5ff3b8..9f90d22c 100644
--- a/modules/overrides/GLib.js
+++ b/modules/overrides/GLib.js
@@ -250,7 +250,7 @@ function _init() {
GLib = this;
// small HACK: we add a matches() method to standard Errors so that
- // you can do "catch(e if e.matches(Ns.FooError, Ns.FooError.SOME_CODE))"
+ // you can do "if (e.matches(Ns.FooError, Ns.FooError.SOME_CODE))"
// without checking instanceof
Error.prototype.matches = function() { return false; };
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]