Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: consistent "*undefined* or *null*" ordering #2995

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

gibson042
Copy link
Contributor

Just increasing some uniformity in spec text:

$ grep -Eo '^ *([)]|_[^_]*_): .*[*]undefined[*].*' spec.html | \
  sed -r 's#^[^:]*: *##; s#</.*##; s#,*( or a throw.*)?$##; s#.*containing (either )?##' | \
  grep ' or ' | \
  sort | uniq -c | sort -nr
  14 a Property Descriptor or *undefined*
   7 an Object or *undefined*
   7 an Environment Record or *undefined*
   3 a Boolean or *undefined*
   2 a String or *undefined*
   1 an ECMAScript language value, but not *undefined* or *null*
   1 a possibly empty List, each of whose elements is a String or *undefined*
   1 a function object or *undefined*
   1 a Realm Record or *undefined*
   1 a Number, a BigInt, or *undefined*
   1 a Number or *undefined*
   1 a List of either Strings or *undefined*
   1 a List of either Match Records or *undefined*
   1 a BigInt or *undefined*
   1 *undefined* or a String
 grep -Eo '[*](null|undefined)[*] or [*](null|undefined)[*]' spec.html | sort | uniq -c
   3 *null* or *undefined*
  25 *undefined* or *null*

I actually prefer the reading of "null or undefined" (undefined last), but past commits have implicitly chosen the opposite.

@@ -105,7 +105,7 @@ <h1>Introduction</h1>
<p>ECMAScript 2017 introduced Async Functions, Shared Memory, and Atomics along with smaller language and library enhancements, bug fixes, and editorial updates. Async functions improve the asynchronous programming experience by providing syntax for promise-returning functions. Shared Memory and Atomics introduce a new memory model that allows multi-agent programs to communicate using atomic operations that ensure a well-defined execution order even on parallel CPUs. It also included new static methods on Object: `Object.values`, `Object.entries`, and `Object.getOwnPropertyDescriptors`.</p>
<p>ECMAScript 2018 introduced support for asynchronous iteration via the AsyncIterator protocol and async generators. It also included four new regular expression features: the `dotAll` flag, named capture groups, Unicode property escapes, and look-behind assertions. Lastly it included object rest and spread properties.</p>
<p>ECMAScript 2019 introduced a few new built-in functions: `flat` and `flatMap` on `Array.prototype` for flattening arrays, `Object.fromEntries` for directly turning the return value of `Object.entries` into a new Object, and `trimStart` and `trimEnd` on `String.prototype` as better-named alternatives to the widely implemented but non-standard `String.prototype.trimLeft` and `trimRight` built-ins. In addition, it included a few minor updates to syntax and semantics. Updated syntax included optional catch binding parameters and allowing U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) in string literals to align with JSON. Other updates included requiring that `Array.prototype.sort` be a stable sort, requiring that `JSON.stringify` return well-formed UTF-8 regardless of input, and clarifying `Function.prototype.toString` by requiring that it either return the corresponding original source text or a standard placeholder.</p>
<p>ECMAScript 2020, the 11<sup>th</sup> edition, introduced the `matchAll` method for Strings, to produce an iterator for all match objects generated by a global regular expression; `import()`, a syntax to asynchronously import Modules with a dynamic specifier; `BigInt`, a new number primitive for working with arbitrary precision integers; `Promise.allSettled`, a new Promise combinator that does not short-circuit; `globalThis`, a universal way to access the global `this` value; dedicated `export * as ns from 'module'` syntax for use within modules; increased standardization of `for-in` enumeration order; `import.meta`, a host-populated object available in Modules that may contain contextual information about the Module; as well as adding two new syntax features to improve working with “nullish” values (*null* or *undefined*): nullish coalescing, a value selection operator; and optional chaining, a property access and function invocation operator that short-circuits if the value to access/invoke is nullish.</p>
<p>ECMAScript 2020, the 11<sup>th</sup> edition, introduced the `matchAll` method for Strings, to produce an iterator for all match objects generated by a global regular expression; `import()`, a syntax to asynchronously import Modules with a dynamic specifier; `BigInt`, a new number primitive for working with arbitrary precision integers; `Promise.allSettled`, a new Promise combinator that does not short-circuit; `globalThis`, a universal way to access the global `this` value; dedicated `export * as ns from 'module'` syntax for use within modules; increased standardization of `for-in` enumeration order; `import.meta`, a host-populated object available in Modules that may contain contextual information about the Module; as well as adding two new syntax features to improve working with “nullish” values (*undefined* or *null*): nullish coalescing, a value selection operator; and optional chaining, a property access and function invocation operator that short-circuits if the value to access/invoke is nullish.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case, i think "null and undefined" makes much more sense, since explaining the term "nullish" should start with "null"

Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFM

jmdyck added a commit to jmdyck/ecma262 that referenced this pull request Jan 15, 2023
jmdyck added a commit to jmdyck/ecma262 that referenced this pull request Jan 15, 2023
michaelficarra pushed a commit to jmdyck/ecma262 that referenced this pull request Jan 25, 2023
michaelficarra pushed a commit that referenced this pull request Jan 25, 2023
@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Apr 12, 2023
@ljharb ljharb changed the title Editorial: Reorder some type disjunctions to the predominant form Editorial: consistent "*undefined* or *null*" ordering Apr 12, 2023
@ljharb ljharb merged commit 7a14721 into tc39:main Apr 12, 2023
wacky1976

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial change ready to merge Editors believe this PR needs no further reviews, and is ready to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants