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

use consistent phrasing for comparing string values #2794

Closed
michaelficarra opened this issue Jun 7, 2022 · 5 comments · Fixed by #2877
Closed

use consistent phrasing for comparing string values #2794

michaelficarra opened this issue Jun 7, 2022 · 5 comments · Fixed by #2877

Comments

@michaelficarra
Copy link
Member

michaelficarra commented Jun 7, 2022

@gibson042 asks what our conventions should be for comparing strings in https://github.com/tc39/ecma262/pull/2721/files/#r890585298.

I think "equals" is indeed bad, but we have many options available:

  • SameValue
  • "is the same string value"
  • "is the same sequence of code units"
  • SameValueNonNumeric
  • "is"

Let's pick something and make it consistent.

@michaelficarra michaelficarra added establishes editorial conventions editor call to be discussed in the next editor call labels Jun 7, 2022
@bakkot
Copy link
Contributor

bakkot commented Jun 7, 2022

I like "is the same string value" personally. We could dfn the term if we're worried it might not be clear.

@michaelficarra
Copy link
Member Author

We could also use the phrase within SameValueNonNumeric and use what is currently there in the dfn for that phrase.

@michaelficarra
Copy link
Member Author

Also, "is the empty String" should remain.

@michaelficarra
Copy link
Member Author

Related: #2405

Since strings don't carry identity, "is" should be fine. Also because of this, we can do things like if _list_ contains _string_ instead of something weird like if _list_ contains a string with the same string value as _string_.

@michaelficarra
Copy link
Member Author

Discussed at the editor call today. "is" or "=" would be preferable as long as we've made it clear that strings do not carry identity, so I'm going to try to fix #2405 first. We could probably then use this phrasing for all values which are declared not to have identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants