-
Notifications
You must be signed in to change notification settings - Fork 62
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
Object.is
semantics?
#20
Comments
The fact that |
@bakkot Just to clarify, would we at least say things like |
@littledan I hadn't thought about |
Interesting. Could you explain why you have those two intuitions? |
Mostly because there are currently exactly three values in the language for which |
Interesting. Yeah, I can definitely picture a lot of code that checks for NaN this way to have its assumptions broken. And I am not at all a fan of this aspect of |
I cannot think of a semantics for |
I think we still need a bit more text in the README to clarify this all. But the current README is indeed consistent with our conclusion here. |
to clarify, what are you expecting for these? @bakkot @littledan
|
i would expect those two to be the same for every value except a literal -0/0, or a literal NaN, including records and tuples with any contents. |
I am tempted to move that to an open question as there are possible ramifications on what we mean when we talk about deep equality. |
@bakkot has advocated that these both return false, so we don't expand the set of objects which are weird under comparison. Personally, I am persuaded by this argument. I want to suggest that the README take an initial position here (such as @bakkot's suggestion) and point to this issue for further discussion. |
@rickbutton, I think it is best if both of those are But yeah, this probably merits its own discussion thread - the OP was about whether (Sorry @littledan! I was in the process of typing this comment when you replied.) |
#65 covers the specific undecided point left here (how to handle |
Closing this per comment above. 🎉 |
Edit: clarity.
Two questions on this subject:
Object.is
carry pointer equality semantics or===
semantics?I'm leaning towards this:
(a => Object.is(a, a))(o)
must returntrue
for every const valueo
,Object.is(a, b)
must returnfalse
ifa !== b
or ifa
andb
are both const values from different realms, and it's implementation-dependent in all other cases.The text was updated successfully, but these errors were encountered: