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: Clarify identity as from perspective of spec vs language #3027

Merged
merged 1 commit into from Mar 17, 2023

Conversation

syg
Copy link
Contributor

@syg syg commented Mar 9, 2023

This 2-level stratification of identity is needed rigor for Symbols as WeakMap keys (#2777) to capture the reason for why Symbol.for symbols cannot be used as weak targets.

@syg syg added editorial change editor call to be discussed in the next editor call labels Mar 9, 2023
@syg syg requested a review from a team March 9, 2023 00:28
@syg syg changed the title Editorial: Split identity into spec and language identity Editorial: Clarify identity as from perspective of spec vs language Mar 15, 2023
spec.html Show resolved Hide resolved
spec.html Show resolved Hide resolved
@bakkot bakkot added ready to merge Editors believe this PR needs no further reviews, and is ready to land. and removed ready to merge Editors believe this PR needs no further reviews, and is ready to land. labels Mar 16, 2023
<p>A value without identity is never equal to a value with identity.</p>
<p>In this specification, both specification values and ECMAScript language values are compared for equality. When comparing for equality, values fall into one of two categories. <dfn variants="values without identity,value without identity">Values without identity</dfn> are equal to other values without identity if all of their innate characteristics are the same — characteristics such as the magnitude of an integer or the length of a sequence. Values without identity may be manifest without prior reference by fully describing their characteristics. In contrast, each <dfn variants="values with identity">value with identity</dfn> is unique and therefore only equal to itself. Values with identity are like values without identity but with an additional unguessable, unchangeable, universally-unique characteristic called <em>identity</em>. References to existing values with identity cannot be manifest simply by describing them, as the identity itself is indescribable; instead, references to these values must be explicitly passed from one place to another. Some values with identity are mutable and therefore can have their characteristics (except their identity) changed in-place, causing all holders of the value to observe the new characteristics. A value without identity is never equal to a value with identity.</p>
<p>From the perspective of this specification, the word “is” is used to compare two values for equality, as in “If _bool_ is *true*, then ...”, and the word “contains” is used to search for a value inside lists using equality comparisons, as in "If _list_ contains a Record _r_ such that _r_.[[Foo]] is *true*, then ...". The <em>specification identity</em> of values determines the result of these comparisons and is axiomatic in this specification.</p>
<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>
Copy link
Member

Choose a reason for hiding this comment

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

i'd strongly prefer this to be dfn-d, but obv landing this is more important than addressing that even if editors preferred to, so it can be addressed later if needed.

@syg syg added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Mar 16, 2023
@syg
Copy link
Contributor Author

syg commented Mar 16, 2023

Please squash when merging, @ljharb, thanks.

ljharb pushed a commit to syg/ecma262 that referenced this pull request Mar 16, 2023
This 2-level stratification of identity is needed rigor for Symbols as
WeakMap keys (tc39#2777) to capture the reason for why Symbol.for symbols
cannot be used as weak targets.
spec.html Show resolved Hide resolved
spec.html Show resolved Hide resolved
This 2-level stratification of identity is needed rigor for Symbols as
WeakMap keys (tc39#2777) to capture the reason for why Symbol.for symbols
cannot be used as weak targets.
@ljharb ljharb merged commit 5658a65 into tc39:main Mar 17, 2023
7 checks passed
@ljharb ljharb removed the editor call to be discussed in the next editor call label Mar 21, 2023
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.

None yet

4 participants