-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syg
force-pushed
the
stratified-identity
branch
from
March 15, 2023 23:13
fdebad9
to
c6621b4
Compare
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
bakkot
reviewed
Mar 15, 2023
bakkot
reviewed
Mar 15, 2023
bakkot
approved these changes
Mar 15, 2023
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
ljharb
reviewed
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> |
There was a problem hiding this comment.
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
added
the
ready to merge
Editors believe this PR needs no further reviews, and is ready to land.
label
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.
ljharb
force-pushed
the
stratified-identity
branch
from
March 16, 2023 22:58
ed7d241
to
e166e44
Compare
bakkot
reviewed
Mar 16, 2023
bakkot
reviewed
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.
ljharb
force-pushed
the
stratified-identity
branch
from
March 17, 2023 15:58
00084d7
to
5658a65
Compare
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.