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

===, SameValue, or SameValueZero (Can you match NaN?) #21

Closed
cesarandreu opened this issue Jul 5, 2017 · 3 comments
Closed

===, SameValue, or SameValueZero (Can you match NaN?) #21

cesarandreu opened this issue Jul 5, 2017 · 3 comments

Comments

@cesarandreu
Copy link

cesarandreu commented Jul 5, 2017

Do literal patterns have the same behavior as Object.is(a, b)?

Consider:

match (num) {
  -0: '-0',
  +0: '+0', 
  NaN: 'NaN',
  else: '...',
}
@ljharb
Copy link
Member

ljharb commented Jul 5, 2017

The only options seem to be ===, SameValueZero, or SameValue (Object.is).

SameValue seems the best choice, but Map/Set have precedence for SameValueZero (which was probably the wrong choice, but it's too late to fix it now).

@bterlson
Copy link
Member

bterlson commented Jul 5, 2017

Agree that SameValue seems like the best choice (and further that matching NaN is critical). I'll update the title a little bit.

@bterlson bterlson changed the title Can you match NaN? ===, SameValue, or SameValueZero (Can you match NaN?) Jul 5, 2017
@zkat
Copy link
Collaborator

zkat commented Mar 25, 2018

Hey y'all! #65 has gotten merged, and a lot of issues have become irrelevant or significantly changed in context. Because of the magnitude of changes and subtle differences in things that seem similar, we've decided to just nuke all existing issues so we can start fresh. Thank you so much for the contributions and discussions and feel free to create new issues if something seems to still be relevant, and link to the original, related issue so we can have a paper trail (but have the benefit of that clean slate anyway).

p.s. the new spec explicitly mentions using Object.is for relevant comparisons.

@zkat zkat closed this as completed Mar 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants