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

[spec] hex-escape punctuators #67

Merged
merged 1 commit into from
Mar 25, 2024
Merged

[spec] hex-escape punctuators #67

merged 1 commit into from
Mar 25, 2024

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented Mar 22, 2024

Fixes #65

spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated Show resolved Hide resolved
spec.emu Show resolved Hide resolved
@ljharb ljharb requested a review from bakkot March 25, 2024 20:03
spec.emu Outdated Show resolved Hide resolved
spec.emu Outdated
</h1>
<dl class="header">
<dt>description</dt>
<dd>If the code unit represents a RegExp punctuator that needs escaping, or ASCII whitespace, it produces the code units for *"\x"* followed by the relevant escape code. If the code unit represents non-ASCII white space, it produces the code units for *"\u"* followed by the relevant escape code. Otherwise, it returns a List containing the original code unit.</dd>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<dd>If the code unit represents a RegExp punctuator that needs escaping, or ASCII whitespace, it produces the code units for *"\x"* followed by the relevant escape code. If the code unit represents non-ASCII white space, it produces the code units for *"\u"* followed by the relevant escape code. Otherwise, it returns a List containing the original code unit.</dd>
<dd>If _c_ represents a RegExp punctuator that needs escaping or ASCII whitespace, it produces the code points for *"\x"* followed by the relevant escape code. If _c_ represents non-ASCII white space, it produces the code points for *"\u"* followed by the relevant escape code. Otherwise, it returns a singleton List containing _c_.</dd>

Copy link
Member Author

@ljharb ljharb Mar 25, 2024

Choose a reason for hiding this comment

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

The _c_ replacements seem good, done; but i think the comma is necessary for it to read properly, and what is a "singleton" List vs any other kind of List?

Copy link
Member

Choose a reason for hiding this comment

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

A singleton list has one element. This is to be explicit that it's not any old list that contains c (and possibly other things) but the list that contains only c.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a really confusing word to use to me; in JS a singleton is when you have a class with a single shared instance. Is that qualifier necessary, given that it already says "a List containing c"?

Copy link
Member

Choose a reason for hiding this comment

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

It's not necessary, I just thought it was a cheap way to be more precise. https://en.wikipedia.org/wiki/Singleton_(mathematics)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see how it adds precision, since the prose already explicitly says it has one item in it.

Copy link
Member

Choose a reason for hiding this comment

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

Where does it say that?

Copy link
Member Author

Choose a reason for hiding this comment

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

isn't "Otherwise, it returns a List containing the original code unit" that?

either way i'd like to land this, and i'm happy to have a PR tweaking it further, or we can do it at 262 time.

Copy link
Member

Choose a reason for hiding this comment

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

isn't "Otherwise, it returns a List containing the original code unit" that?

I still don't know where this prose you're referring to is.

[a] is a list containing a, and is also a singleton list containing a. [a, b] is another list containing a, but is not a singleton list.

Anyway, it's not important, but for me it seemed like an easy win for precision.

spec.emu Outdated Show resolved Hide resolved
Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

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

LGTM otherwise.

@ljharb ljharb merged commit f01c310 into main Mar 25, 2024
2 checks passed
@ljharb ljharb deleted the hex-escapes branch March 25, 2024 21:20
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

Successfully merging this pull request may close these issues.

change escaping to hex escape sequences
5 participants