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: Rework the 'Identity' section #3217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jmdyck
Copy link
Collaborator

@jmdyck jmdyck commented Nov 8, 2023

This PR reworks the Identity section (without touching para 1). I don't think it does anything radical to the idea of identity, it just addresses some wording/exposition questions I raised in issue #3207, and also a few other nits I have with the status quo:

  • It doesn't have a visually obvious categorization of values wrt identity.
  • "From the perspective of the ECMAScript language" is ambiguous.
  • It seems a bit non-committal/cagey about defining 'specification identity' and 'language identity'.
  • It interleaves its discussion of specification identity and language identity.
  • It calls out WaiterList Records separately, which is redundant because they're Records now (since PR Normative: Add Atomics.waitAsync #3049).

Resolves #3207, I think.

@bakkot bakkot added the editor call to be discussed in the next editor call label Nov 8, 2023
@jmdyck
Copy link
Collaborator Author

jmdyck commented Nov 8, 2023

</ul>
</li>
</ul>
<p><dfn id="language-identity">Language identity</dfn> is identity as seen from the perspective of ECMAScript code. There, language values can be compared for equality in various ways, but the most discriminating is the `Object.is` built-in function, whose semantics are given by the SameValue abstract operation and the abstract operations it transitively calls. These semantics are such that, to a first approximation, language identity matches specification identity. In fact, the only difference between the two involves Symbol values: whereas all Symbols have specification identity, Symbols produced by <emu-xref href="#sec-symbol.for">Symbol.for</emu-xref> do not have language identity.</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p><dfn id="language-identity">Language identity</dfn> is identity as seen from the perspective of ECMAScript code. There, language values can be compared for equality in various ways, but the most discriminating is the `Object.is` built-in function, whose semantics are given by the SameValue abstract operation and the abstract operations it transitively calls. These semantics are such that, to a first approximation, language identity matches specification identity. In fact, the only difference between the two involves Symbol values: whereas all Symbols have specification identity, Symbols produced by <emu-xref href="#sec-symbol.for">Symbol.for</emu-xref> do not have language identity.</p>
<p><dfn id="language-identity">Language identity</dfn> is identity as seen from the perspective of ECMAScript code. All values with language identity have specification identity. The only values with specification identity which do not have language identity are Symbols produced by <emu-xref href="#sec-symbol.for">Symbol.for</emu-xref>. Language identity is used by ECMAScript code through the built-in equality comparison operations.</p>

Copy link
Contributor

Choose a reason for hiding this comment

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

I can live with this suggested rewording.

Copy link
Contributor

@syg syg left a comment

Choose a reason for hiding this comment

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

lgtm % nits

<p>From the perspective of the ECMAScript language, language values are compared for equality using the SameValue abstract operation and the abstract operations it transitively calls. The algorithms of these comparison abstract operations determine <em>language identity</em> of ECMAScript language values.</p>
<p>For specification values, examples of values without specification identity include, but are not limited to: mathematical values and extended mathematical values; ECMAScript source text, surrogate pairs, Directive Prologues, etc; UTF-16 code units; Unicode code points; enums; abstract operations, including syntax-directed operations, host hooks, etc; and ordered pairs. Examples of specification values with specification identity include, but are not limited to: any kind of Records, including Property Descriptors, PrivateElements, etc; Parse Nodes; Lists; <emu-xref href="#sec-set-and-relation-specification-type">Sets</emu-xref> and Relations; Abstract Closures; Data Blocks; Private Names; execution contexts and execution context stacks; agent signifiers; and WaiterList Records.</p>
<p>Specification identity agrees with language identity for all ECMAScript language values except Symbol values produced by <emu-xref href="#sec-symbol.for">Symbol.for</emu-xref>. The ECMAScript language values without specification identity and without language identity are <emu-xref href="#sec-ecmascript-language-types-undefined-type">*undefined*</emu-xref>, <emu-xref href="#sec-ecmascript-language-types-null-type">*null*</emu-xref>, <emu-xref href="#sec-ecmascript-language-types-boolean-type">Booleans</emu-xref>, <emu-xref href="#sec-ecmascript-language-types-string-type">Strings</emu-xref>, <emu-xref href="#sec-ecmascript-language-types-number-type">Numbers</emu-xref>, and <emu-xref href="#sec-ecmascript-language-types-bigint-type">BigInts</emu-xref>. The ECMAScript language values with specification identity and language identity are <emu-xref href="#sec-ecmascript-language-types-symbol-type">Symbols</emu-xref> not produced by <emu-xref href="#sec-symbol.for">Symbol.for</emu-xref> and <emu-xref href="#sec-object-type">Objects</emu-xref>. Symbol values produced by <emu-xref href="#sec-symbol.for">Symbol.for</emu-xref> have specification identity, but not language identity.</p>
<p>To some extent, which values have identity depends on perspective, so we distinguish <em>specification identity</em> and <em>language identity</em>.</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<p>To some extent, which values have identity depends on perspective, so we distinguish <em>specification identity</em> and <em>language identity</em>.</p>
<p>Which values have identity depends on perspective, so we distinguish <em>specification identity</em> and <em>language identity</em>.</p>

I don't think "to some extent" adds anything.

</ul>
</li>
</ul>
<p><dfn id="language-identity">Language identity</dfn> is identity as seen from the perspective of ECMAScript code. There, language values can be compared for equality in various ways, but the most discriminating is the `Object.is` built-in function, whose semantics are given by the SameValue abstract operation and the abstract operations it transitively calls. These semantics are such that, to a first approximation, language identity matches specification identity. In fact, the only difference between the two involves Symbol values: whereas all Symbols have specification identity, Symbols produced by <emu-xref href="#sec-symbol.for">Symbol.for</emu-xref> do not have language identity.</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

I can live with this suggested rewording.

@michaelficarra michaelficarra removed the editor call to be discussed in the next editor call label Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

questions (possible bugs) re specification/language identity
4 participants